Download Source Code

CFifoSync Class Reference

Implements a first in first out synchronized buffer. More...

#include <FifoSync.h>

Inheritance diagram for CFifoSync:

Inheritance graph
[legend]
Collaboration diagram for CFifoSync:

Collaboration graph
[legend]
List of all members.

Public Member Functions

BOOL SkipBlock ()
 Skips the next data block in the buffer.
BOOL EndFifoWrite ()
 Advances head fifo head pointer, i.e. commits write.
BOOL InitFifoWrite ()
 Ensures space for a fifo write.
BOOL AddFifo (void const *pBuf, DWORD dwSize, DWORD dwEncode=0)
 Adds a data block to the fifo.
BOOL AllocateBuffers ()
 Allocates buffers for fifo.
 CFifoSync ()
 Constructor.
virtual ~CFifoSync ()
 Destructor.
virtual BOOL Write (void const *pBuf, DWORD dwSize, DWORD dwEncode=0)
 Writes a block to the fifo.
virtual BOOL Read (LPVOID pBuf, DWORD dwSize, LPDWORD pdwRead, DWORD dwEncode=0)
 Reads a block of data from the fifo.
virtual BOOL Peek (LPVOID pBuf, DWORD dwSize, LPDWORD pdwRead, long lOffset=0, DWORD dwEncode=0)
 Peeks at the data in the fifo buffer.
DWORD GetMaxBuffers ()
 Returns the number of total buffer slots in the fifo.
void SetMaxBuffers (DWORD dw)
 Sets the total number of buffers slots in the fifo.
DWORD GetUsedBuffers ()
 Returns the number of buffer slots in the fifo that are in use.

Detailed Description

Implements a first in first out synchronized buffer.

Use this to add variable length blocks into a synchronized first-in-first-out buffer.


Member Function Documentation

BOOL CFifoSync::AddFifo void const *  pBuf,
DWORD  dwSize,
DWORD  dwEncode = 0
 

Adds a data block to the fifo.

Parameters:
[in] pBuf - Pointer to the data to add
[in] dwSize - Size of the data in pBuf
[in] dwEncode - Optional encoding
Returns:
Non-zero if success
See also:

BOOL CFifoSync::AllocateBuffers  ) 
 

Allocates buffers for fifo.

Returns:
Non-zero if success

BOOL CFifoSync::EndFifoWrite  ) 
 

Advances head fifo head pointer, i.e. commits write.

Returns:
Non-zero if success

BOOL CFifoSync::InitFifoWrite  ) 
 

Ensures space for a fifo write.

Returns:
Non-zero if success

BOOL CFifoSync::Peek LPVOID  pBuf,
DWORD  dwSize,
LPDWORD  pdwRead,
long  lOffset = 0,
DWORD  dwEncode = 0
[virtual]
 

Peeks at the data in the fifo buffer.

Parameters:
[in] pBuf - Pointer to buffer that receives data
[in] dwSize - Size of buffer in pBuf
[in] pdwRead - Number of bytes read into pBuf
[in] lOffset - Offset from first byte to start read
[in] dwEncode - Optional decoding
Returns:
See also:

Reimplemented from CCircBuf.

BOOL CFifoSync::Read LPVOID  pBuf,
DWORD  dwSize,
LPDWORD  pdwRead,
DWORD  dwEncode = 0
[virtual]
 

Reads a block of data from the fifo.

Parameters:
[out] pBuf - Pointer to buffer that receives the data
[in] dwSize - Size of buffer in pBuf
[in] pdwRead - Number of bytes read into pBuf
[in] dwEncode - Optional decoding
Returns:
Non-zero if success
See also:

Reimplemented from CCircBuf.

void CFifoSync::SetMaxBuffers DWORD  dw  )  [inline]
 

Sets the total number of buffers slots in the fifo.

Parameters:
[in] dw - Number of buffers

BOOL CFifoSync::SkipBlock  ) 
 

Skips the next data block in the buffer.

Returns:
Non-zero if success

BOOL CFifoSync::Write void const *  pBuf,
DWORD  dwSize,
DWORD  dwEncode = 0
[virtual]
 

Writes a block to the fifo.

Parameters:
[in] pBuf - Pointer to data block
[in] dwSize - Size of data in pBuf
[in] dwEncode - Optional encoding
Returns:
Non-zero if success
See also:

Reimplemented from CCircBuf.


The documentation for this class was generated from the following files:
  • inc/FifoSync.h
  • FifoSync.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL