#include <OSGBinaryMessage.h>
Inheritance diagram for osg::BinaryMessage:


Public Types | |
| typedef std::vector< UInt8 > | BufferType |
Public Methods | |
Constructors | |
| BinaryMessage (void) | |
| BinaryMessage (const BinaryMessage &source) | |
| Copy constructor. | |
Destructor | |
| virtual | ~BinaryMessage (void) |
| Destructor. | |
Get | |
| virtual UInt32 | getSize (void) |
| Get message size. | |
| virtual MemoryHandle | getBuffer (void) |
| Get buffer address. | |
Misc | |
| virtual void | setSize (UInt32 size) |
| Set message size. | |
| void | clear (void) |
| Clear message buffer. | |
| void | reset (void) |
| Reset buffer for reading. | |
write message | |
| void | putUInt32 (const UInt32 value) |
| void | putInt32 (const Int32 value) |
| void | putUInt16 (const UInt16 value) |
| void | putInt16 (const Int16 value) |
| void | putUInt8 (const UInt8 value) |
| void | putInt8 (const Int8 value) |
| void | putString (const string &value) |
| void | putReal32 (const Real32 value) |
read message | |
| void | getUInt32 (UInt32 &value) |
| void | getInt32 (Int32 &value) |
| void | getUInt16 (UInt16 &value) |
| void | getInt16 (Int16 &value) |
| void | getUInt8 (UInt8 &value) |
| void | getInt8 (Int8 &value) |
| void | getString (string &value) |
| void | getReal32 (Real32 &value) |
| UInt32 | getUInt32 (void) |
| Int32 | getInt32 (void) |
| UInt16 | getUInt16 (void) |
| Int16 | getInt16 (void) |
| UInt8 | getUInt8 (void) |
| Int8 | getInt8 (void) |
| string | getString (void) |
| Real32 | getReal32 (void) |
Assignment | |
| BinaryMessage & | operator= (const BinaryMessage &source) |
Protected Attributes | |
Member | |
| BufferType | _buffer |
| UInt32 | _pos |
Private Types | |
| typedef NetworkMessage | Inherited |
Example:
// send
BinSockMessage msg;
msg.clear(); // if not already empty
msg.putUInt32(220);
msg.putInt32 (221);
msg.putUInt16(222);
msg.putInt16 (223);
msg.putUInt8 (224);
msg.putInt8 (225);
msg.putReal32(226.0);
msg.putString("227");
socket.send(msg);
// receive
string str;
socket.recv(msg);
str = msg.getString();
msg.getString(str); // avoid one copy
|
|
|
|
|
|
|
|
Constructor |
|
|
Copy constructor.
|
|
|
Destructor.
|
|
|
Get message size.
Implements osg::NetworkMessage. |
|
|
Get buffer address.
Implements osg::NetworkMessage. |
|
|
Set message size. Set message size. This is called by the socket to get enough space to read a message.
Implements osg::NetworkMessage. |
|
|
Clear message buffer.
|
|
|
Reset buffer for reading. Reset readpointer to the beginn of the buffer |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assignment |
|
|
|
|
|
|
1.2.16