CCA
|
CCA Buffer for Data-Flow Ports. More...
#include <Buffer.h>
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.
Member Typedef Documentation
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 >.
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 >.
Constructor & Destructor Documentation
cca::Buffer< DATATYPE >::Buffer | ( | bool | alwaysKeepLatest = true | ) | [inline] |
virtual cca::Buffer< DATATYPE >::~Buffer | ( | ) | [inline, virtual] |
cca::Buffer< DATATYPE >::Buffer | ( | Buffer< DATATYPE > & | buffer | ) | [protected] |
Copy constructor Copy constructor private for now to disallow copying.
Member Function Documentation
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 >.
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().
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 >.
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().
void cca::Buffer< DATATYPE >::operator= | ( | const Buffer< DATATYPE > & | ) | [protected] |
Copy operator Copy operator private for now to disallow copying.
virtual std::string cca::Buffer< DATATYPE >::print | ( | ) | const [inline, virtual] |
Print.
Reimplemented in cca::SingleItemBuffer< DATATYPE >, and cca::SynchronizedQueue< 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 >.
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 >.
Member Data Documentation
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().
bool cca::Buffer< DATATYPE >::newitem [protected] |
If a new value was added to the buffer since last get() or tryGet().
Definition at line 227 of file Buffer.h.
Referenced by cca::SynchronizedQueue< DATATYPE >::add(), cca::SingleItemBuffer< DATATYPE >::add(), cca::SynchronizedQueue< DATATYPE >::get(), cca::SingleItemBuffer< DATATYPE >::get(), cca::SingleItemBuffer< DATATYPE >::purge(), and cca::SynchronizedQueue< DATATYPE >::purge().
unsigned int cca::Buffer< DATATYPE >::numItems [protected] |
Returns if buffer is warmed up, so if element contained.
Definition at line 216 of file Buffer.h.
Referenced by cca::SingleItemBuffer< DATATYPE >::add(), cca::SingleItemBuffer< DATATYPE >::get(), cca::SingleItemBuffer< DATATYPE >::purge(), and cca::SynchronizedQueue< DATATYPE >::purge().
bool cca::Buffer< DATATYPE >::warm [protected] |
Returns if buffer is warmed up, so if element contained.
Definition at line 211 of file Buffer.h.
Referenced by cca::SynchronizedQueue< DATATYPE >::add(), cca::SingleItemBuffer< DATATYPE >::add(), cca::SynchronizedQueue< DATATYPE >::get(), cca::SingleItemBuffer< DATATYPE >::get(), cca::SynchronizedQueue< DATATYPE >::print(), cca::SingleItemBuffer< DATATYPE >::print(), cca::SingleItemBuffer< DATATYPE >::purge(), and cca::SynchronizedQueue< DATATYPE >::purge().
The documentation for this class was generated from the following file:
- cca/buffer/Buffer.h