Orocos Real-Time Toolkit
2.9.0
|
This object represents the default thread-safe data object implementation used by Orocos objects. More...
#include <rtt/base/DataObject.hpp>
Public Types | |
typedef T | DataType |
The type of the data. More... | |
typedef T | value_t |
typedef DataObjectInterface< T >::reference_t | reference_t |
typedef DataObjectInterface< T >::param_t | param_t |
typedef DataObjectBase::Options | Options |
typedef boost::shared_ptr< DataObjectInterface< T > > | shared_ptr |
Used for shared_ptr management. More... | |
Public Member Functions | |
DataObject (const T &initial_value=T()) | |
Create a data object for holding a user defined struct. More... | |
virtual value_t | Get () const |
Get a copy of the data. More... | |
virtual FlowStatus | Get (reference_t pull, bool copy_old_data, bool copy_sample) const |
Get a copy of the Data (non allocating). More... | |
virtual FlowStatus | Get (reference_t pull, bool copy_old_data=true) const |
Get a copy of the Data (non allocating). More... | |
virtual bool | Set (param_t push) |
Set the data to a certain value (non blocking). More... | |
virtual bool | data_sample (param_t sample, bool reset=true) |
Provides a data sample to initialize this data object. More... | |
virtual value_t | data_sample () const |
Reads back a data sample. More... | |
virtual void | clear () |
Clears any data stored by this data object, so that any subsequent Get() without a new Set() will return NoData. More... | |
Public Attributes | |
const unsigned int | MAX_THREADS |
The maximum number of threads. More... | |
This object represents the default thread-safe data object implementation used by Orocos objects.
Definition at line 65 of file DataObject.hpp.
typedef T RTT::base::DataObject< T >::DataType |
The type of the data.
Definition at line 76 of file DataObject.hpp.
|
inherited |
Definition at line 88 of file DataObjectLockFree.hpp.
|
inherited |
Definition at line 86 of file DataObjectLockFree.hpp.
|
inherited |
Definition at line 85 of file DataObjectLockFree.hpp.
|
inherited |
Used for shared_ptr management.
Definition at line 68 of file DataObjectInterface.hpp.
typedef T RTT::base::DataObject< T >::value_t |
Definition at line 77 of file DataObject.hpp.
|
inline |
Create a data object for holding a user defined struct.
Definition at line 83 of file DataObject.hpp.
|
inlinevirtualinherited |
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 337 of file DataObjectLockFree.hpp.
References RTT::os::CAS(), RTT::NoData, oro_atomic_dec(), and oro_atomic_inc().
|
inlinevirtualinherited |
Provides a data sample to initialize this data object.
As such enough storage space can be allocated before the actual writing begins.
sample | the data sample |
reset | enforce reinitialization even if this operation clears the stored data. |
Implements RTT::base::DataObjectInterface< T >.
Definition at line 310 of file DataObjectLockFree.hpp.
References RTT::NoData.
|
inlinevirtualinherited |
Reads back a data sample.
Implements RTT::base::DataObjectInterface< T >.
Definition at line 329 of file DataObjectLockFree.hpp.
References RTT::base::DataObjectLockFree< T >::Get().
Referenced by RTT::base::DataObjectLockFree< T >::DataObjectLockFree(), and RTT::base::DataObjectLockFree< T >::Set().
|
inlinevirtualinherited |
Get a copy of the data.
This method will allocate memory twice if data is not a value type. Use Get(reference_t) for the non-allocating version.
Implements RTT::base::DataObjectInterface< T >.
Definition at line 181 of file DataObjectLockFree.hpp.
Referenced by RTT::base::DataObjectLockFree< T >::data_sample(), and RTT::base::DataObjectLockFree< T >::Get().
|
inlinevirtualinherited |
Get a copy of the Data (non allocating).
If pull has reserved enough memory to store the copy, no memory will be allocated.
pull | A copy of the data. |
copy_old_data | If true, also copy the data if the data object has not been updated since the last call. |
copy_sample | If true, copy the data unconditionally. |
Definition at line 197 of file DataObjectLockFree.hpp.
References RTT::os::CAS(), RTT::NewData, RTT::NoData, RTT::OldData, oro_atomic_dec(), and oro_atomic_inc().
|
inlinevirtualinherited |
Get a copy of the Data (non allocating).
If pull has reserved enough memory to store the copy, no memory will be allocated.
pull | A copy of the data. |
copy_old_data | If 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 245 of file DataObjectLockFree.hpp.
References RTT::base::DataObjectLockFree< T >::Get().
|
inlinevirtualinherited |
Set the data to a certain value (non blocking).
push | The data which must be set. |
Implements RTT::base::DataObjectInterface< T >.
Definition at line 255 of file DataObjectLockFree.hpp.
References RTT::base::DataObjectLockFree< T >::data_sample(), RTT::Error, RTT::internal::DataSourceTypeInfo< T >::getType(), RTT::NewData, oro_atomic_dec(), oro_atomic_inc_and_test(), and oro_atomic_read().
|
inherited |
The maximum number of threads.
Definition at line 93 of file DataObjectLockFree.hpp.