stromx  0.8.0
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

§ RecycleAccess() [1/2]

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.

§ RecycleAccess() [2/2]

stromx::runtime::RecycleAccess::RecycleAccess ( )
inline

Constructs an empty recycle access.

Member Function Documentation

§ add()

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

Adds data to the recycle access.

Parameters
dataThis data will be recycled by this access.

§ empty()

bool stromx::runtime::RecycleAccess::empty ( ) const

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

§ get() [1/2]

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.

§ get() [2/2]

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.

§ operator()() [1/2]

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.

§ operator()() [2/2]

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.

§ release()

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: