commore  1.0.6-SNAPSHOT
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
commore::CommBuffer Class Reference

#include <CommBuffer.h>

Classes

class  Page
 
class  PageIterator
 
struct  Pos
 

Public Types

enum  { DEFAULT_PAGE_SIZE = 4096 }
 
typedef PagePPage
 

Public Member Functions

 CommBuffer (size_t page_size)
 
 CommBuffer (const CommBuffer &C)
 
CommBufferoperator= (const CommBuffer &C)
 
bool operator== (const CommBuffer &C) const
 
bool operator!= (const CommBuffer &C) const
 
void set_size (size_t size)
 
size_t size () const
 
void clear ()
 
bool is_ascii () const
 
void set_is_ascii (bool is_ascii)
 
void update_ascii_flags ()
 
void update_headers ()
 
Byteallocate (size_t &size)
 
Byteallocate_in_new_page (size_t size, bool reserveHeader)
 
size_t add_size (size_t size)
 
void splice (CommBuffer &x)
 
void dump () const
 
void rewind ()
 
long write_byte (const Byte *b, size_t size)
 
long write_raw (const Byte *b, size_t size)
 
long read_byte (Byte *b, size_t size) const
 
long write_using_dictionary (const AString &v)
 
long write (const AString &v)
 
long write (const String &v)
 
long write (const StringBuffer &v)
 
long write (const Blob &v)
 
long write (const TimePeriod &v)
 
long write (const TimeDate &v)
 
long write (const Symbol &v)
 
long write (const Tuple &v)
 
long write (const Bool &v)
 
long write (const Int &v)
 
long write (const UInt &v)
 
long write (const long &v)
 
long write (const unsigned long &v)
 
long write (const Long &v)
 
long write (const ULong &v)
 
long write (const Short &v)
 
long write (const UShort &v)
 
long write (const Float &v)
 
long write (const Double &v)
 
long write (const ArrayInt &v)
 
long write (const ArrayLong &v)
 
long write (const ArrayFloat &v)
 
long write (const ArrayDouble &v)
 
long write (const ListBool &v)
 
long write (const ListInt &v)
 
long write (const ListUInt &v)
 
long write (const ListLong &v)
 
long write (const ListULong &v)
 
long write (const ListShort &v)
 
long write (const ListUShort &v)
 
long write (const ListFloat &v)
 
long write (const ListDouble &v)
 
long write (const ListAString &v)
 
long write (const ListString &v)
 
long write (const ListStringBuffer &v)
 
long write (const ListTimePeriod &v)
 
long write (const ListTimeDate &v)
 
long write (const ListBlob &v)
 
long write (const ListSymbol &v)
 
long write (const ListTuple &v)
 
long write (const ListArrayInt &v)
 
long write (const ListArrayLong &v)
 
long write (const ListArrayFloat &v)
 
long write (const ListArrayDouble &v)
 
long read_using_dictionary (AString &v) const
 
long read (AString &v) const
 
long read (String &v) const
 
long read (StringBuffer &v) const
 
long read (Blob &v) const
 
long read (TimePeriod &v) const
 
long read (TimeDate &v) const
 
long read (Symbol &v) const
 
long read (Tuple &v) const
 
long read (Bool &v) const
 
long read (Int &v) const
 
long read (UInt &v) const
 
long read (long &v) const
 
long read (unsigned long &v) const
 
long read (Long &v) const
 
long read (ULong &v) const
 
long read (Short &v) const
 
long read (UShort &v) const
 
long read (Float &v) const
 
long read (Double &v) const
 
long read (ArrayInt &v) const
 
long read (ArrayLong &v) const
 
long read (ArrayFloat &v) const
 
long read (ArrayDouble &v) const
 
long read (ListBool &v) const
 
long read (ListInt &v) const
 
long read (ListUInt &v) const
 
long read (ListLong &v) const
 
long read (ListULong &v) const
 
long read (ListShort &v) const
 
long read (ListUShort &v) const
 
long read (ListFloat &v) const
 
long read (ListDouble &v) const
 
long read (ListAString &v) const
 
long read (ListString &v) const
 
long read (ListStringBuffer &v) const
 
long read (ListTimePeriod &v) const
 
long read (ListTimeDate &v) const
 
long read (ListBlob &v) const
 
long read (ListSymbol &v) const
 
long read (ListTuple &v) const
 
long read (ListArrayInt &v) const
 
long read (ListArrayLong &v) const
 
long read (ListArrayFloat &v) const
 
long read (ListArrayDouble &v) const
 
Pos get_pos () const
 
void set_pos (const Pos &pos)
 
long write (OBStream &o) const
 
long read (IBStream &o)
 
long write_file (const Path &file_name) const
 
long read_file (const Path &file_name)
 
AString to_string () const
 
PPage get_last ()
 

Friends

class PageIterator
 

Detailed Description

Commore internal use A CommBuffer is a structure used to serialize the Commore data types. The main operations are all the overoloaded read/write methods. different data types can be written in the Commbuffer one after another, and should later be read in the same order. The Tuple is one of the data types handled by the CommBuffer. A Tuple is a structure used to hold a set of named data and as such, it is the most convenient type for use with the CommBuffer. Indeed, a complex structure stored in a Tuple can be serialized with one write call, and deserialized with one read call.

Compression and encryption should be handled by this class.

Member Function Documentation

size_t commore::CommBuffer::add_size ( size_t  size)

Add size to last buffer page size return new CommBuffer size

Byte* commore::CommBuffer::allocate ( size_t &  size)

Return pointer on free space of last buffer page. If last page is full it allocate a new page. size return the free space sise

Byte* commore::CommBuffer::allocate_in_new_page ( size_t  size,
bool  reserveHeader 
)

Return pointer on free space of last buffer page. it always allocate a new page.

void commore::CommBuffer::dump ( ) const

Dump buffer content to log stream

void commore::CommBuffer::rewind ( )

Reset reader pos of Buffer

void commore::CommBuffer::splice ( CommBuffer x)

Move Buffer content from x to this x become empty!

long commore::CommBuffer::write_byte ( const Byte b,
size_t  size 
)

Write en read raw Byte in the buffer


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