Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
RTT::base::DataObjectLocked< T > Class Template Reference

A class which provides locked/protected access to one typed element of data. More...

#include <DataObjectLocked.hpp>

Inheritance diagram for RTT::base::DataObjectLocked< T >:
Inheritance graph
[legend]

Public Types

typedef T DataType
 
- Public Types inherited from RTT::base::DataObjectInterface< T >
typedef boost::call_traits< T >::param_type param_t
 
typedef boost::call_traits< T >::reference reference_t
 
typedef boost::shared_ptr< DataObjectInterface< T > > shared_ptr
 
typedef T value_t
 

Public Member Functions

virtual void clear ()
 
virtual bool data_sample (param_t sample, bool reset)
 
virtual value_t data_sample () const
 
 DataObjectLocked ()
 
 DataObjectLocked (param_t initial_value)
 
virtual FlowStatus Get (reference_t pull, bool copy_old_data=true) const
 
virtual value_t Get () const
 
virtual bool Set (param_t push)
 
- Public Member Functions inherited from RTT::base::DataObjectInterface< T >
 DataObjectInterface ()
 
virtual ~DataObjectInterface ()
 
- Public Member Functions inherited from RTT::base::DataObjectBase
virtual ~DataObjectBase ()
 

Private Types

typedef DataObjectInterface< T >::param_t param_t
 
typedef DataObjectInterface< T >::reference_t reference_t
 
typedef DataObjectInterface< T >::value_t value_t
 

Private Attributes

value_t data
 
bool initialized
 
os::Mutex lock
 
FlowStatus status
 

Detailed Description

template<class T>
class RTT::base::DataObjectLocked< T >

A class which provides locked/protected access to one typed element of data.

It allows multiple read/write requests using a single lock. This is the in any case threadsafe implementation, and can be blocking in situations where you do not want that.

Definition at line 57 of file DataObjectLocked.hpp.

Member Typedef Documentation

template<class T>
typedef T RTT::base::DataObjectLocked< T >::DataType

The type of the data.

Definition at line 90 of file DataObjectLocked.hpp.

template<class T>
typedef DataObjectInterface<T>::param_t RTT::base::DataObjectLocked< T >::param_t
private

Definition at line 62 of file DataObjectLocked.hpp.

template<class T>
typedef DataObjectInterface<T>::reference_t RTT::base::DataObjectLocked< T >::reference_t
private

Definition at line 61 of file DataObjectLocked.hpp.

template<class T>
typedef DataObjectInterface<T>::value_t RTT::base::DataObjectLocked< T >::value_t
private

Definition at line 60 of file DataObjectLocked.hpp.

Constructor & Destructor Documentation

template<class T>
RTT::base::DataObjectLocked< T >::DataObjectLocked ( )
inline

Construct an uninitialized DataObjectLocked.

Definition at line 78 of file DataObjectLocked.hpp.

template<class T>
RTT::base::DataObjectLocked< T >::DataObjectLocked ( param_t  initial_value)
inline

Construct a DataObjectLocked with initial value.

Definition at line 84 of file DataObjectLocked.hpp.

Member Function Documentation

template<class T>
virtual void RTT::base::DataObjectLocked< T >::clear ( )
inlinevirtual

Clears any data stored by this data object, so that any subsequent Get() without a new Set() will return NoData.

Implements RTT::base::DataObjectInterface< T >.

Definition at line 137 of file DataObjectLocked.hpp.

template<class T>
virtual bool RTT::base::DataObjectLocked< T >::data_sample ( param_t  sample,
bool  reset 
)
inlinevirtual

Provides a data sample to initialize this data object. As such enough storage space can be allocated before the actual writing begins.

Parameters
samplethe data sample
resetenforce reinitialization even if this operation clears the stored data.
Returns
true if the data object was successfully (re)initialized.

Implements RTT::base::DataObjectInterface< T >.

Definition at line 117 of file DataObjectLocked.hpp.

template<class T>
virtual value_t RTT::base::DataObjectLocked< T >::data_sample ( ) const
inlinevirtual

Reads back a data sample.

Implements RTT::base::DataObjectInterface< T >.

Definition at line 132 of file DataObjectLocked.hpp.

template<class T>
virtual FlowStatus RTT::base::DataObjectLocked< T >::Get ( reference_t  pull,
bool  copy_old_data = true 
) const
inlinevirtual

Get a copy of the Data of this data object.

Parameters
pullA copy of the data.
copy_old_dataIf true, also copy the data if the data object has not been updated since the last call.

Implements RTT::base::DataObjectInterface< T >.

Definition at line 92 of file DataObjectLocked.hpp.

template<class T>
virtual value_t RTT::base::DataObjectLocked< T >::Get ( ) const
inlinevirtual

Get a copy of the data of this data object.

Returns
A copy of the data.

Implements RTT::base::DataObjectInterface< T >.

Definition at line 104 of file DataObjectLocked.hpp.

template<class T>
virtual bool RTT::base::DataObjectLocked< T >::Set ( param_t  push)
inlinevirtual

Set the data to a certain value.

Parameters
pushThe data which must be set.

Implements RTT::base::DataObjectInterface< T >.

Definition at line 110 of file DataObjectLocked.hpp.

Member Data Documentation

template<class T>
value_t RTT::base::DataObjectLocked< T >::data
private

One element of Data.

Definition at line 69 of file DataObjectLocked.hpp.

template<class T>
bool RTT::base::DataObjectLocked< T >::initialized
private

Definition at line 72 of file DataObjectLocked.hpp.

template<class T>
os::Mutex RTT::base::DataObjectLocked< T >::lock
mutableprivate

Definition at line 64 of file DataObjectLocked.hpp.

template<class T>
FlowStatus RTT::base::DataObjectLocked< T >::status
mutableprivate

Definition at line 71 of file DataObjectLocked.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:46