#include <message.h>
Inheritance diagram for Dv::Net::SimpleMessage:
Public Member Functions | |
SimpleMessage (const char *data=0, size_t size=0) | |
Constructor. | |
virtual | ~SimpleMessage () |
Destructor. | |
const char * | data () const |
const size_t | size () const |
std::ostream & | send (std::ostream &os) const |
Send data byte-array. | |
std::istream & | receive (std::istream &is) throw (std::runtime_error) |
Receive data byte-array sent by SimpleMessage::send. | |
Protected Member Functions | |
const char * | data (const char *p, size_t size) |
Replace underlying byte array. | |
char * | data (size_t size) |
Replace byte array by a newly allocated array of size bytes. | |
Private Attributes | |
const char * | data_ |
size_t | size_ |
bool | owner_ |
A SimpleMessage can be sent to a stream and it can received from a stream. The protocol ensures that any byte array can be transferred.
Definition at line 18 of file message.h.
|
Constructor.
|
|
Destructor. Delete the data if we are the owner. Definition at line 32 of file message.h. |
|
References data_. Referenced by Dv::Net::Message< std::string >::Message(), Dv::Net::Message< T >::Message(), Dv::Net::Message< std::string >::operator std::string(), and Dv::Net::Message< T >::operator T(). |
|
References size_. Referenced by Dv::Net::Message< std::string >::operator std::string(), and Dv::Net::Message< T >::operator T(). |
|
Send data byte-array. The following protocol is used: size-of-encoded-byte-array <newline> encoded-byte-array
Referenced by operator<<(). |
|
Receive data byte-array sent by SimpleMessage::send.
|
|
Replace underlying byte array.
|
|
Replace byte array by a newly allocated array of size bytes. Note that the returned pointer is not const, so the derived class can update the byte array.
|
|
Definition at line 85 of file message.h. Referenced by data(), SimpleMessage(), and ~SimpleMessage(). |
|
Definition at line 86 of file message.h. Referenced by SimpleMessage(), and size(). |
|
Definition at line 87 of file message.h. Referenced by SimpleMessage(), and ~SimpleMessage(). |
dvnet-0.9.11 | [27 December, 2004] |