Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TrainerCommandParser Class Reference

#include <trainercommandparser.h>

Inheritance diagram for TrainerCommandParser:

Inheritance graph
[legend]
Collaboration diagram for TrainerCommandParser:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::map< std::string,
ECommandType
TCommandMap
typedef std::map< std::string,
TTeamIndex
TTeamIndexMap
typedef std::map< std::string,
TPlayMode
TPlayModeMap
enum  ECommandType {
  CT_PLAYER, CT_BALL, CT_PLAYMODE, CT_DROP_BALL,
  CT_KICK_OFF, CT_ACK
}

Public Member Functions

 TrainerCommandParser ()
virtual ~TrainerCommandParser ()
bool SendAck (std::string &reply)
virtual void ParseMonitorMessage (const std::string &data)
 This function will be called be called from the monitor server implementation to parse any command strings received from the monitor client process.
virtual void OnLink ()
 This method is called, when the hierarchy object has been linked to a parent.
virtual void OnUnlink ()
 This rountine is called, before the hierarchy object is removed from the parent.

Protected Member Functions

void ParsePredicates (oxygen::PredicateList &predList)
 parses the list of predicates; returns true on success
bool ParsePredicate (const oxygen::Predicate &predicate)
 parses the given predicate and calls one of the specialized parse methods given below depending the predicate name; returns true if successful
void ParsePlayerCommand (const oxygen::Predicate &predicate)
 parses and executes the player command contained in the given predicate
void ParseBallCommand (const oxygen::Predicate &predicate)
 parses and executes the ball command contained in the given predicate
void ParsePlayModeCommand (const oxygen::Predicate &predicate)
 parses and executes the play mode command contained in the given predicate
void ParseKickOffCommand (const oxygen::Predicate &predicate)
 parses and executes the kick off command contained in the given predicate

Protected Attributes

TCommandMap mCommandMap
TTeamIndexMap mTeamIndexMap
TPlayModeMap mPlayModeMap
boost::shared_ptr< GameStateAspectmGameState
 cached reference for the gamestate aspect
boost::shared_ptr< SoccerRuleAspectmSoccerRule
 cached reference for the soccer rule aspect
boost::shared_ptr< oxygen::BaseParsermSexpParser
 the parser used to create the PredicateList
bool mGetAck
std::string mAckString

Detailed Description

Definition at line 36 of file trainercommandparser.h.


Member Typedef Documentation

typedef std::map<std::string, ECommandType> TrainerCommandParser::TCommandMap
 

Definition at line 50 of file trainercommandparser.h.

typedef std::map<std::string, TPlayMode> TrainerCommandParser::TPlayModeMap
 

Definition at line 54 of file trainercommandparser.h.

typedef std::map<std::string, TTeamIndex> TrainerCommandParser::TTeamIndexMap
 

Definition at line 51 of file trainercommandparser.h.


Member Enumeration Documentation

enum TrainerCommandParser::ECommandType
 

Enumerator:
CT_PLAYER 
CT_BALL 
CT_PLAYMODE 
CT_DROP_BALL 
CT_KICK_OFF 
CT_ACK 

Definition at line 40 of file trainercommandparser.h.


Constructor & Destructor Documentation

TrainerCommandParser::TrainerCommandParser  ) 
 

Definition at line 38 of file trainercommandparser.cpp.

References CT_ACK, CT_BALL, CT_DROP_BALL, CT_KICK_OFF, CT_PLAYER, CT_PLAYMODE, mCommandMap, mGetAck, mPlayModeMap, mTeamIndexMap, PM_BeforeKickOff, PM_CORNER_KICK_LEFT, PM_CORNER_KICK_RIGHT, PM_FREE_KICK_LEFT, PM_FREE_KICK_RIGHT, PM_GameOver, PM_GOAL_KICK_LEFT, PM_GOAL_KICK_RIGHT, PM_Goal_Left, PM_Goal_Right, PM_KickIn_Left, PM_KickIn_Right, PM_KickOff_Left, PM_KickOff_Right, PM_OFFSIDE_LEFT, PM_OFFSIDE_RIGHT, PM_PlayOn, STR_PM_BeforeKickOff, STR_PM_CORNER_KICK_LEFT, STR_PM_CORNER_KICK_RIGHT, STR_PM_FREE_KICK_LEFT, STR_PM_FREE_KICK_RIGHT, STR_PM_GameOver, STR_PM_GOAL_KICK_LEFT, STR_PM_GOAL_KICK_RIGHT, STR_PM_Goal_Left, STR_PM_Goal_Right, STR_PM_KickIn_Left, STR_PM_KickIn_Right, STR_PM_KickOff_Left, STR_PM_KickOff_Right, STR_PM_OFFSIDE_LEFT, STR_PM_OFFSIDE_RIGHT, STR_PM_PlayOn, TI_LEFT, TI_NONE, and TI_RIGHT.

TrainerCommandParser::~TrainerCommandParser  )  [virtual]
 

Definition at line 78 of file trainercommandparser.cpp.


Member Function Documentation

void TrainerCommandParser::OnLink  )  [virtual]
 

This method is called, when the hierarchy object has been linked to a parent.

At that point, traversal can commence. It can be overridden to support custom 'link' behavior.

Reimplemented from zeitgeist::Leaf.

Definition at line 97 of file trainercommandparser.cpp.

References zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), and mSexpParser.

Here is the call graph for this function:

void TrainerCommandParser::OnUnlink  )  [virtual]
 

This rountine is called, before the hierarchy object is removed from the parent.

It can be overridden to support custom 'unlink' behavior.

Reimplemented from zeitgeist::Leaf.

Definition at line 110 of file trainercommandparser.cpp.

References mSexpParser.

void TrainerCommandParser::ParseBallCommand const oxygen::Predicate predicate  )  [protected]
 

parses and executes the ball command contained in the given predicate

Definition at line 341 of file trainercommandparser.cpp.

References oxygen::Predicate::FindParameter(), SoccerBase::GetBallBody(), zeitgeist::Object::GetLog(), and oxygen::Predicate::GetValue().

Referenced by ParsePredicate().

Here is the call graph for this function:

void TrainerCommandParser::ParseKickOffCommand const oxygen::Predicate predicate  )  [protected]
 

parses and executes the kick off command contained in the given predicate

Definition at line 430 of file trainercommandparser.cpp.

References zeitgeist::Object::GetLog(), oxygen::Predicate::GetValue(), mGameState, and mTeamIndexMap.

Referenced by ParsePredicate().

Here is the call graph for this function:

void TrainerCommandParser::ParseMonitorMessage const std::string &  data  )  [virtual]
 

This function will be called be called from the monitor server implementation to parse any command strings received from the monitor client process.

Implements oxygen::MonitorCmdParser.

Definition at line 115 of file trainercommandparser.cpp.

References zeitgeist::Object::GetLog(), mSexpParser, and ParsePredicates().

Here is the call graph for this function:

void TrainerCommandParser::ParsePlayerCommand const oxygen::Predicate predicate  )  [protected]
 

parses and executes the player command contained in the given predicate

Definition at line 196 of file trainercommandparser.cpp.

References oxygen::Predicate::FindParameter(), SoccerBase::GetAgentBody(), SoccerBase::GetAgentState(), zeitgeist::Object::GetLog(), oxygen::Predicate::GetValue(), and mTeamIndexMap.

Referenced by ParsePredicate().

Here is the call graph for this function:

void TrainerCommandParser::ParsePlayModeCommand const oxygen::Predicate predicate  )  [protected]
 

parses and executes the play mode command contained in the given predicate

Definition at line 401 of file trainercommandparser.cpp.

References zeitgeist::Object::GetLog(), oxygen::Predicate::GetValue(), mGameState, and mPlayModeMap.

Referenced by ParsePredicate().

Here is the call graph for this function:

bool TrainerCommandParser::ParsePredicate const oxygen::Predicate predicate  )  [protected]
 

parses the given predicate and calls one of the specialized parse methods given below depending the predicate name; returns true if successful

Definition at line 145 of file trainercommandparser.cpp.

References CT_ACK, CT_BALL, CT_DROP_BALL, CT_KICK_OFF, CT_PLAYER, CT_PLAYMODE, SoccerBase::GetGameState(), SoccerBase::GetSoccerRuleAspect(), mCommandMap, mGameState, mGetAck, mSoccerRule, oxygen::Predicate::name, ParseBallCommand(), ParseKickOffCommand(), ParsePlayerCommand(), and ParsePlayModeCommand().

Referenced by ParsePredicates().

Here is the call graph for this function:

void TrainerCommandParser::ParsePredicates oxygen::PredicateList predList  )  [protected]
 

parses the list of predicates; returns true on success

Definition at line 127 of file trainercommandparser.cpp.

References oxygen::PredicateList::begin(), oxygen::PredicateList::end(), and ParsePredicate().

Referenced by ParseMonitorMessage().

Here is the call graph for this function:

bool TrainerCommandParser::SendAck std::string &  reply  ) 
 

Definition at line 84 of file trainercommandparser.cpp.

References mGetAck.


Member Data Documentation

std::string TrainerCommandParser::mAckString [protected]
 

Definition at line 119 of file trainercommandparser.h.

TCommandMap TrainerCommandParser::mCommandMap [protected]
 

Definition at line 105 of file trainercommandparser.h.

Referenced by ParsePredicate(), and TrainerCommandParser().

boost::shared_ptr<GameStateAspect> TrainerCommandParser::mGameState [protected]
 

cached reference for the gamestate aspect

Definition at line 112 of file trainercommandparser.h.

Referenced by ParseKickOffCommand(), ParsePlayModeCommand(), and ParsePredicate().

bool TrainerCommandParser::mGetAck [protected]
 

Definition at line 118 of file trainercommandparser.h.

Referenced by ParsePredicate(), SendAck(), and TrainerCommandParser().

TPlayModeMap TrainerCommandParser::mPlayModeMap [protected]
 

Definition at line 109 of file trainercommandparser.h.

Referenced by ParsePlayModeCommand(), and TrainerCommandParser().

boost::shared_ptr<oxygen::BaseParser> TrainerCommandParser::mSexpParser [protected]
 

the parser used to create the PredicateList

Definition at line 116 of file trainercommandparser.h.

Referenced by OnLink(), OnUnlink(), and ParseMonitorMessage().

boost::shared_ptr<SoccerRuleAspect> TrainerCommandParser::mSoccerRule [protected]
 

cached reference for the soccer rule aspect

Definition at line 114 of file trainercommandparser.h.

Referenced by ParsePredicate().

TTeamIndexMap TrainerCommandParser::mTeamIndexMap [protected]
 

Definition at line 107 of file trainercommandparser.h.

Referenced by ParseKickOffCommand(), ParsePlayerCommand(), and TrainerCommandParser().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:41:33 2006 for rcssserver3d by  doxygen 1.4.4