📄 command.h
字号:
/* * Copyright 2002-2005, Mersad Team, Allameh Helli High School (NODET). * * This program is free software, you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * This file is created by: Mohsen Izadi * and is modified by: Ahmad Boorghany, Mohammad Salehe, * Darioush Jalali * * Released on Monday 1 August 2005, 10 Mordad 1384 by Mersad RoboCup Team. * For more information please read README file.*/#ifndef __COMMAND_H#define __COMMAND_H#include <string>#include <Types.h>#ifndef NULL# define NULL 0#endif // NULLenum CommandType{ CT_ATTENTION, CT_BYE, CT_CATCH, CT_CHANGE_VIEW, CT_DASH, CT_DONE, CT_EMPTY, CT_INIT, CT_KICK, CT_MOVE, CT_SAY, CT_TACKLE, CT_TURN, CT_TURN_NECK, CT_EYE, CT_FREEFORM, CT_CHANGE_PLAYER};class Command{protected: ActionType creator;public: Command(ActionType creator); virtual ~Command(); virtual std::string toString() const = 0; ActionType getCreator() const; void setCreator(ActionType creatorArg);};class AttentionToCommand: public Command{protected: TeamId teamId; int uniformNum; public: AttentionToCommand(ActionType creator, TeamId teamId, int uniformNum); virtual ~AttentionToCommand(); virtual std::string toString() const; // Getting functions TeamId getTeamId() const; int getUniformNum() const;};class ByeCommand: public Command{public: ByeCommand(ActionType creator); virtual ~ByeCommand(); virtual std::string toString() const;};class CatchCommand: public Command{protected: float direction; public: CatchCommand(ActionType creator, float direction); virtual ~CatchCommand(); virtual std::string toString() const; // Getting functions float getDirection() const;};class ChangeViewCommand: public Command{protected: ViewModeQuality quality; ViewModeWidth width; public: ChangeViewCommand(ActionType creator, ViewModeQuality quality, ViewModeWidth width); virtual ~ChangeViewCommand(); virtual std::string toString() const; // Getting functions ViewModeQuality getQuality() const; ViewModeWidth getWidth() const;};class DashCommand: public Command{protected: float power; public: DashCommand(ActionType creator, float power); virtual ~DashCommand(); virtual std::string toString() const; // Getting functions float getPower() const; // Setting functions void setPower(float powerArg);};class DoneCommand: public Command{public: DoneCommand(ActionType creator); virtual ~DoneCommand(); virtual std::string toString() const;};class EmptyCommand: public Command{public: EmptyCommand(ActionType creator); virtual ~EmptyCommand(); virtual std::string toString() const;};class InitCommand: public Command{protected: std::string teamName; std::string version; bool isGoalie;public: InitCommand(ActionType creator, const std::string &teamName, const std::string &version, bool isGoalie); virtual ~InitCommand(); virtual std::string toString() const; // Getting functions const std::string &getTeamName() const; const std::string &getVersion() const; bool getIsGoalie() const;};class KickCommand: public Command{protected: float power; float direction; public: KickCommand(ActionType creator, float power, float direction); virtual ~KickCommand(); virtual std::string toString() const; // Getting functions float getPower() const; float getDirection() const; // Setting functions void setPower(float powerArg); void setDirection(float directionArg);};class MoveCommand: public Command{protected: float x; float y; public: MoveCommand(ActionType creator, Point point); MoveCommand(ActionType creator, float x, float y); virtual ~MoveCommand(); virtual std::string toString() const; // Getting functions float getX() const; float getY() const;};class PointToCommand: public Command{protected: bool status; float dist; float dir; public: PointToCommand(ActionType creator, bool status = false); PointToCommand(ActionType creator, float dist, float dir); virtual ~PointToCommand(); virtual std::string toString() const; // Getting functions float getDist() const; float getDir() const;};class SayCommand: public Command{protected: std::string message; public: SayCommand(ActionType creator, const std::string &message); virtual ~SayCommand(); virtual std::string toString() const; // Getting functions const std::string &getMessage() const;};class TackleCommand: public Command{protected: float power; public: TackleCommand(ActionType creator, float power); virtual ~TackleCommand(); virtual std::string toString() const; // Getting functions float getPower() const;};class TurnCommand: public Command{protected: float direction; public: TurnCommand(ActionType creator, float direction); virtual ~TurnCommand(); virtual std::string toString() const; // Getting functions float getDirection() const;};class TurnNeckCommand: public Command{protected: float direction; public: TurnNeckCommand(ActionType creator, float direction); virtual ~TurnNeckCommand(); virtual std::string toString() const; // Getting functions float getDirection() const;};class EyeCommand: public Command{protected: bool on; public: EyeCommand(ActionType creator, bool on); virtual ~EyeCommand(); virtual std::string toString() const; // Getting functions bool isOn() const;};class ChangePlayerCommand: public Command{protected: int uniformNum; int playerType;public: ChangePlayerCommand(ActionType creator, int uniformNum, int playerType); virtual ~ChangePlayerCommand(); virtual std::string toString() const; // Getting functions int getUniformNum() const; int getPlayerType() const;};class FreeFormCommand: public Command{protected: std::string message; public: FreeFormCommand(ActionType creator, const std::string &message); virtual ~FreeFormCommand(); virtual std::string toString() const; // Getting functions const std::string &getMessage() const;};class CLangVersionCommand: public Command{protected: int minVer, maxVer; public: CLangVersionCommand(ActionType creator, int minVer, int maxVer); virtual ~CLangVersionCommand(); virtual std::string toString() const; // Getting functions int getMinVer() const; int getMaxVer() const;};//////////// commands added for trainerclass ChangePlayModeCommand : public Command { protected: std::string playMode; public: ChangePlayModeCommand(ActionType creator, const std::string & playMode) ; virtual ~ChangePlayModeCommand() ; virtual std::string toString() const; // getting const std::string & getPlayMode() const;};class StartCommand: public Command { public: StartCommand(ActionType creator); virtual ~StartCommand(); virtual std::string toString() const;};class RecoverCommand: public Command { public: RecoverCommand(ActionType creator); virtual ~RecoverCommand(); virtual std::string toString() const;};class EarCommand: public Command { protected: bool hear; public: EarCommand(ActionType creator, bool hear); virtual ~EarCommand( ); virtual std::string toString() const;};class TrainerInitCommand: public Command { protected: std::string version; public: TrainerInitCommand(ActionType creator, const std::string & version); virtual ~TrainerInitCommand(); virtual std::string toString() const;};class TrainerChangePlayerCommand: public Command{protected: int uniformNum; int playerType; std::string teamName;public: TrainerChangePlayerCommand(ActionType creator, const std::string &teamName, int uniformNum, int playerType); virtual ~TrainerChangePlayerCommand(); virtual std::string toString() const; // Getting functions int getUniformNum() const; int getPlayerType() const; const std::string & getTeamName() const;};class LookCommand:public Command { public: LookCommand(ActionType creator); virtual ~LookCommand(); virtual std::string toString() const;};class MoveBallCommand: public Command { protected: float x, y, vdir, vx, vy; //note vdir is NOT important public: MoveBallCommand(ActionType creator, float x, float y, float vdir, float vx, float vy); virtual ~MoveBallCommand(); std::string toString() const;};class MovePlayerCommand : public Command { protected: std::string teamName; int uNum; float x,y,vdir,vx,vy; public: MovePlayerCommand(ActionType creator, const std::string &teamName, int uNum, float x, float y, float vdir,float vx, float vy); virtual ~MovePlayerCommand(); std::string toString() const;};class TeamNamesCommand :public Command { public: TeamNamesCommand(ActionType creator); virtual ~TeamNamesCommand(); std::string toString() const;};#endif // __COMMAND_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -