CCA
cca::SingleItemBuffer< DATATYPE > Class Template Reference

CCA SingleBuffer for Data-Flow Ports. More...

#include <SingleItemBuffer.h>

Inheritance diagram for cca::SingleItemBuffer< DATATYPE >:
Collaboration diagram for cca::SingleItemBuffer< DATATYPE >:

List of all members.

Public Types

typedef ::boost::shared_ptr
< SingleItemBuffer< DATATYPE > > 
Ptr
 Defines a shared pointer for the data-type of this buffer.
typedef ::boost::shared_ptr
< DATATYPE > 
DataPtr
 Defines a shared pointer for the data-type of this buffer.

Public Member Functions

 SingleItemBuffer (bool alwaysKeepLatest=true)
 Create SingleItemBuffer, optionally always keeping the latest item.
virtual ~SingleItemBuffer ()
std::string print () const
 Print.
virtual DataPtr get () throw ()
 Getting an item from the buffer.
virtual void add (DataPtr item)
 Add a new item to the buffer.
virtual void purge ()
 Purging buffer, emptying all items letting the configuration untouched.

Private Member Functions

 SingleItemBuffer (SingleItemBuffer &buffer)
 Copy constructor private for now to disallow copying.
void operator= (const SingleItemBuffer &buffer)
 Copy operator private for now to disallow copying.

Private Attributes

DataPtr _buffer
boost::recursive_mutex bufferMutex

Detailed Description

template<class DATATYPE>
class cca::SingleItemBuffer< DATATYPE >

CCA SingleBuffer for Data-Flow Ports.

Just storing one item. Access is synchronized through mutexes.

Template Parameters:
DATATYPEType of items to store (can be shared pointer)

Definition at line 48 of file SingleItemBuffer.h.


Member Typedef Documentation

template<class DATATYPE >
typedef ::boost::shared_ptr<DATATYPE> cca::SingleItemBuffer< DATATYPE >::DataPtr

Defines a shared pointer for the data-type of this buffer.

Reimplemented from cca::Buffer< DATATYPE >.

Definition at line 55 of file SingleItemBuffer.h.

template<class DATATYPE >
typedef ::boost::shared_ptr<SingleItemBuffer<DATATYPE> > cca::SingleItemBuffer< DATATYPE >::Ptr

Defines a shared pointer for the data-type of this buffer.

Reimplemented from cca::Buffer< DATATYPE >.

Definition at line 52 of file SingleItemBuffer.h.


Constructor & Destructor Documentation

template<class DATATYPE >
cca::SingleItemBuffer< DATATYPE >::SingleItemBuffer ( bool  alwaysKeepLatest = true) [inline]

Create SingleItemBuffer, optionally always keeping the latest item.

Parameters:
alwaysKeepLatestAlways keeping the latest item

Definition at line 63 of file SingleItemBuffer.h.

template<class DATATYPE >
virtual cca::SingleItemBuffer< DATATYPE >::~SingleItemBuffer ( ) [inline, virtual]

Definition at line 67 of file SingleItemBuffer.h.

template<class DATATYPE >
cca::SingleItemBuffer< DATATYPE >::SingleItemBuffer ( SingleItemBuffer< DATATYPE > &  buffer) [private]

Copy constructor private for now to disallow copying.


Member Function Documentation

template<class DATATYPE >
virtual void cca::SingleItemBuffer< DATATYPE >::add ( DataPtr  item) [inline, virtual]
template<class DATATYPE >
virtual DataPtr cca::SingleItemBuffer< DATATYPE >::get ( ) throw () [inline, virtual]

Getting an item from the buffer.

Throws exception if empty (and not configured to always keep the latest item).

Returns:
Latest buffered item

Implements cca::Buffer< DATATYPE >.

Definition at line 97 of file SingleItemBuffer.h.

References cca::SingleItemBuffer< DATATYPE >::_buffer, cca::SingleItemBuffer< DATATYPE >::bufferMutex, cca::Buffer< DATATYPE >::empty(), cca::Buffer< DATATYPE >::keepLatest, cca::Buffer< DATATYPE >::newitem, cca::Buffer< DATATYPE >::numItems, and cca::Buffer< DATATYPE >::warm.

Here is the call graph for this function:

template<class DATATYPE >
void cca::SingleItemBuffer< DATATYPE >::operator= ( const SingleItemBuffer< DATATYPE > &  buffer) [private]

Copy operator private for now to disallow copying.

template<class DATATYPE >
std::string cca::SingleItemBuffer< DATATYPE >::print ( ) const [inline, virtual]

Print.

Reimplemented from cca::Buffer< DATATYPE >.

Definition at line 73 of file SingleItemBuffer.h.

References cca::Buffer< DATATYPE >::keepLatest, cca::Buffer< DATATYPE >::newItem(), and cca::Buffer< DATATYPE >::warm.

Here is the call graph for this function:

template<class DATATYPE >
virtual void cca::SingleItemBuffer< DATATYPE >::purge ( ) [inline, virtual]

Member Data Documentation

template<class DATATYPE >
boost::recursive_mutex cca::SingleItemBuffer< DATATYPE >::bufferMutex [mutable, private]

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