#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 () |
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 [MAX_COMMANDS] |
int | m_iMultipleCommands |
Definition at line 75 of file ActHandler.h.
|
This is the constructor for the ActHandler class. All the variables are initialized.
Definition at line 67 of file ActHandler.C. References connection, m_iMultipleCommands, SS, and WM. |
|
This method empties the queue in which all the commands are stored. Definition at line 78 of file ActHandler.C. References CMD_ILLEGAL, SoccerCommand::commandType, m_iMultipleCommands, m_queueMultipleCommands, m_queueOneCycleCommand, and MAX_COMMANDS. Referenced by sendMessage(). |
|
This method returns whether the current queue contains no commands
Definition at line 88 of file ActHandler.C. 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 168 of file ActHandler.C. References CMD_ILLEGAL, SoccerCommand::commandType, SoccerTypes::isPrimaryCommand(), m_iMultipleCommands, m_queueMultipleCommands, m_queueOneCycleCommand, and MAX_COMMANDS. Referenced by Player::deMeer5(), Player::deMeer5_goalie(), Player::executeStringCommand(), and BasicPlayer::turnWithBallTo(). |
|
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 204 of file ActHandler.C. 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 233 of file ActHandler.C. References SoccerCommand::getCommandString(), MAX_MSG, sendMessageDirect(), and SS. Referenced by Player::mainLoop(). |
|
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 102 of file ActHandler.C. References CMD_CATCH, CMD_ILLEGAL, SoccerCommand::commandType, connection, SoccerCommand::getCommandString(), WorldModel::getCurrentTime(), WorldModel::isQueuedActionPerformed(), SoccerCommand::iTimes, m_iMultipleCommands, m_queueMultipleCommands, m_queueOneCycleCommand, MAX_COMMANDS, MAX_MSG, WorldModel::processQueuedCommands(), Connection::sendMessage(), 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 216 of file ActHandler.C. References connection, emptyQueue(), ServerSettings::getSimulatorStep(), Connection::sendMessage(), and SS. Referenced by Player::executeStringCommand(), Player::Player(), and sendCommand(). |
|
This method sends a single string directly to the server.
Definition at line 243 of file ActHandler.C. References connection, and Connection::sendMessage(). Referenced by sendCommandDirect(). |
|
Connection with the server Definition at line 77 of file ActHandler.h. Referenced by ActHandler(), sendCommands(), sendMessage(), and sendMessageDirect(). |
|
number of non-primary commands Definition at line 83 of file ActHandler.h. Referenced by ActHandler(), emptyQueue(), isQueueEmpty(), putCommandInQueue(), and sendCommands(). |
|
nonprimary commands Definition at line 82 of file ActHandler.h. Referenced by emptyQueue(), putCommandInQueue(), and sendCommands(). |
|
primary command is saved here Definition at line 81 of file ActHandler.h. Referenced by emptyQueue(), isQueueEmpty(), putCommandInQueue(), and sendCommands(). |
|
ServerSettings with server parameters Definition at line 78 of file ActHandler.h. Referenced by ActHandler(), sendCommand(), sendCommandDirect(), sendCommands(), and sendMessage(). |
|
needed to set performed actions Definition at line 79 of file ActHandler.h. Referenced by ActHandler(), and sendCommands(). |