Orocos Real-Time Toolkit
2.8.3
|
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 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 DataType | Get () const |
Get a copy of the data. More... | |
virtual void | Get (DataType &pull) const |
Get a copy of the Data (non allocating). More... | |
virtual void | Set (const DataType &push) |
Set the data to a certain value (non blocking). More... | |
virtual void | data_sample (const DataType &sample) |
Provides a data sample to initialize this data object. 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 |
Used for shared_ptr management.
Definition at line 62 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 |
Provides a data sample to initialize this data object.
As such enough storage space can be allocated before the actual writing begins.
sample |
Implements RTT::base::DataObjectInterface< T >.
Definition at line 218 of file DataObjectLockFree.hpp.
Referenced by RTT::base::DataObjectLockFree< T >::DataObjectLockFree().
|
inlinevirtualinherited |
Get a copy of the data.
This method will allocate memory twice if data is not a value type. Use Get(DataType&) for the non-allocating version.
Implements RTT::base::DataObjectInterface< T >.
Definition at line 155 of file DataObjectLockFree.hpp.
References RTT::base::DataObjectLockFree< T >::Get().
Referenced by 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. |
Implements RTT::base::DataObjectInterface< T >.
Definition at line 164 of file DataObjectLockFree.hpp.
References oro_atomic_dec(), and oro_atomic_inc().
|
inlinevirtualinherited |
Set the data to a certain value (non blocking).
push | The data which must be set. |
This method can not be called concurrently (only one producer). With a minimum of 3 buffers, if the write_ptr+1 field is not occupied, it will remain so because the read_ptr is at write_ptr-1 (and can not increment the counter on write_ptr+1). Hence, no locking is needed.
Implements RTT::base::DataObjectInterface< T >.
Definition at line 191 of file DataObjectLockFree.hpp.
References oro_atomic_read().
|
inherited |
The maximum number of threads.
When used in data flow, this is always 2.
Definition at line 91 of file DataObjectLockFree.hpp.