Orocos Real-Time Toolkit  2.9.0
Public Member Functions | Public Attributes | Protected Attributes | List of all members
RTT::Constant< T > Class Template Reference

As opposed to a Attribute, a Constant can not be assigned to a new value after creation. More...

#include <rtt/Attribute.hpp>

Inheritance diagram for RTT::Constant< T >:
RTT::base::AttributeBase

Public Member Functions

 Constant ()
 Create a Constant with no name and no value. More...
 
 Constant (const std::string &name, T t)
 Create a constant with a fixed value t. More...
 
template<class Owner >
 Constant (const std::string &name, T t, Owner owner)
 Create a constant with a fixed value t and an owner. More...
 
 Constant (const std::string &name, internal::DataSource< T > *d)
 Create a constant wich holds a internal::DataSource d. More...
 
 Constant (base::AttributeBase *ab)
 Create a constant which mirrors an Attribute. More...
 
Constant< T > & operator= (base::AttributeBase *ab)
 Initialise an Attribute which mirrors an AttributeBase. More...
 
get () const
 Get the value of this Constant. More...
 
base::DataSourceBase::shared_ptr getDataSource () const
 Return a internal::DataSource which contains the same contents. More...
 
Constant< T > * clone () const
 Returns a clone of this AttributeBase. More...
 
Constant< T > * copy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &replacements, bool instantiate)
 Returns a copy of this AttributeBase. More...
 
const std::string & getName () const
 Get the name of this instance. More...
 
void setName (std::string const &new_name)
 Get the name of this instance. More...
 
bool ready () const
 Returns true if the Attribute was correctly initialised. More...
 

Public Attributes

internal::DataSource< T >::shared_ptr data
 

Protected Attributes

std::string mname
 

Detailed Description

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

As opposed to a Attribute, a Constant can not be assigned to a new value after creation.

Definition at line 249 of file Attribute.hpp.

Constructor & Destructor Documentation

template<typename T>
RTT::Constant< T >::Constant ( )
inline

Create a Constant with no name and no value.

Definition at line 258 of file Attribute.hpp.

template<typename T>
RTT::Constant< T >::Constant ( const std::string &  name,
t 
)
inline

Create a constant with a fixed value t.

Parameters
nameThe name of this instance.
tThe value for initialisation.

Definition at line 267 of file Attribute.hpp.

template<typename T>
template<class Owner >
RTT::Constant< T >::Constant ( const std::string &  name,
t,
Owner  owner 
)
inline

Create a constant with a fixed value t and an owner.

The owner is used to register this attribute to and is supposed to be a pointer (or shared pointer).

Parameters
nameThe name of this instance.
tThe value for initialisation.
oThe owner, which has a function 'addAttribute(AttributeBase*)'.

Definition at line 283 of file Attribute.hpp.

template<typename T>
RTT::Constant< T >::Constant ( const std::string &  name,
internal::DataSource< T > *  d 
)
inline

Create a constant wich holds a internal::DataSource d.

Definition at line 293 of file Attribute.hpp.

template<typename T>
RTT::Constant< T >::Constant ( base::AttributeBase ab)
inline

Create a constant which mirrors an Attribute.

If successful, this constant will always have the same value as ab.

Parameters
abThe attribute to mirror. If null, this will clear this attribute and clear its name.
See also
ready() to check if ab was accepted.

Definition at line 307 of file Attribute.hpp.

Member Function Documentation

template<typename T>
Constant<T>* RTT::Constant< T >::clone ( ) const
inlinevirtual

Returns a clone of this AttributeBase.

Implements RTT::base::AttributeBase.

Definition at line 354 of file Attribute.hpp.

References RTT::internal::DataSource< T >::get(), and RTT::base::AttributeBase::mname.

template<typename T>
Constant<T>* RTT::Constant< T >::copy ( std::map< const base::DataSourceBase *, base::DataSourceBase * > &  replacements,
bool  instantiate 
)
inlinevirtual

Returns a copy of this AttributeBase.

Uses the given replacements to copy held DataSources.

Parameters
instantiateSet to true to get a copy which will return itself on any future copy request.

Implements RTT::base::AttributeBase.

Definition at line 359 of file Attribute.hpp.

References RTT::internal::DataSource< T >::get(), and RTT::base::AttributeBase::mname.

template<typename T>
T RTT::Constant< T >::get ( ) const
inline

Get the value of this Constant.

Definition at line 344 of file Attribute.hpp.

References RTT::internal::DataSource< T >::get().

template<typename T>
base::DataSourceBase::shared_ptr RTT::Constant< T >::getDataSource ( ) const
inlinevirtual

Return a internal::DataSource which contains the same contents.

Implements RTT::base::AttributeBase.

Definition at line 349 of file Attribute.hpp.

const std::string & RTT::AttributeBase::getName ( ) const
inherited
template<typename T>
Constant<T>& RTT::Constant< T >::operator= ( base::AttributeBase ab)
inline

Initialise an Attribute which mirrors an AttributeBase.

If successful, this constant will always have the same value as ab.

Parameters
abThe attribute to mirror. If null, this will clear this attribute and clear its name.
See also
ready() to check if ab was accepted.

Definition at line 321 of file Attribute.hpp.

References RTT::base::AttributeBase::getDataSource(), RTT::base::AttributeBase::getName(), and RTT::base::AttributeBase::mname.

bool RTT::base::AttributeBase::ready ( ) const
inlineinherited

Returns true if the Attribute was correctly initialised.

Definition at line 89 of file AttributeBase.hpp.

Referenced by RTT::ConfigurationInterface::addAttribute(), and RTT::ConfigurationInterface::addConstant().

void RTT::AttributeBase::setName ( std::string const &  new_name)
inherited

Member Data Documentation

template<typename T>
internal::DataSource<T>::shared_ptr RTT::Constant< T >::data

Definition at line 253 of file Attribute.hpp.

std::string RTT::base::AttributeBase::mname
protectedinherited

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