RTT::Attribute< T > Class Template Reference

An Attribute has a name and contains data which can be set and get. More...

#include <rtt/Attribute.hpp>

Inheritance diagram for RTT::Attribute< T >:
RTT::AttributeBase

List of all members.

Public Member Functions

 Attribute ()
 Create an Attribute with no name and no value.
 Attribute (const std::string &name)
 Create an Attribute with a given name and a default value.
 Attribute (const std::string &name, T t)
 Create an Attribute with a name and a given value t.
 Attribute (const std::string &name, AssignableDataSource< T > *d)
 Create an Attribute which uses a DataSource d.
 Attribute (const Attribute< T > &a)
 Copy constructor copies both name and deep copy of the data.
Attribute< T > & operator= (const Attribute< T > &a)
 Assignment copies both name and deep copy of the data.
 Attribute (AttributeBase *ab)
 Create an Attribute which mirrors a AttributeBase ab.
Attribute< T > & operator= (AttributeBase *ab)
 Initialise an Attribute which mirrors an AttributeBase ab.
get () const
 Get the value of this Attribute.
void set (T t)
 Set the value of this Attribute.
AssignableDataSource< T >
::reference_t 
set ()
 Set the value of this Attribute.
DataSourceBase::shared_ptr getDataSource () const
 Return a DataSource which contains the same contents.
AssignableDataSource< T >
::shared_ptr 
getAssignableDataSource () const
Attribute< T > * clone () const
 Returns a clone of this AttributeBase.
Attribute< T > * copy (std::map< const DataSourceBase *, DataSourceBase * > &replacements, bool instantiate)
 Returns a copy of this AttributeBase.
const std::string & getName () const
 Get the name of this instance.
bool ready () const
 Returns true if the Attribute was correctly initialised.

Protected Attributes

std::string mname

Detailed Description

template<typename T>
class RTT::Attribute< T >

An Attribute has a name and contains data which can be set and get.

Parameters:
T The type of data this attribute holds.

Definition at line 53 of file Attribute.hpp.


Constructor & Destructor Documentation

template<typename T>
RTT::Attribute< T >::Attribute ( const std::string &  name  )  [inline]

Create an Attribute with a given name and a default value.

Parameters:
name The name of this instance.

Definition at line 62 of file Attribute.hpp.

template<typename T>
RTT::Attribute< T >::Attribute ( const std::string &  name,
t 
) [inline, explicit]

Create an Attribute with a name and a given value t.

Parameters:
name The name of this instance.
t The value for initialisation.

Definition at line 73 of file Attribute.hpp.

template<typename T>
RTT::Attribute< T >::Attribute ( const std::string &  name,
AssignableDataSource< T > *  d 
) [inline]

Create an Attribute which uses a DataSource d.

Parameters:
name The name
d The data source to read from and write to.

Definition at line 85 of file Attribute.hpp.

template<typename T>
RTT::Attribute< T >::Attribute ( AttributeBase ab  )  [inline]

Create an Attribute which mirrors a AttributeBase ab.

If successful, this attribute will always have the same value as ab and vice versa.

Parameters:
ab The Attribute to mirror.
See also:
ready() to check if ab was accepted.

Definition at line 120 of file Attribute.hpp.


Member Function Documentation

template<typename T>
Attribute<T>* RTT::Attribute< T >::copy ( std::map< const DataSourceBase *, DataSourceBase * > &  replacements,
bool  instantiate 
) [inline, virtual]

Returns a copy of this AttributeBase.

Uses the given replacements to copy held DataSources.

Parameters:
instantiate Set to true to get a copy which will return itself on any future copy request.

Implements RTT::AttributeBase.

Definition at line 186 of file Attribute.hpp.

const std::string& RTT::AttributeBase::getName (  )  const [inherited]

Get the name of this instance.

Returns:
the name
template<typename T>
Attribute<T>& RTT::Attribute< T >::operator= ( AttributeBase ab  )  [inline]

Initialise an Attribute which mirrors an AttributeBase ab.

If successful, this attribute will always have the same value as ab and vice versa.

See also:
ready() to check if ab was accepted.

Definition at line 132 of file Attribute.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:39 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3