EpcTools
An event based multi-threaded C++ development framework.
|
Go to the documentation of this file.
18 #ifndef __ecbuf_h_included
19 #define __ecbuf_h_included
36 DECLARE_ERROR(ECircularBufferError_BufferSizeHasBeenExceeded);
38 DECLARE_ERROR(ECircularBufferError_AttemptToModifyDataOutsideBoundsOfCurrentBuffer);
62 Int
used() {
return m_used; }
64 Int
free() {
return m_capacity - m_used; }
73 Int
peekData(pUChar dest, Int offset, Int length)
75 return readData(dest, offset, length,
true);
82 Int
readData(pUChar dest, Int offset, Int length)
84 return readData(dest, offset, length,
false);
96 void writeData(pUChar src, Int offset, Int length, Bool nolock=
False);
110 void modifyData(pUChar src, Int offset, Int length, Bool nolock=
False);
117 Int
readData(pUChar dest, Int offset, Int length, Bool peek);
130 #endif // #define __ecbuf_h_included
~ECircularBuffer()
Class destructor.
Definition: ecbuf.cpp:28
#define DECLARE_ERROR(__e__)
Declares exception class derived from EError with no constructor parameters.
Definition: eerror.h:53
Defines base class for exceptions and declaration helper macros.
void writeData(pUChar src, Int offset, Int length, Bool nolock=False)
Writes data to the circular buffer.
Definition: ecbuf.cpp:102
EMutexPrivate & getMutex()
Retrieves the mutex;.
Definition: ecbuf.h:114
Macros for various standard C library functions and standard includes.
A private mutex (the mutex data is allocated from either the heap or stack).
Definition: esynch.h:175
Bool isEmpty()
True - the buffer is empty, False - there is data in the buffer.
Definition: ecbuf.h:58
Contains definitions for synchronization objects.
Void initialize()
Initializes the circular buffer.
Definition: ecbuf.cpp:37
Int free()
Returns the number of bytes that are free in the buffer.
Definition: ecbuf.h:64
#define False
False.
Definition: ebase.h:27
Int used()
Returns the number of bytes in use in the buffer.
Definition: ecbuf.h:62
Implements a circular buffer.
Definition: ecbuf.h:45
Int capacity()
Returns the maximum capacity of the circular buffer.
Definition: ecbuf.h:60
void modifyData(pUChar src, Int offset, Int length, Bool nolock=False)
Modifies data within the buffer.
Definition: ecbuf.cpp:135
Int readData(pUChar dest, Int offset, Int length)
Reads and removes data from the buffer.
Definition: ecbuf.h:82
Int peekData(pUChar dest, Int offset, Int length)
Reads data from the buffer without removing it from the buffer.
Definition: ecbuf.h:73