Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

NetworkBuffer Class Reference

#include <NetworkBuffer.h>


Detailed Description

This is used to incrementally build up a buffer to be sent over the network , so that only one call to the socket write function needs to be made.

Definition at line 7 of file NetworkBuffer.h.

List of all members.

Public Member Functions

 NetworkBuffer ()
 constructor
virtual ~NetworkBuffer ()
 destructor
template<class T >
bool addItem (T item)
 Template for adding a single item to the buffer, such as a struct or an int.
bool addBuffer (byte *src, int size)
 Template for adding a buffer such with a size to the network buffer.
int getSize ()
 Returns the current size of the buffer.
const bytegetBytes ()
 Returns a const pointer to the buffer, for debugging networking code.
bool send (Socket *sck)
 Sends the buffer over the given socket.

Protected Attributes

bytebuf
 the buffer being built
size_t offset
 current position in buf
size_t bufSize
 size of memory region at buf

Private Member Functions

 NetworkBuffer (NetworkBuffer &)
 do not call
NetworkBufferoperator= (const NetworkBuffer &)
 do not call

Constructor & Destructor Documentation

NetworkBuffer::NetworkBuffer (  ) 

constructor

Definition at line 11 of file NetworkBuffer.h.

virtual NetworkBuffer::~NetworkBuffer (  )  [virtual]

destructor

Definition at line 16 of file NetworkBuffer.h.

NetworkBuffer::NetworkBuffer ( NetworkBuffer  )  [private]

do not call


Member Function Documentation

bool NetworkBuffer::addBuffer ( byte src,
int  size 
)

Template for adding a buffer such with a size to the network buffer.

Definition at line 31 of file NetworkBuffer.h.

Referenced by EventProxy::processEvent(), and EventProxy::sendState().

template<class T >
bool NetworkBuffer::addItem ( item  ) 

Template for adding a single item to the buffer, such as a struct or an int.

Definition at line 21 of file NetworkBuffer.h.

Referenced by addBuffer(), EventProxy::processEvent(), RemoteRouter::sendRemoteRequest(), and EventProxy::sendState().

const byte* NetworkBuffer::getBytes (  ) 

Returns a const pointer to the buffer, for debugging networking code.

Definition at line 44 of file NetworkBuffer.h.

int NetworkBuffer::getSize (  ) 

Returns the current size of the buffer.

Definition at line 41 of file NetworkBuffer.h.

NetworkBuffer& NetworkBuffer::operator= ( const NetworkBuffer  )  [private]

do not call

bool NetworkBuffer::send ( Socket sck  ) 

Sends the buffer over the given socket.

Definition at line 47 of file NetworkBuffer.h.

Referenced by EventProxy::processEvent(), RemoteRouter::sendRemoteRequest(), and EventProxy::sendState().


Member Data Documentation

byte* NetworkBuffer::buf [protected]

the buffer being built

Definition at line 57 of file NetworkBuffer.h.

Referenced by addBuffer(), addItem(), getBytes(), NetworkBuffer(), send(), and ~NetworkBuffer().

size_t NetworkBuffer::bufSize [protected]

size of memory region at buf

Definition at line 59 of file NetworkBuffer.h.

Referenced by addBuffer(), addItem(), and NetworkBuffer().

size_t NetworkBuffer::offset [protected]

current position in buf

Definition at line 58 of file NetworkBuffer.h.

Referenced by addBuffer(), addItem(), getSize(), and send().


The documentation for this class was generated from the following file:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:13 2016 by Doxygen 1.6.3