#include <message.h>
Public Member Functions | |
| Message () | |
| Constructor. | |
| Message (const Message &message) | |
| copy constructor | |
| virtual | ~Message () |
| Destructor. | |
| Message & | operator= (const Message &message) |
| overloaded assignment | |
| void | enlargeBuffer (unsigned int additional_bytes) |
| enlarges a buffer | |
| void | setBufferSize (unsigned int size) |
| sets the buffer size | |
| void | setMessageSize (unsigned int size) |
| set the message size | |
| void | setSenderAddress (std::string address) |
| sets the message's sender address | |
| void | setSenderPort (unsigned short port) |
| sets the message's sender port | |
| char * | getBufferPointer () |
| returns a pointer to the internal buffer | |
| unsigned int | getBufferSize () |
| unsigned int | getMessageSize () |
| std::string & | getSenderAddress () |
| unsigned short | getSenderPort () |
| void | insert (const void *data, unsigned int data_size) |
| inserts the given data of the given length | |
| void | append (const void *data, unsigned int data_size) |
| appends the given data | |
Protected Attributes | |
| char * | buffer_ |
| buffer for holding the message | |
| unsigned int | buffer_size_ |
| holds the buffers size | |
| unsigned int | message_size_ |
| holds the messages size. can be <= buffer_size | |
| std::string | sender_address_ |
| holds the adress of the sender if this is a received message | |
| unsigned short | sender_port_ |
| holds the port of the sender if this is a received message | |
|
|
Constructor. initializes members |
|
|
copy constructor copies a message to another. if the buffer of the destination message is allocated it will get destroyed |
|
|
Destructor. destroys the buffer of the message if allocated ( buffer_size > 0 ) |
|
||||||||||||
|
appends the given data this method will resize the buffer so it can exactly fit the old message plus the new data and then appends the new data. the message size is set to old_message_size + data_size.
|
|
|
enlarges a buffer this will add additional_bytes to the buffer size and resize the buffer the content is preserved
|
|
|
returns a pointer to the internal buffer this method will return a pointer to the internal buffer, use this with care and only if you know what you do. use insert and append instead. |
|
|
returns the internal buffers size |
|
|
returns the messages size |
|
|
returns the senders ip adress if this is a received message |
|
|
returns the senders port adress if this is a received message |
|
||||||||||||
|
inserts the given data of the given length this method will clear the internal buffer, allocate data_size bytes and insert data_size bytes from the given data into the buffer. the message size is set to data_size
|
|
|
overloaded assignment copies the assigned message to the assignments l-value messge if the buffer of the l-value message is already allocated it gets destroyed |
|
|
sets the buffer size this will destroy an already existant buffer size, reset the message_size to 0 and allocate a new buffer with the given size
|
|
|
set the message size this will set the message size. if the size is bigger than the buffer_size it is clamped to the buffer_size. use this if you don't append or insert your data but are manipulating the buffer directly via the getBufferPointer method
|
|
|
sets the message's sender address used internally in BiDirectionalConnection::receive |
|
|
sets the message's sender port used internally in BiDirectionalConnection::receive |
1.4.5