[Nutshell-devel] Basic class information : Byte Buffer.
Status: Planning
Brought to you by:
alexandream
From: Alexandre M. <ale...@gm...> - 2006-08-24 18:15:40
|
Keeping the batch of messages related to the class of the system. A ByteBuffer is a buffer used by the network pieces of our system, to keep track of incoming data until it can safely extract a message out of it. Here is its basic definition (somethings may vary as I already have an implemented version of this class at home, with no access to it right now). The ByteBuffer is a circular buffer, that can hold up to size bytes, wrapping around when needed, if possible. This is useful to hold received data and yet-to-send data. Heavily used by our sockets. ByteBuffer public: ByteBuffer(int size); virtual ~ByteBuffer(); insert(const ByteArray& source, int size); fetch(ByteArray& dest, int size); discard(int size); consume(ByteArray& dest, int size); // this is simply a fetch(); discard(); int getSize(); int getCapacity(); private: char* data; int size; int position; And there goes another piece of our class strucutre... a lecture brought to you by Yago Warner! Until I find out I missed something again, I'll rest.. .and work a bit more. Regards, Alexandre Moreira. |