rasdaman complete source
Public Member Functions | List of all members
akg::CommBuffer Class Reference

#include <akgnet_commbuffer.hh>

Public Member Functions

 CommBuffer () throw ()
 Default constructor, no data is allocated. More...
 
 CommBuffer (int size) throw ()
 
 CommBuffer (void *, int totalSize, int dataSize=0) throw ()
 
 ~CommBuffer () throw ()
 Destructor. If the internal buffer is allocated, it will be deallocated. More...
 
bool allocate (int size) throw ()
 
void freeBuffer () throw ()
 Frees the internal buffer, if allocated. More...
 
void takeOver (void *externalBuffer, int totalSize, int dataSize=0) throw ()
 
bool resize (int newSize) throw ()
 
void * getData () throw ()
 Returns a pointer to the internal buffer. You are on your own! More...
 
int getDataSize () throw ()
 Returns the size of the data stored in the buffer. More...
 
int getBufferSize () throw ()
 Returns the total capacity of the buffer. More...
 
int getSendedSize () throw ()
 Returns the size already written. More...
 
int getNotFilledSize () throw ()
 Returns the size not filled yet. More...
 
int getNotSendedSize () throw ()
 Returns the size not written yet. More...
 
bool isAllocated () throw ()
 Returns true if the internal buffer is allocated. More...
 
int read (FileDescriptor &) throw ()
 
int read (const void *externalBuffer, int size) throw ()
 
int reserve (int size) throw ()
 
int write (FileDescriptor &) throw ()
 
int write (void *externalBuffer, int size) throw ()
 
void clearToRead () throw ()
 Resets the buffer for reading. The data inside is discarded. More...
 
void clearToWrite () throw ()
 

Constructor & Destructor Documentation

akg::CommBuffer::CommBuffer ( )
throw (
)

Default constructor, no data is allocated.

akg::CommBuffer::CommBuffer ( int  size)
throw (
)

Constructor allocating a 'size' bytes buffer Assert: size > 0

akg::CommBuffer::CommBuffer ( void *  ,
int  totalSize,
int  dataSize = 0 
)
throw (
)

Constructor taking over an existing buffer totalSize - the total size of the buffer dataSize - the size of the usefull data

akg::CommBuffer::~CommBuffer ( )
throw (
)

Destructor. If the internal buffer is allocated, it will be deallocated.

Member Function Documentation

bool akg::CommBuffer::allocate ( int  size)
throw (
)

Allocates a new buffer. The old one, if allocated, will be deallocated Assert: size > 0

void akg::CommBuffer::clearToRead ( )
throw (
)

Resets the buffer for reading. The data inside is discarded.

void akg::CommBuffer::clearToWrite ( )
throw (
)

Resets the buffer for writing. The data inside is not touched, just the writing counters are reset

void akg::CommBuffer::freeBuffer ( )
throw (
)

Frees the internal buffer, if allocated.

int akg::CommBuffer::getBufferSize ( )
throw (
)

Returns the total capacity of the buffer.

void* akg::CommBuffer::getData ( )
throw (
)

Returns a pointer to the internal buffer. You are on your own!

int akg::CommBuffer::getDataSize ( )
throw (
)

Returns the size of the data stored in the buffer.

int akg::CommBuffer::getNotFilledSize ( )
throw (
)

Returns the size not filled yet.

int akg::CommBuffer::getNotSendedSize ( )
throw (
)

Returns the size not written yet.

int akg::CommBuffer::getSendedSize ( )
throw (
)

Returns the size already written.

bool akg::CommBuffer::isAllocated ( )
throw (
)

Returns true if the internal buffer is allocated.

int akg::CommBuffer::read ( FileDescriptor )
throw (
)

Reads as much as possible from the specified FileDescriptor It stops if the buffer is full or there are are no more bytes to read Returns the number of bytes red

int akg::CommBuffer::read ( const void *  externalBuffer,
int  size 
)
throw (
)

Reads at most 'size' bytes from the specified memory address It stops if the buffer is full or there are are no more bytes to read Returns the number of bytes red Assert: externalBuffer != 0, size >=0

int akg::CommBuffer::reserve ( int  size)
throw (
)

Fake read, used to reserve space for future direct write Returns the number of bytes reserverd, which can be less than 'size' if there is not enough space Assert: size >=0

bool akg::CommBuffer::resize ( int  newSize)
throw (
)

Resizes the internal buffer, by allocating and copying the data. Returns false if the new buffer is smaller than the actual data Assert: there is a buffer, so 'data != 0'

void akg::CommBuffer::takeOver ( void *  externalBuffer,
int  totalSize,
int  dataSize = 0 
)
throw (
)

Takes over an external buffer totalSize - the total size of the buffer dataSize - the size of the usefull data Assert: externalBuffer != 0, totalSize > 0, dataSize>=0, totalSize>=dataSize

int akg::CommBuffer::write ( FileDescriptor )
throw (
)

Write as much as possible to the specified FileDescriptor It stops if there are no more bytes to write or the FileDescriptor can't accept more bytes Returns the number of bytes written

int akg::CommBuffer::write ( void *  externalBuffer,
int  size 
)
throw (
)

Writes at most 'size' bytes to the specified memory address It stops if the there are no more bytes to write Returns the number of bytes written Assert: externalBuffer != 0, size >=0


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