YANE-Framework 1.1.0
Public Member Functions | Protected Member Functions | Protected Attributes

yane::Utils::FIFOBuffer Class Reference

Class generating a First-In-First-Out buffer to manage data.

List of all members.

Public Member Functions

void clear ()
 Function to clear the buffer.
void discard (int size)
 Function to delete data from the beginning of the buffer.
 FIFOBuffer (int maxsize)
 Constructor.
void lock ()
 Function to lock the FIFOBuffer object.
void peek (void *dest, int size)
 Function to peek data within the buffer.
void peek (void *dest, int position, int size)
 Function to peek data within the buffer.
void pop (void *dest, int size)
 Function to return data from the beginning of the buffer and delete it.
void push (void *src, int size)
 Function to add data to the buffer.
int size ()
 Function to return the current size of the data stored in the buffer.
void unlock ()
 Function to unlcok the FIFOBuffer object.
 ~FIFOBuffer ()
 Destructor.

Protected Member Functions

int end (int size)
 Inline Function to return the index of the last element of the buffer if new data is added to buffer.

Protected Attributes

char * _buffer
 Name of the buffer.
pthread_mutex_t _locker
 Auxilliary variable to lock the FIFOBuffer object.
int _maxsize
 Maximal size of the buffer.
int _size
 Current size of the buffer.
int _start
 Index of the current start of the buffer.

Constructor & Destructor Documentation

LIB_EXPORT yane::Utils::FIFOBuffer::FIFOBuffer ( int  maxsize)

Constructor

Parameters:
maxsizeMaximal size of the buffer

Member Function Documentation

LIB_EXPORT void yane::Utils::FIFOBuffer::discard ( int  size)

Function to delete data from the beginning of the buffer

Parameters:
sizeSize of the data packet to be deleted from the buffer
LIB_EXPORT int yane::Utils::FIFOBuffer::end ( int  size) [protected]

Inline Function to return the index of the last element of the buffer if new data is added to buffer

Parameters:
sizeSize of data to be added
LIB_EXPORT void yane::Utils::FIFOBuffer::peek ( void *  dest,
int  size 
)

Function to peek data within the buffer

Parameters:
destVariable to which the buffer data shall be copied to
sizeSize of the data packet to be copied
LIB_EXPORT void yane::Utils::FIFOBuffer::peek ( void *  dest,
int  position,
int  size 
)

Function to peek data within the buffer

Parameters:
destVariable to which the buffer data shall be copied to
positionStarting position upon which the buffer data shall be copied
sizeSize of the data packet to be copied
LIB_EXPORT void yane::Utils::FIFOBuffer::pop ( void *  dest,
int  size 
)

Function to return data from the beginning of the buffer and delete it

Parameters:
destVariable to which the buffer data shall be copied to
sizeSize of the data packet to be copied and deleted from the buffer
LIB_EXPORT void yane::Utils::FIFOBuffer::push ( void *  src,
int  size 
)

Function to add data to the buffer

Parameters:
srcData to be added to the buffer
sizeSize of the data to be added