CCA
|
CCA SingleBuffer for Data-Flow Ports. More...
#include <SingleItemBuffer.h>
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:
-
DATATYPE Type of items to store (can be shared pointer)
Definition at line 48 of file SingleItemBuffer.h.
Member Typedef Documentation
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.
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
cca::SingleItemBuffer< DATATYPE >::SingleItemBuffer | ( | bool | alwaysKeepLatest = true | ) | [inline] |
Create SingleItemBuffer, optionally always keeping the latest item.
- Parameters:
-
alwaysKeepLatest Always keeping the latest item
Definition at line 63 of file SingleItemBuffer.h.
virtual cca::SingleItemBuffer< DATATYPE >::~SingleItemBuffer | ( | ) | [inline, virtual] |
Definition at line 67 of file SingleItemBuffer.h.
cca::SingleItemBuffer< DATATYPE >::SingleItemBuffer | ( | SingleItemBuffer< DATATYPE > & | buffer | ) | [private] |
Copy constructor private for now to disallow copying.
Member Function Documentation
virtual void cca::SingleItemBuffer< DATATYPE >::add | ( | DataPtr | item | ) | [inline, virtual] |
Add a new item to the buffer.
- Parameters:
-
item Item to add to the buffer
Implements cca::Buffer< DATATYPE >.
Definition at line 122 of file SingleItemBuffer.h.
References cca::SingleItemBuffer< DATATYPE >::_buffer, cca::SingleItemBuffer< DATATYPE >::bufferMutex, cca::Buffer< DATATYPE >::newitem, cca::Buffer< DATATYPE >::numItems, and cca::Buffer< DATATYPE >::warm.
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.
void cca::SingleItemBuffer< DATATYPE >::operator= | ( | const SingleItemBuffer< DATATYPE > & | buffer | ) | [private] |
Copy operator private for now to disallow copying.
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.
virtual void cca::SingleItemBuffer< DATATYPE >::purge | ( | ) | [inline, virtual] |
Purging buffer, emptying all items letting the configuration untouched.
Implements cca::Buffer< DATATYPE >.
Definition at line 133 of file SingleItemBuffer.h.
References cca::SingleItemBuffer< DATATYPE >::_buffer, cca::SingleItemBuffer< DATATYPE >::bufferMutex, cca::Buffer< DATATYPE >::newitem, cca::Buffer< DATATYPE >::numItems, and cca::Buffer< DATATYPE >::warm.
Member Data Documentation
DataPtr cca::SingleItemBuffer< DATATYPE >::_buffer [private] |
Definition at line 148 of file SingleItemBuffer.h.
Referenced by cca::SingleItemBuffer< DATATYPE >::add(), cca::SingleItemBuffer< DATATYPE >::get(), and cca::SingleItemBuffer< DATATYPE >::purge().
boost::recursive_mutex cca::SingleItemBuffer< DATATYPE >::bufferMutex [mutable, private] |
Definition at line 149 of file SingleItemBuffer.h.
Referenced by cca::SingleItemBuffer< DATATYPE >::add(), cca::SingleItemBuffer< DATATYPE >::get(), and cca::SingleItemBuffer< DATATYPE >::purge().
The documentation for this class was generated from the following file:
- cca/buffer/SingleItemBuffer.h