NetMessage Class Reference
#include <NetMessage.h>
Public Member Functions | |
| NetMessage () | |
| NetMessage (NetMessage *src) | |
| virtual | ~NetMessage () |
| void | putUInt8 (uint8_t value) |
| void | putFirstUInt8 (uint8_t value) |
| void | putUInt16 (uint16_t value) |
| void | putFirstUInt16 (uint16_t value) |
| void | putUInt32 (uint32_t value) |
| void | putFirstUInt32 (uint32_t value) |
| void | putString (const std::string &value) |
| void | putUInt64 (uint64_t value) |
| void | putReal32 (float value) |
| void | putInt32 (int value) |
| void | putInt16 (short value) |
| uint8_t | getUInt8 () |
| uint16_t | getUInt16 () |
| uint32_t | getUInt32 () |
| std::string | getString () |
| uint64_t | getUInt64 () |
| float | getReal32 () |
| int | getInt32 () |
| short | getInt16 () |
| void | getUInt8 (uint8_t &dst) |
| void | getUInt32 (uint32_t &dst) |
| void | getString (std::string &dst) |
| void | getReal32 (float &dst) |
| void | appendMessage (NetMessage *src) |
| NetMessage * | detachMessage () |
| void | clear () |
| void | reset () |
| bool | finished () |
| uint8_t * | getBufferPointer () |
| unsigned | getBufferSize () |
| uint8_t * | allocateAtEnd (unsigned size) |
| uint8_t * | allocateAtFront (unsigned size) |
| bool | removeFromFront (unsigned nBytes) |
| unsigned | getReadPointerOffset () |
| OSG::ExtendedBinaryMessage * | toBinaryMessage () |
| void | dump (FILE *stream) |
Protected Member Functions | |
| void | allocInitial () |
| void | allocMore () |
Protected Attributes | |
| uint8_t * | mem |
| unsigned | memSize |
| uint8_t * | beginPlus |
| uint8_t * | beginMinus |
| int | freePlus |
| int | freeMinus |
| unsigned | nextPlus |
| unsigned | nextMinus |
| unsigned | readOffset |
Static Protected Attributes | |
| static const unsigned | APPENDED_MESSAGE = 0xFFFFFFFF |
Constructor & Destructor Documentation
| NetMessage::NetMessage | ( | ) |
| NetMessage::NetMessage | ( | NetMessage * | src | ) |
copy constructor (sets also the read pointer to the read pointer of src)
| NetMessage::~NetMessage | ( | ) | [virtual] |
Member Function Documentation
| uint8_t * NetMessage::allocateAtEnd | ( | unsigned | size | ) |
allocates an array of bytes at the end of the data set. This method is used in the network module in order to allow to recv() directly into the buffer.
- Parameters:
-
size specifies the size of the array
- Returns:
- returns a pointer pointing to the beginning of the array. The pointer is only valid before the next putXXX() call has occured.
| uint8_t * NetMessage::allocateAtFront | ( | unsigned | size | ) |
works as the method above
| void NetMessage::allocInitial | ( | ) | [protected] |
| void NetMessage::allocMore | ( | ) | [protected] |
| void NetMessage::appendMessage | ( | NetMessage * | src | ) |
appends a message to the data set (can only be read by invoking detachMessage())
- Parameters:
-
src message which should be appended. src can be modified afterwards
| void NetMessage::clear | ( | ) |
removes all data and resets the read pointer
| NetMessage * NetMessage::detachMessage | ( | ) |
reads a message which has been added previousely by appendMessage()
- Returns:
- pointer to message (must be delete'd manually)
| void NetMessage::dump | ( | FILE * | stream | ) |
| bool NetMessage::finished | ( | ) |
- Returns:
- returns true if the readpointer has reached the end of the data set
| uint8_t * NetMessage::getBufferPointer | ( | ) |
- Returns:
- returns a pointer to the beginning of a byte array containing the whole data set the value might (and will!) change whenever putXXX() or appendMessage() is called
| unsigned NetMessage::getBufferSize | ( | ) |
- Returns:
- returns the size of the data stream
| short NetMessage::getInt16 | ( | ) |
| int NetMessage::getInt32 | ( | ) |
| unsigned NetMessage::getReadPointerOffset | ( | ) |
- Returns:
- the current offset of the read pointer
| void NetMessage::getReal32 | ( | float & | dst | ) |
| float NetMessage::getReal32 | ( | ) |
| void NetMessage::getString | ( | std::string & | dst | ) |
| std::string NetMessage::getString | ( | ) |
| uint16_t NetMessage::getUInt16 | ( | ) |
| void NetMessage::getUInt32 | ( | uint32_t & | dst | ) |
| uint32_t NetMessage::getUInt32 | ( | ) |
| uint64_t NetMessage::getUInt64 | ( | ) |
| void NetMessage::getUInt8 | ( | uint8_t & | dst | ) |
| uint8_t NetMessage::getUInt8 | ( | ) |
methods for retrieving data from the network message. will increment the read pointer according to the size of the datatype for now, reading from beyond the buffer triggers an assert
| void NetMessage::putFirstUInt16 | ( | uint16_t | value | ) |
| void NetMessage::putFirstUInt32 | ( | uint32_t | value | ) |
| void NetMessage::putFirstUInt8 | ( | uint8_t | value | ) |
| void NetMessage::putInt16 | ( | short | value | ) |
| void NetMessage::putInt32 | ( | int | value | ) |
| void NetMessage::putReal32 | ( | float | value | ) |
| void NetMessage::putString | ( | const std::string & | value | ) |
| void NetMessage::putUInt16 | ( | uint16_t | value | ) |
| void NetMessage::putUInt32 | ( | uint32_t | value | ) |
| void NetMessage::putUInt64 | ( | uint64_t | value | ) |
| void NetMessage::putUInt8 | ( | uint8_t | value | ) |
methods for appending/prepending data to the network message: the readpointer will skip data added by putFirstXXX() unless it is still at the beginnig (or reset() has been invoked)!!!
| bool NetMessage::removeFromFront | ( | unsigned | nBytes | ) |
removes nBytes from the front of the data set works only if readpointer is set to zero
- Returns:
- returns true on success
| void NetMessage::reset | ( | ) |
resets the read pointer
| OSG::ExtendedBinaryMessage * NetMessage::toBinaryMessage | ( | ) |
only for testing / during transition to new network implementation
Member Data Documentation
const unsigned NetMessage::APPENDED_MESSAGE = 0xFFFFFFFF [static, protected] |
uint8_t* NetMessage::beginMinus [protected] |
uint8_t* NetMessage::beginPlus [protected] |
int NetMessage::freeMinus [protected] |
int NetMessage::freePlus [protected] |
uint8_t* NetMessage::mem [protected] |
unsigned NetMessage::memSize [protected] |
unsigned NetMessage::nextMinus [protected] |
unsigned NetMessage::nextPlus [protected] |
unsigned NetMessage::readOffset [protected] |
The documentation for this class was generated from the following files:
- src/inVRs/SystemCore/NetMessage.h
- src/inVRs/SystemCore/NetMessage.cpp
Generated on Wed Oct 20 16:11:58 2010 for inVRs by
1.5.8