#include <ActHandler.h>
Collaboration diagram for ActHandler:
Public Methods | |
ActHandler (Connection *c, WorldModel *wm, ServerSettings *ss) | |
bool | putCommandInQueue (SoccerCommand command) |
void | emptyQueue () |
bool | isQueueEmpty () |
bool | sendCommands () |
SoccerCommand | getPrimaryCommand () |
bool | sendCommand (SoccerCommand soc) |
bool | sendMessage (char *str) |
bool | sendCommandDirect (SoccerCommand soc) |
bool | sendMessageDirect (char *str) |
Private Attributes | |
Connection * | connection |
ServerSettings * | SS |
WorldModel * | WM |
SoccerCommand | m_queueOneCycleCommand |
SoccerCommand | m_queueMultipleCommands [CMD_MAX_COMMANDS] |
int | m_iMultipleCommands |
Definition at line 87 of file ActHandler.h.
|
This is the constructor for the ActHandler class. All the variables are initialized.
Definition at line 79 of file ActHandler.cpp. References connection, m_iMultipleCommands, SS, and WM. |
|
This method empties the queue in which all the commands are stored. Definition at line 90 of file ActHandler.cpp. References CMD_ILLEGAL, CMD_MAX_COMMANDS, SoccerCommand::commandType, m_iMultipleCommands, m_queueMultipleCommands, and m_queueOneCycleCommand. Referenced by sendMessage(). |
|
This method returns the primary command that is currently stored in the queue. Definition at line 201 of file ActHandler.cpp. References m_queueOneCycleCommand. Referenced by Player::sayBallStatus(). |
|
This method returns whether the current queue contains no commands
Definition at line 100 of file ActHandler.cpp. References CMD_ILLEGAL, SoccerCommand::commandType, m_iMultipleCommands, and m_queueOneCycleCommand. |
|
This method puts a SoccerCommand in the queue. The last added command will be sent to the soccerserver when the method sendCommands is performed. Normally this is done when a signal set by the SenseHandler arrives.
Definition at line 211 of file ActHandler.cpp. References CMD_ILLEGAL, CMD_MAX_COMMANDS, SoccerCommand::commandType, SoccerTypes::isPrimaryCommand(), m_iMultipleCommands, m_queueMultipleCommands, and m_queueOneCycleCommand. Referenced by Player::deMeer5(), Player::deMeer5_goalie(), Player::executeStringCommand(), Player::mainLoop(), and Player::performPenalty(). |
|
This method sends a single command directly to the server. First a string is made from the SoccerCommand and afterwards this string is send to the server using the method sendMessage.
Definition at line 247 of file ActHandler.cpp. References SoccerCommand::getCommandString(), MAX_MSG, sendMessage(), and SS. |
|
This method sends a single command directly to the server. First a string is made from the SoccerCommand and afterwards this string is send to the server using the method sendMessageDirect.
Definition at line 284 of file ActHandler.cpp. References CMD_ILLEGAL, SoccerCommand::commandType, SoccerCommand::getCommandString(), MAX_MSG, sendMessageDirect(), and SS. Referenced by BasicCoach::substitutePlayer(). |
|
This method converts all commands in the queue to text strings and sends these text strings to the server (connected by Connection). When the server didn't execute the commands from the previous cycle (this information is stored in the WorldModel) the commands in the queue are not sent, since it is probably the case that these commands will be performed this cycle and we don't want a clash (two commands in one cycle). In this case false is returned.
Definition at line 114 of file ActHandler.cpp. References CMD_CATCH, CMD_ILLEGAL, CMD_MAX_COMMANDS, SoccerCommand::commandType, connection, SoccerCommand::getCommandString(), WorldModel::getCommunicationString(), WorldModel::getCurrentCycle(), WorldModel::getCurrentTime(), WorldModel::getPlayerNumber(), WorldModel::isFullStateOn(), WorldModel::isQueuedActionPerformed(), SoccerCommand::iTimes, m_iMultipleCommands, m_queueMultipleCommands, m_queueOneCycleCommand, MAX_MSG, MAX_SAY_MSG, WorldModel::processQueuedCommands(), Connection::sendMessage(), WorldModel::setCommunicationString(), SS, and WM. Referenced by Player::mainLoop(), and sigalarmHandler(). |
|
This method sends a single string directly to the server. To make sure this message arrives, the time of one complete cycle is waited before and after the message is sent.
Definition at line 259 of file ActHandler.cpp. References connection, emptyQueue(), ServerSettings::getSimulatorStep(), Connection::sendMessage(), and SS. Referenced by BasicCoach::BasicCoach(), Player::executeStringCommand(), BasicCoach::executeStringCommand(), Player::mainLoop(), Player::Player(), and sendCommand(). |
|
This method sends a single string directly to the server.
Definition at line 296 of file ActHandler.cpp. References connection, and Connection::sendMessage(). Referenced by Player::mainLoop(), BasicCoach::mainLoopNormal(), and sendCommandDirect(). |
|
Connection with the server Definition at line 89 of file ActHandler.h. Referenced by ActHandler(), sendCommands(), sendMessage(), and sendMessageDirect(). |
|
number of non-primary commands Definition at line 96 of file ActHandler.h. Referenced by ActHandler(), emptyQueue(), isQueueEmpty(), putCommandInQueue(), and sendCommands(). |
|
non primary commands Definition at line 95 of file ActHandler.h. Referenced by emptyQueue(), putCommandInQueue(), and sendCommands(). |
|
primary command is saved here Definition at line 93 of file ActHandler.h. Referenced by emptyQueue(), getPrimaryCommand(), isQueueEmpty(), putCommandInQueue(), and sendCommands(). |
|
ServerSettings with server parameters Definition at line 90 of file ActHandler.h. Referenced by ActHandler(), sendCommand(), sendCommandDirect(), sendCommands(), and sendMessage(). |
|
needed to set performed actions Definition at line 91 of file ActHandler.h. Referenced by ActHandler(), and sendCommands(). |