CCA
cca::Buffer< DATATYPE > Class Template Reference

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

#include <Buffer.h>

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

List of all members.

Public Types

typedef ::boost::shared_ptr
< Buffer< 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

 Buffer (bool alwaysKeepLatest=true)
virtual ~Buffer ()
virtual std::string print () const
 Print.
virtual DataPtr get ()=0 throw ()
 Getting an item from the buffer.
virtual void add (DataPtr item)=0
 Add a new item to the buffer.
virtual bool empty () const
 Returns, if buffer is empty.
virtual bool newItem () const
 Returns, if buffer is empty.
virtual unsigned int size () const
 Returns number of buffered items.
virtual void purge ()=0
 Purging buffer, emptying all items letting the configuration untouched.

Protected Member Functions

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

Protected Attributes

bool warm
 Returns if buffer is warmed up, so if element contained.
unsigned int numItems
 Returns if buffer is warmed up, so if element contained.
bool keepLatest
 If this is true, the buffer will always keep the latest item.
bool newitem
 If a new value was added to the buffer since last get() or tryGet().

Detailed Description

template<class DATATYPE>
class cca::Buffer< DATATYPE >

CCA Buffer for Data-Flow Ports.

Configurable as part of PortConfiguration.

Definition at line 118 of file Buffer.h.


Member Typedef Documentation

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

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

Reimplemented from cca::Buffering< DATATYPE >.

Reimplemented in cca::SingleItemBuffer< DATATYPE >, and cca::SynchronizedQueue< DATATYPE >.

Definition at line 126 of file Buffer.h.

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

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

Reimplemented in cca::SingleItemBuffer< DATATYPE >, and cca::SynchronizedQueue< DATATYPE >.

Definition at line 123 of file Buffer.h.


Constructor & Destructor Documentation

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

Definition at line 128 of file Buffer.h.

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

Definition at line 133 of file Buffer.h.

template<class DATATYPE>
cca::Buffer< DATATYPE >::Buffer ( Buffer< DATATYPE > &  buffer) [protected]

Copy constructor Copy constructor private for now to disallow copying.


Member Function Documentation

template<class DATATYPE>
virtual void cca::Buffer< DATATYPE >::add ( DataPtr  item) [pure virtual]

Add a new item to the buffer.

Implements cca::Buffering< DATATYPE >.

Implemented in cca::SingleItemBuffer< DATATYPE >, and cca::SynchronizedQueue< DATATYPE >.

template<class DATATYPE>
virtual bool cca::Buffer< DATATYPE >::empty ( ) const [inline, virtual]

Returns, if buffer is empty.

If buffer is configured to always keep the latest item, this is only the case until first item arrived. This method should be implemented fast, because its heavily frequented by CCA Components.

Implements cca::Buffering< DATATYPE >.

Definition at line 162 of file Buffer.h.

Referenced by cca::SingleItemBuffer< DATATYPE >::get().

Here is the caller graph for this function:

template<class DATATYPE>
virtual DataPtr cca::Buffer< DATATYPE >::get ( ) throw () [pure virtual]

Getting an item from the buffer.

Implements cca::Buffering< DATATYPE >.

Implemented in cca::SingleItemBuffer< DATATYPE >, and cca::SynchronizedQueue< DATATYPE >.

template<class DATATYPE>
virtual bool cca::Buffer< DATATYPE >::newItem ( ) const [inline, virtual]

Returns, if buffer is empty.

If buffer is configured to always keep the latest item, this is only the case until first item arrived. This method should be implemented fast, because its heavily frequented by CCA Components.

Implements cca::Buffering< DATATYPE >.

Definition at line 176 of file Buffer.h.

Referenced by cca::SynchronizedQueue< DATATYPE >::print(), and cca::SingleItemBuffer< DATATYPE >::print().

Here is the caller graph for this function:

template<class DATATYPE>
void cca::Buffer< DATATYPE >::operator= ( const Buffer< DATATYPE > &  ) [protected]

Copy operator Copy operator private for now to disallow copying.

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

Print.

Reimplemented in cca::SingleItemBuffer< DATATYPE >, and cca::SynchronizedQueue< DATATYPE >.

Definition at line 139 of file Buffer.h.

template<class DATATYPE>
virtual void cca::Buffer< DATATYPE >::purge ( ) [pure virtual]

Purging buffer, emptying all items letting the configuration untouched.

Implements cca::Buffering< DATATYPE >.

Implemented in cca::SynchronizedQueue< DATATYPE >, and cca::SingleItemBuffer< DATATYPE >.

template<class DATATYPE>
virtual unsigned int cca::Buffer< DATATYPE >::size ( ) const [inline, virtual]

Returns number of buffered items.

(NOT including the kept item if keepLatest active. This method should be implemented fast, because its heavily frequented by CCA.

Implements cca::Buffering< DATATYPE >.

Reimplemented in cca::SynchronizedQueue< DATATYPE >.

Definition at line 186 of file Buffer.h.


Member Data Documentation

template<class DATATYPE>
bool cca::Buffer< DATATYPE >::keepLatest [protected]

If this is true, the buffer will always keep the latest item.

This means buffer is only empty until first item arrived.

Definition at line 222 of file Buffer.h.

Referenced by cca::SynchronizedQueue< DATATYPE >::add(), cca::SynchronizedQueue< DATATYPE >::get(), cca::SingleItemBuffer< DATATYPE >::get(), cca::SynchronizedQueue< DATATYPE >::print(), and cca::SingleItemBuffer< DATATYPE >::print().

template<class DATATYPE>
unsigned int cca::Buffer< DATATYPE >::numItems [protected]

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