stromx  0.7.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
stromx::runtime::RecycleAccess Class Reference

Recycle access to a data container. More...

#include <RecycleAccess.h>

Public Member Functions

 RecycleAccess (const DataContainer &data)
 
 RecycleAccess ()
 
void add (const DataContainer &data)
 
bool empty () const
 
Dataoperator() () const
 
Dataget () const
 
Dataoperator() (const unsigned int timeout) const
 
Dataget (const unsigned int timeout) const
 
void release ()
 

Detailed Description

Recycle access to a data container.

A recycle access allows to recycle data which is not used anymore. In other words, it provides a mechanism to reclaim objects which are ready to be destroyed and to reuse the memory the occupy. This avoids frequent allocation and deallocation of these objects.

Constructor & Destructor Documentation

stromx::runtime::RecycleAccess::RecycleAccess ( const DataContainer data)
explicit

Constructs a recycle access and adds data to it.

Parameters
dataThis data will be recycled by this access.
stromx::runtime::RecycleAccess::RecycleAccess ( )
inline

Constructs an empty recycle access.

Member Function Documentation

void stromx::runtime::RecycleAccess::add ( const DataContainer data)

Adds data to the recycle access.

Parameters
dataThis data will be recycled by this access.
bool stromx::runtime::RecycleAccess::empty ( ) const

Returns true if the recycle access does not reference any data which can be recycled.

Data * stromx::runtime::RecycleAccess::get ( ) const

Waits for data which has been added to the recycle access and is ready to be recycled, i.e. no other objects reference it. Returns 0 if the recycle access does not reference any data which can be recycled.

Data * stromx::runtime::RecycleAccess::get ( const unsigned int  timeout) const

Waits for data which has been added to the recycle access and is ready to be recycled, i.e. no other objects reference it. Returns 0 if the recycle access does not reference any data which can be recycled.

Parameters
timeoutThe maximal time to wait in milliseconds.
Exceptions
TimeoutIf no data was recycled during the timeout.
Data* stromx::runtime::RecycleAccess::operator() ( ) const
inline

Waits for data which has been added to the recycle access and is ready to be recycled, i.e. no other objects reference it. Returns 0 if the recycle access does not reference any data which can be recycled.

Data* stromx::runtime::RecycleAccess::operator() ( const unsigned int  timeout) const
inline

Waits for data which has been added to the recycle access and is ready to be recycled, i.e. no other objects reference it. Returns 0 if the recycle access does not reference any data which can be recycled.

Parameters
timeoutThe maximal time to wait in milliseconds.
Exceptions
TimeoutIf no data was recycled during the timeout.
void stromx::runtime::RecycleAccess::release ( )
inline

Releases the write access. The access is empty after calling this function.


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