Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

NetworkBuffer Class Reference

#include <NetworkBuffer.h>

List of all members.


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.


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.
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 (  )  [inline]

constructor

Definition at line 11 of file NetworkBuffer.h.

virtual NetworkBuffer::~NetworkBuffer (  )  [inline, virtual]

destructor

Definition at line 16 of file NetworkBuffer.h.

NetworkBuffer::NetworkBuffer ( NetworkBuffer  )  [private]

do not call


Member Function Documentation

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

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().

bool NetworkBuffer::addBuffer ( byte src,
int  size 
) [inline]

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().

int NetworkBuffer::getSize (  )  [inline]

Returns the current size of the buffer.

Definition at line 41 of file NetworkBuffer.h.

bool NetworkBuffer::send ( Socket sck  )  [inline]

Sends the buffer over the given socket.

Definition at line 46 of file NetworkBuffer.h.

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

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

do not call


Member Data Documentation

byte* NetworkBuffer::buf [protected]

the buffer being built

Definition at line 56 of file NetworkBuffer.h.

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

size_t NetworkBuffer::offset [protected]

current position in buf

Definition at line 57 of file NetworkBuffer.h.

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

size_t NetworkBuffer::bufSize [protected]

size of memory region at buf

Definition at line 58 of file NetworkBuffer.h.

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


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

Tekkotsu v4.0
Generated Thu Nov 22 00:58:34 2007 by Doxygen 1.5.4