#include <message.h>
Public Methods | |
Message (ost::TCPStream *stream) | |
Construnct a message from the stream. | |
Message (unsigned long int _organismId, bool _petition, MessageType _type, unsigned long int _size, const char *_msg) | |
Construct a message with the specified parameters. | |
~Message () | |
Destroy a message. If the msg pointer is not null, it's deleted. | |
const void | sendTo (ost::TCPStream *stream) |
Sends the message thought the stream. | |
string | toString () |
Converts the message to a string. | |
Public Attributes | |
unsigned long int | organismId |
bool | petition |
MessageType | type |
unsigned long int | size |
char * | msg |
The message coded in a char *. | |
unsigned char * | umsg |
The messahe coded in a unsigned char *. |
Definition at line 52 of file message.h.
|
Construnct a message from the stream. Create a message from a stream, the data is copied, and deleted when the message is deleted, so make your own copy! Definition at line 52 of file message.cc. References MessageType, msg, organismId, petition, size, and type. |
|
Construct a message with the specified parameters. Create a Message. Be carfull as the msg pointer is memcopied, it's slower but safer. Definition at line 32 of file message.cc. References MessageType, msg, organismId, petition, size, and type. |
|
Destroy a message. If the msg pointer is not null, it's deleted. Destroys the message. Just delete the msg pointer if it points to any data Definition at line 92 of file message.cc. References msg. |
|
Sends the message thought the stream. Sends the message thought the stream Definition at line 112 of file message.cc. References msg, organismId, petition, size, and type. Referenced by Client::clientLog(), Client::dropCylinder(), Client::endOfTurn(), Client::grow(), Client::move(), Client::newCylinder(), Client::sendEnergy(), and Client::sendMessage(). |
|
Converts the message to a string. Convert the message to a printable string Definition at line 101 of file message.cc. References organismId, petition, size, and type. |
|
The message coded in a char *.
Definition at line 65 of file message.h. Referenced by Client::clientLog(), Client::dropCylinder(), Message(), Client::move(), Client::newCylinder(), Client::sendMessage(), sendTo(), and ~Message(). |
|
The organism that send the message. 32 bits Definition at line 55 of file message.h. Referenced by Client::dropCylinder(), Client::grow(), Message(), Client::move(), Client::newCylinder(), Client::sendEnergy(), Client::sendMessage(), sendTo(), and toString(). |
|
If it's a petition or a response. 1 bit Definition at line 57 of file message.h. Referenced by Client::clientLog(), Client::dropCylinder(), Client::endOfTurn(), Client::grow(), Message(), Client::move(), Client::newCylinder(), Client::sendEnergy(), Client::sendMessage(), sendTo(), and toString(). |
|
size of the message. 32 bits. Definition at line 61 of file message.h. Referenced by Client::clientLog(), Client::dropCylinder(), Client::grow(), Message(), Client::move(), Client::newCylinder(), Client::sendEnergy(), Client::sendMessage(), sendTo(), and toString(). |
|
The message type. 15 bits Definition at line 59 of file message.h. Referenced by Message(), Client::Run(), sendTo(), and toString(). |
|
The messahe coded in a unsigned char *.
Definition at line 67 of file message.h. Referenced by Client::dropCylinder(), Client::grow(), Client::move(), Client::newCylinder(), Client::sendEnergy(), and Client::sendMessage(). |