CircBuffer< _Tp > Class Template Reference

A (circular) in-memory buffer. More...

#include <history.h>

Inheritance diagram for CircBuffer< _Tp >:

Inheritance graph
[legend]
Collaboration diagram for CircBuffer< _Tp >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CircBuffer (u_int16_t n)
void push_back (const _Tp &e)
 When push_back'ing, call std::vector<>'s push_back, then "bounds check".
std::vector< _Tp >::size_type max_size () const
 Override max_size() so it returns circ_size, not the maximum size the std::vector<> can be allocated to.

Private Attributes

u_int16_t circ_size
 size limit of the buffer/vector


Detailed Description

template<class _Tp>
class CircBuffer< _Tp >

A (circular) in-memory buffer.

This template class is a subclass of std::vector<> that manages to be of a limited size. If the vector<> grows beyond the specified size, it trims the elements off of the top automatically.

Todo:
XXX - perhaps not technically a "circular buffer". Maybe rename?

Definition at line 67 of file history.h.


Constructor & Destructor Documentation

template<class _Tp>
CircBuffer< _Tp >::CircBuffer ( u_int16_t  n  )  [inline]

Set the internal "size state" variable to n, and initialize the mutex.

Definition at line 71 of file history.h.


Member Function Documentation

template<class _Tp>
void CircBuffer< _Tp >::push_back ( const _Tp e  )  [inline]

When push_back'ing, call std::vector<>'s push_back, then "bounds check".

..

Definition at line 75 of file history.h.

Referenced by History::write().

Here is the caller graph for this function:

template<class _Tp>
std::vector<_Tp>::size_type CircBuffer< _Tp >::max_size (  )  const [inline]

Override max_size() so it returns circ_size, not the maximum size the std::vector<> can be allocated to.

..

Definition at line 83 of file history.h.

Referenced by History::get_id().

Here is the caller graph for this function:


Member Data Documentation

template<class _Tp>
u_int16_t CircBuffer< _Tp >::circ_size [private]

size limit of the buffer/vector

Definition at line 87 of file history.h.

Referenced by CircBuffer< std::string >::max_size(), and CircBuffer< std::string >::push_back().


The documentation for this class was generated from the following file:

Generated on Tue May 13 11:32:43 2008 for consmgr by  doxygen 1.5.5