Public Member Functions
|cRingBufferLinear (int Size, int Margin=0, bool Statistics=false, const char *Description=NULL)|
|virtual int||Available (void)|
|virtual int||Free (void)|
|virtual void||Clear (void)|
|Immediately clears the ring buffer. |
|int||Read (int FileHandle, int Max=0)|
|int||Put (const uchar *Data, int Count)|
|uchar *||Get (int &Count)|
|void||Del (int Count)|
Protected Member Functions
|virtual int||DataReady (const uchar *Data, int Count)|
|int|| Margin =
|bool|| Statistics =
|const char *|| Description = |
Creates a linear ring buffer. The buffer will be able to hold at most Size-Margin-1 bytes of data, and will be guaranteed to return at least Margin bytes in one consecutive block. The optional Description is used for debugging only.
|int cRingBufferLinear::DataReady||(||const uchar *||Data,|
By default a ring buffer has data ready as soon as there are at least 'margin' bytes available. A derived class can reimplement this function if it has other conditions that define when data is ready. The return value is either 0 if there is not yet enough data available, or the number of bytes from the beginning of Data that are "ready".
Referenced by Get().
|virtual int cRingBufferLinear::Free||(||void||)||
|int|| Max = |
Reads at most Max bytes from FileHandle and stores them in the ring buffer. If Max is 0, reads as many bytes as possible. Only one actual read() call is done.
Referenced by cTSBuffer::Action().
|int cRingBufferLinear::Put||(||const uchar *||Data,|
Puts at most Count bytes of Data into the ring buffer.
Referenced by cRecorder::Receive().
|uchar * cRingBufferLinear::Get||(||int &||Count||)|
Gets data from the ring buffer. The data will remain in the buffer until a call to Del() deletes it.
Deletes at most Count bytes from the ring buffer. Count must be less or equal to the number that was returned by a previous call to Get().