European
Southern
Observatory

ESO — Reaching New Heights in Astronomy

Countries taking part in the ESO

VLT Software Documentation

trkwsRING_BUFFER.4

Manpage of trkwsRING_BUFFER

trkwsRING_BUFFER

Section: Devices and Network Interfaces (4)
Updated: 2012-04-23 10:11
Index Return to man pages list
 

NAME

trkwsRING_BUFFER - Class providing a ring buffer with methods to access it

 

SYNOPSIS


#include "trkwsRING_BUFFER.h"

class trkwsRING_BUFFER
{
  public:
    trkwsRING_BUFFER(int size);
   ~trkwsRING_BUFFER();

   bufEle * Read();
   bufEle * Peek(int offset);
   ccsCOMPL_STAT Write(bufEle value);
   void Init();


  protected:
   int writeIndex;
   int readIndex;
   int diff;
   int valCount;
   int bufferSize;
   bufEle * data;
};

 

DESCRIPTION


Ring buffer class with read, write and peek methods.



 

PUBLIC METHODS


  trkwsRING_BUFFER(int size);
    The constructor receives as parameter the number of elements to reserve
    in the buffer.

 ~trkwsTRANSFER_ASM();

    The destructor deletes the buffer.

 ccsCOMPL_STAT Init();

    This method initialises all variables. It is automatically used by
    the constructor.

 bufEle * Read();

    Reads one element out of the buffer if an unread one is present.
    Otherwise return NULL pointer.

 bufEle * Peek(int offset);

    Reads an arbitrary element out of the buffer. Index 0 is the last read
    element. Positive index goes to unread elements.
    If no element for the given offset is available returns NULL;

 ccsCOMPL_STAT Write(bufEle value);
    Write a new element into the ring buffer.




 

PROTECTED DATA MEMBERS


   int writeIndex;         internal write index, incremented before writing
   int readIndex;          internal read index, incremented before reading
   int diff;               internal counter of unread elements
                           there can be at most bufferSize unread elements,
                           so 0 <= diff <= bufferSize
                           0 means nothing to be read.
   int valCount;           internal counter of elements in ring buffer
                           there can be at most bufferSize elements,
                           so 0 <= valCount <= bufferSize
                           0 means no element in the buffer.
   int bufferSize;         size of ring buffer in elements
   bufEle * data;          pointer to buffer data

   if(readIndex == writeIndex)    there are no unread element to read



 

Index

NAME
SYNOPSIS
DESCRIPTION
PUBLIC METHODS
PROTECTED DATA MEMBERS

This document was created by man2html, using the manual pages.
Time: 10:11:26 GMT, April 23, 2012
Generated on Mon Apr 23 10:12:33 2012 for INTROOT API by doxygen 1.6.3