Orocos Real-Time Toolkit
2.9.0
|
An Attribute has a name and contains data which can be set and get. More...
#include <rtt/Attribute.hpp>
Public Member Functions | |
Attribute () | |
Create an Attribute with no name and no value. More... | |
Attribute (const std::string &name) | |
Create an Attribute with a given name and a default value. More... | |
Attribute (const std::string &name, T t) | |
Create an Attribute with a name and a given value t. More... | |
template<class Owner > | |
Attribute (const std::string &name, T t, Owner o) | |
Create an Attribute with a name, a given value t and an owner. More... | |
Attribute (const std::string &name, internal::AssignableDataSource< T > *d) | |
Create an Attribute which uses a internal::DataSource d. More... | |
Attribute (const Attribute< T > &a) | |
Copy constructor copies both name and deep copy of the data. More... | |
Attribute< T > & | operator= (const Attribute< T > &a) |
Assignment copies both name and deep copy of the data. More... | |
Attribute (base::AttributeBase *ab) | |
Create an Attribute which mirrors a base::AttributeBase ab. More... | |
Attribute< T > & | operator= (base::AttributeBase *ab) |
Initialise an Attribute which mirrors an base::AttributeBase ab. More... | |
T const & | get () const |
Get the value of this Attribute. More... | |
void | set (T const &t) |
Set the value of this Attribute. More... | |
internal::AssignableDataSource< T >::reference_t | set () |
Allow to set the value of this Attribute by reference. More... | |
base::DataSourceBase::shared_ptr | getDataSource () const |
Return a internal::DataSource which contains the same contents. More... | |
internal::AssignableDataSource< T >::shared_ptr | getAssignableDataSource () const |
Attribute< T > * | clone () const |
Returns a clone of this AttributeBase. More... | |
Attribute< 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... | |
Protected Attributes | |
std::string | mname |
An Attribute has a name and contains data which can be set and get.
Accessing an attribute (reading/writing) is not thread-safe. It is used to expose a C/C++ variable to the interface of a TaskContext in order to allow plugins or external tools to read and write it.
T | The type of data this attribute holds. |
Definition at line 56 of file Attribute.hpp.
|
inline |
Create an Attribute with no name and no value.
Definition at line 65 of file Attribute.hpp.
|
inlineexplicit |
Create an Attribute with a given name and a default value.
name | The name of this instance. |
Definition at line 74 of file Attribute.hpp.
|
inline |
Create an Attribute with a name and a given value t.
name | The name of this instance. |
t | The value for initialisation. |
Definition at line 85 of file Attribute.hpp.
|
inline |
Create an Attribute with a name, a given value t and an owner.
The owner is used to register this attribute to and is supposed to be a pointer (or shared pointer).
name | The name of this instance. |
t | The value for initialisation. |
o | The owner, which has a function 'addAttribute(AttributeBase*)'. |
Definition at line 101 of file Attribute.hpp.
|
inline |
Create an Attribute which uses a internal::DataSource d.
name | The name |
d | The data source to read from and write to. |
Definition at line 114 of file Attribute.hpp.
|
inline |
Copy constructor copies both name and deep copy of the data.
Definition at line 123 of file Attribute.hpp.
|
inline |
Create an Attribute which mirrors a base::AttributeBase ab.
If successful, this attribute will always have the same value as ab and vice versa.
ab | The Attribute to mirror. If null, this will clear this attribute and clear its name. |
Definition at line 150 of file Attribute.hpp.
|
inlinevirtual |
Returns a clone of this AttributeBase.
Implements RTT::base::AttributeBase.
Definition at line 224 of file Attribute.hpp.
References RTT::internal::DataSource< T >::get(), and RTT::base::AttributeBase::mname.
Referenced by RTT::Alias::Alias().
|
inlinevirtual |
Returns a copy of this AttributeBase.
Uses the given replacements to copy held DataSources.
instantiate | Set to true to get a copy which will return itself on any future copy request. |
Implements RTT::base::AttributeBase.
Definition at line 229 of file Attribute.hpp.
References RTT::internal::AssignableDataSource< T >::clone(), RTT::internal::AssignableDataSource< T >::copy(), RTT::internal::DataSource< T >::get(), and RTT::base::AttributeBase::mname.
Referenced by RTT::Alias::Alias().
|
inline |
Get the value of this Attribute.
Definition at line 188 of file Attribute.hpp.
References RTT::internal::DataSource< T >::evaluate(), and RTT::internal::DataSource< T >::rvalue().
|
inline |
Definition at line 219 of file Attribute.hpp.
|
inlinevirtual |
Return a internal::DataSource which contains the same contents.
Implements RTT::base::AttributeBase.
Definition at line 214 of file Attribute.hpp.
Referenced by RTT::Alias::Alias().
|
inherited |
Get the name of this instance.
Definition at line 59 of file Attribute.cpp.
References RTT::base::AttributeBase::mname.
Referenced by RTT::ConfigurationInterface::getAttributeNames(), RTT::ConfigurationInterface::getValue(), RTT::ConfigurationInterface::hasAttribute(), RTT::Attribute< T >::operator=(), RTT::Constant< T >::operator=(), RTT::ConfigurationInterface::removeValue(), and RTT::ConfigurationInterface::setValue().
|
inline |
Assignment copies both name and deep copy of the data.
Definition at line 132 of file Attribute.hpp.
References RTT::base::AttributeBase::mname.
|
inline |
Initialise an Attribute which mirrors an base::AttributeBase ab.
If successful, this attribute will always have the same value as ab and vice versa.
ab | The attribute to mirror. If null, this will clear this attribute and clear its name. |
Definition at line 164 of file Attribute.hpp.
References RTT::base::AttributeBase::getDataSource(), RTT::base::AttributeBase::getName(), and RTT::base::AttributeBase::mname.
|
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().
|
inline |
Set the value of this Attribute.
In case the attribute is owned by a remote component, the value will be transfered.
Definition at line 199 of file Attribute.hpp.
References RTT::internal::AssignableDataSource< T >::set().
Referenced by RTT::types::RTStringTypeInfo::buildVariable(), and RTT::types::StdStringTypeInfo::buildVariable().
|
inline |
Allow to set the value of this Attribute by reference.
Don't use this function to set attributes of remote components, since set() will return in that case a copy of the data and the remote side will not be updated.
Definition at line 210 of file Attribute.hpp.
References RTT::internal::AssignableDataSource< T >::set().
|
inherited |
Get the name of this instance.
Definition at line 64 of file Attribute.cpp.
References RTT::base::AttributeBase::mname.
Referenced by RTT::ConfigurationInterface::addAttribute(), RTT::ConfigurationInterface::addConstant(), and RTT::scripting::ExpressionParser::getHandle().
|
protectedinherited |
Definition at line 55 of file AttributeBase.hpp.
Referenced by RTT::scripting::SendHandleAlias::clone(), RTT::Attribute< T >::clone(), RTT::Constant< T >::clone(), RTT::Alias::clone(), RTT::scripting::SendHandleAlias::copy(), RTT::Attribute< T >::copy(), RTT::Constant< T >::copy(), RTT::Alias::copy(), RTT::base::AttributeBase::getName(), RTT::Attribute< T >::operator=(), RTT::Constant< T >::operator=(), and RTT::base::AttributeBase::setName().