#include <MessageQueueBase.h>
Public Member Functions | |
MessageQueueBase () | |
Constructor. | |
~MessageQueueBase () | |
Destructor. | |
void | setSize (int size) |
Sets the size of the queue. | |
void | clear () |
Removes all messages from the queue. | |
int | getNumberOfMessages () const |
Returns the number of the messages in the queue. | |
virtual void | write (const void *p, int size) |
The function adds a number of bytes to the last message in the queue. | |
void | finishMessage (MessageID id, unsigned long timeStamp, Player::teamColor teamColor, Player::playerNumber playerNumber, bool messageWasSentFromAPhysicalRobot=true) |
Finishes the last message in the queue. | |
bool | eof () const |
Returns if the the currently selected message for reading was read completely. | |
void | read (void *p, int size) |
Reads a number of bytes from the currently selected message for reading. | |
const char * | getData () const |
Gives the MessageQueue direct read access to the selected message for reading. | |
MessageID | getMessageID () const |
Returns the message id of the currently selected message for reading. | |
unsigned long | getTimeStamp (int message) |
Returns the time stamp of a message. | |
unsigned long | getTimeStamp () const |
Returns the time stamp of the currently selected message for reading. | |
int | getMessageSize () const |
Returns the message size of the currently selected message for reading. | |
Player::teamColor | getTeamColor () const |
returns the team color of the robot that sent the currently selected message for reading. | |
Player::playerNumber | getPlayerNumber () const |
returns the player number of the robot that sent the currently selected message for reading. | |
bool | getMessageWasSentFromAPhysicalRobot () const |
returns whether the currently selected message for reading was sent from a physical robot | |
void | resetReadPosition () |
Returns the read position of the currently selected message for reading so that the message can be read again. | |
void | setSelectedMessageForReading (int message) |
void | removeRepetitions () |
Deletes all older messages from the queue if a newer message of same type is already in the queue. | |
Private Attributes | |
char * | buf |
the buffer on that the queue works | |
int | selectedMessageForReadingPosition |
the position of the message that is selected for reading | |
int | numOfMessages |
the number of stored messages | |
int | queueSize |
the queue size | |
int | nextMessagePosition |
the position where the next message starts (in bytes) | |
int | nextMessageSize |
the current size of the next message | |
bool | writingOfLastMessageFailed |
If true, then the writing of the last message failed because there was not enough space. | |
int | readPosition |
The position up to where a message is already read. |
This version works on a static memory buffer to avoid often memory allocations on the Aperios platform.
Use setSize(int size) to set the total size of data the queue can store. If a message doesn't fit into the queue, it is ignored.
Definition at line 27 of file MessageQueueBase.h.
|
Constructor.
Definition at line 17 of file MessageQueueBase.cpp. References clear(). |
Here is the call graph for this function:
|
Destructor.
Definition at line 23 of file MessageQueueBase.cpp. |
|
Sets the size of the queue. Ignored on the Win32 platform.
Definition at line 28 of file MessageQueueBase.cpp. References ASSERT, and queueSize. Referenced by MessageQueue::setSize(). |
|
Removes all messages from the queue.
Definition at line 36 of file MessageQueueBase.cpp. References nextMessagePosition, nextMessageSize, numOfMessages, readPosition, selectedMessageForReadingPosition, and writingOfLastMessageFailed. Referenced by MessageQueue::clear(), and MessageQueueBase(). |
|
Returns the number of the messages in the queue.
Definition at line 46 of file MessageQueueBase.cpp. References numOfMessages. Referenced by MessageQueue::copyAllMessages(), LogPlayer::getNumberOfMessages(), MessageQueue::getStreamedSize(), MessageQueue::handleAllMessages(), MessageQueue::handleSpecificMessages(), MessageQueue::isEmpty(), and operator<<(). |
|
The function adds a number of bytes to the last message in the queue.
Definition at line 51 of file MessageQueueBase.cpp. References nextMessagePosition, nextMessageSize, queueSize, and writingOfLastMessageFailed. Referenced by OutMessageQueue::writeToStream(). |
|
Finishes the last message in the queue. The number of messages becomes increased and a new message can be started.
Definition at line 64 of file MessageQueueBase.cpp. References ASSERT, nextMessagePosition, nextMessageSize, numOfMessages, and writingOfLastMessageFailed. Referenced by OutMessage::finishMessage(). |
|
Returns if the the currently selected message for reading was read completely.
Definition at line 240 of file MessageQueueBase.cpp. References getMessageSize(), and readPosition. Referenced by InMessageQueue::getEof(). |
Here is the call graph for this function:
|
Reads a number of bytes from the currently selected message for reading.
Definition at line 173 of file MessageQueueBase.cpp. References ASSERT, getMessageSize(), readPosition, and selectedMessageForReadingPosition. Referenced by InMessageQueue::readFromStream(). |
Here is the call graph for this function:
|
Gives the MessageQueue direct read access to the selected message for reading.
Definition at line 180 of file MessageQueueBase.cpp. References selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), InMessage::getData(), and removeRepetitions(). |
|
Returns the message id of the currently selected message for reading.
Definition at line 211 of file MessageQueueBase.cpp. References MessageID, and selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), LogPlayer::getCurrentMessageID(), InMessage::getMessageID(), and removeRepetitions(). |
|
Returns the time stamp of a message.
Definition at line 205 of file MessageQueueBase.cpp. References getTimeStamp(), and setSelectedMessageForReading(). Referenced by MessageQueue::copyMessage(), LogPlayer::getTimeStamp(), and InMessage::getTimeStamp(). |
Here is the call graph for this function:
|
Returns the time stamp of the currently selected message for reading.
Definition at line 198 of file MessageQueueBase.cpp. References selectedMessageForReadingPosition. Referenced by getTimeStamp(). |
|
Returns the message size of the currently selected message for reading.
Definition at line 185 of file MessageQueueBase.cpp. References selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), eof(), InMessage::getMessageSize(), read(), removeRepetitions(), and setSelectedMessageForReading(). |
|
returns the team color of the robot that sent the currently selected message for reading.
Definition at line 218 of file MessageQueueBase.cpp. References selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), InMessage::getRobotNumber(), and InMessage::getTeamColor(). |
|
returns the player number of the robot that sent the currently selected message for reading.
Definition at line 225 of file MessageQueueBase.cpp. References selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), InMessage::getPlayerNumber(), and InMessage::getRobotNumber(). |
|
returns whether the currently selected message for reading was sent from a physical robot
Definition at line 232 of file MessageQueueBase.cpp. References selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), and InMessage::getMessageWasSentFromAPhysicalRobot(). |
|
Returns the read position of the currently selected message for reading so that the message can be read again.
Definition at line 193 of file MessageQueueBase.cpp. References readPosition. Referenced by InMessage::resetReadPosition(). |
|
Definition at line 160 of file MessageQueueBase.cpp. References ASSERT, getMessageSize(), numOfMessages, readPosition, and selectedMessageForReadingPosition. Referenced by MessageQueue::copyMessage(), MessageQueue::getStreamedSize(), getTimeStamp(), MessageQueue::handleAllMessages(), MessageQueue::handleSpecificMessages(), LogPlayer::saveAMV(), LogPlayer::saveCSV(), and LogPlayer::saveImages(). |
Here is the call graph for this function:
|
Deletes all older messages from the queue if a newer message of same type is already in the queue. This method should not be called during message handling. Definition at line 84 of file MessageQueueBase.cpp. References getData(), getMessageID(), getMessageSize(), idDebugDrawing2, idDebugDrawingFinished, idStopwatch, idText, nextMessagePosition, numOfMessageIDs, numOfMessages, readPosition, selectedMessageForReadingPosition, and Drawings::TypeOfDrawing. Referenced by MessageQueue::removeRepetitions(). |
Here is the call graph for this function:
|
the buffer on that the queue works
Definition at line 130 of file MessageQueueBase.h. |
|
the position of the message that is selected for reading
Definition at line 133 of file MessageQueueBase.h. Referenced by clear(), getData(), getMessageID(), getMessageSize(), getMessageWasSentFromAPhysicalRobot(), getPlayerNumber(), getTeamColor(), getTimeStamp(), read(), removeRepetitions(), and setSelectedMessageForReading(). |
|
the number of stored messages
Definition at line 136 of file MessageQueueBase.h. Referenced by clear(), finishMessage(), getNumberOfMessages(), removeRepetitions(), and setSelectedMessageForReading(). |
|
the queue size
Definition at line 139 of file MessageQueueBase.h. |
|
the position where the next message starts (in bytes)
Definition at line 142 of file MessageQueueBase.h. Referenced by clear(), finishMessage(), removeRepetitions(), and write(). |
|
the current size of the next message
Definition at line 145 of file MessageQueueBase.h. Referenced by clear(), finishMessage(), and write(). |
|
If true, then the writing of the last message failed because there was not enough space.
Definition at line 148 of file MessageQueueBase.h. Referenced by clear(), finishMessage(), and write(). |
|
The position up to where a message is already read.
Definition at line 151 of file MessageQueueBase.h. Referenced by clear(), eof(), read(), removeRepetitions(), resetReadPosition(), and setSelectedMessageForReading(). |