Orocos Real-Time Toolkit
2.9.0
|
A property represents a named value of any type with a description. More...
#include <rtt/Property.hpp>
Public Types | |
typedef boost::remove_const< typename boost::remove_reference< T >::type >::type | value_t |
The types of this property type. More... | |
typedef boost::call_traits< value_t >::param_type | param_t |
typedef boost::call_traits< value_t >::reference | reference_t |
typedef boost::call_traits< value_t >::const_reference | const_reference_t |
typedef value_t | DataSourceType |
Public Member Functions | |
Property () | |
Create an empty Property with no name, no description and no value. More... | |
Property (const std::string &name) | |
The constructor which initializes the property's value to the default. More... | |
Property (const std::string &name, const std::string &description, param_t value=value_t()) | |
The constructor which initializes the property's value. More... | |
Property (const Property< T > &orig) | |
Copy constructors copies the name, description and value as deep copies. More... | |
Property (base::PropertyBase *source) | |
Create a Property mirroring another PropertyBase. More... | |
Property (const std::string &name, const std::string &description, const typename internal::AssignableDataSource< DataSourceType >::shared_ptr &datasource) | |
The constructor which initializes the property with a DataSource. More... | |
Property< T > & | operator= (param_t value) |
Set the property's value. More... | |
Property< T > & | operator= (base::PropertyBase *source) |
Mirror another PropertyBase (name, description and value). More... | |
Property< T > & | operator<<= (Property< T > &p) |
Update the value of this property with another property. More... | |
Property< T > & | doc (const std::string &descr) |
Documents this property. More... | |
operator value_t () const | |
Get a copy of the value of the property. More... | |
DataSourceType | get () const |
Get a copy of the value of the property. More... | |
reference_t | set () |
Access to the value of the Property. More... | |
void | set (param_t v) |
Set the value of the Property. More... | |
reference_t | value () |
Access to the value of the Property. More... | |
const_reference_t | rvalue () const |
Read-only (const&) access to the value of the Property. More... | |
virtual void | identify (base::PropertyIntrospection *pi) |
A call on this method will lead to a call to the PropertyIntrospection interface identifying this Property's proper type. More... | |
virtual void | identify (base::PropertyBagVisitor *pi) |
A call on this method will lead to a call to the PropertyBagIntrospection interface identifying this Property's proper type. More... | |
virtual bool | update (const base::PropertyBase *other) |
Update the value of this Property with the value of an other Property. More... | |
virtual bool | refresh (const base::PropertyBase *other) |
Refresh the value of this Property with the value of an other Property. More... | |
virtual bool | copy (const base::PropertyBase *other) |
Copy an other Property onto this property. More... | |
bool | copy (const Property< T > &orig) |
Copy the value, complete overwrite of this Property with orig. More... | |
bool | update (const Property< T > &orig) |
Update the value, optionally also the description if current description is empty. More... | |
bool | refresh (const Property< T > &orig) |
Refresh only the value from a Property. More... | |
virtual Property< T > * | clone () const |
Deliver an identical clone of this PropertyBase. More... | |
virtual Property< T > * | create () const |
Create a new default instance of the PropertyBase. More... | |
virtual Property< T > * | create (const base::DataSourceBase::shared_ptr &datasource) const |
Create a new instance of the PropertyBase with a custom data source. More... | |
virtual base::DataSourceBase::shared_ptr | getDataSource () const |
Get an assignable base::DataSource through which this PropertyBase can be manipulated. More... | |
internal::AssignableDataSource< DataSourceType >::shared_ptr | getAssignableDataSource () const |
virtual bool | setDataSource (const base::DataSourceBase::shared_ptr &dsb) |
Assign an external assignable base::DataSource to this property. More... | |
virtual std::string | getType () const |
Returns the type of this PropertyBase. More... | |
virtual const types::TypeInfo * | getTypeInfo () const |
Returns the types::TypeInfo object of this Property. More... | |
template<> | |
void | identify (PropertyBagVisitor *pbi) |
A call on this method will lead to a call to the PropertyBagIntrospection interface identifying this Property's proper type. More... | |
template<> | |
RTT_API bool | update (const Property< PropertyBag > &orig) |
Partial specialisations in case of PropertyBag. More... | |
template<> | |
RTT_API bool | refresh (const Property< PropertyBag > &orig) |
template<> | |
RTT_API bool | copy (const Property< PropertyBag > &orig) |
template<> | |
RTT_API void | identify (base::PropertyBagVisitor *pbi) |
A call on this method will lead to a call to the PropertyBagIntrospection interface identifying this Property's proper type. More... | |
template<> | |
bool | update (const Property< PropertyBag > &orig) |
template<> | |
bool | refresh (const Property< PropertyBag > &orig) |
template<> | |
bool | copy (const Property< PropertyBag > &orig) |
const std::string & | getName () const |
Get the name of the property. More... | |
void | setName (const std::string &name) |
Set the name of the property. More... | |
const std::string & | getDescription () const |
Get a description of the property. More... | |
void | setDescription (const std::string &desc) |
Set the description of the property. More... | |
bool | ready () const |
Inspect if this Property is correctly initialised and ready for usage. More... | |
virtual bool | compose (const PropertyBag &source) |
Composes the data of this property with information found in a PropertyBag. More... | |
Static Public Member Functions | |
static Property< T > * | narrow (base::PropertyBase *prop) |
Use this method instead of dynamic_cast<> to cast from base::PropertyBase to Property<T>. More... | |
Protected Attributes | |
internal::AssignableDataSource< DataSourceType >::shared_ptr | _value |
std::string | _name |
A short name for this PropertyBase. More... | |
std::string | _description |
A lengthy description for this PropertyBase. More... | |
A property represents a named value of any type with a description.
A property is a tuple of a name, a description and a variable of any type. It's purpose is to provide a hierarchical parameter of a component. They are grouped in PropertyBag objects and a Property can contain a PropertyBag itself.
If you do not provide a name nor description when constructing the Property object, it will be uninitialised and ready() will return false. Such an object may not be used (set(), get(),...) until it has been initialised from another Property. Otherwise, an exception (or assert) will be thrown.
T | The type of the data contained within the Property. |
Definition at line 76 of file Property.hpp.
typedef boost::call_traits<value_t>::const_reference RTT::Property< T >::const_reference_t |
Definition at line 88 of file Property.hpp.
typedef value_t RTT::Property< T >::DataSourceType |
Definition at line 89 of file Property.hpp.
typedef boost::call_traits<value_t>::param_type RTT::Property< T >::param_t |
Definition at line 86 of file Property.hpp.
typedef boost::call_traits<value_t>::reference RTT::Property< T >::reference_t |
Definition at line 87 of file Property.hpp.
typedef boost::remove_const<typename boost::remove_reference<T>::type>::type RTT::Property< T >::value_t |
The types of this property type.
value_t is always the 'bare' value type of T. From this type, we derive the other (param, ref, ...) types.
Definition at line 85 of file Property.hpp.
|
inline |
|
inlineexplicit |
The constructor which initializes the property's value to the default.
name | The name which will be used to refer to the property. |
Definition at line 104 of file Property.hpp.
|
inline |
The constructor which initializes the property's value.
name | The name which will be used to refer to the property. |
description | The description of the property. |
value | The initial value of the property (optional). |
Definition at line 117 of file Property.hpp.
|
inline |
Copy constructors copies the name, description and value as deep copies.
Definition at line 127 of file Property.hpp.
|
inline |
Create a Property mirroring another PropertyBase.
It copies the name and description, and shallow copies the value.
Definition at line 142 of file Property.hpp.
|
inline |
The constructor which initializes the property with a DataSource.
name | The name which will be used to refer to the property. |
description | The description of the property. |
datasource | A new data source to be acquired by this property for storing its data. |
Definition at line 167 of file Property.hpp.
|
inlinevirtual |
Deliver an identical clone of this PropertyBase.
The original may be deleted and the clone can be transparantly used in its place or vice versa.
Implements RTT::base::PropertyBase.
Definition at line 371 of file Property.hpp.
|
virtualinherited |
Composes the data of this property with information found in a PropertyBag.
This only works for data types that defined a compose/decompose function in their type info structure.
Definition at line 80 of file PropertyBase.cpp.
References RTT::base::PropertyBase::getDataSource(), and RTT::base::DataSourceBase::ref().
bool RTT::Property< PropertyBag >::copy | ( | const Property< PropertyBag > & | orig | ) |
Definition at line 282 of file PropertyBag.cpp.
References RTT::copyProperties(), RTT::base::PropertyBase::getDescription(), RTT::base::PropertyBase::getName(), and RTT::Property< T >::rvalue().
|
inlinevirtual |
Copy an other Property onto this property.
Copy does a full update of the name, description and value, adding extra information if necessary, or in case of a Property<PropertyBag> adding all Properties.
Copy only works on properties that are ready() and both have the same data type T.
Implements RTT::base::PropertyBase.
Definition at line 323 of file Property.hpp.
Referenced by RTT::Property< bool >::copy().
|
inline |
Copy the value, complete overwrite of this Property with orig.
Definition at line 335 of file Property.hpp.
RTT_API bool RTT::Property< PropertyBag >::copy | ( | const Property< PropertyBag > & | orig | ) |
|
inlinevirtual |
Create a new default instance of the PropertyBase.
This is a factory method to 'make something of the same type'. The new PropertyBase has the same name and description as this.
Implements RTT::base::PropertyBase.
Definition at line 376 of file Property.hpp.
|
inlinevirtual |
Create a new instance of the PropertyBase with a custom data source.
This is a factory method to 'make something of the same type'. The new PropertyBase has the same name and description as this.
Implements RTT::base::PropertyBase.
Definition at line 381 of file Property.hpp.
|
inline |
Documents this property.
descr | The description of this property |
Definition at line 228 of file Property.hpp.
|
inline |
Get a copy of the value of the property.
Definition at line 246 of file Property.hpp.
Referenced by RTT::extras::composeProperty(), RTT::types::composeTemplateProperty(), RTT::extras::decomposeProperty(), RTT::scripting::ConditionBoolProperty::evaluate(), RTT::marsh::PropertyBagIntrospector::introspect(), and RTT::marsh::XMLRPCMarshaller< output_stream >::serialize().
|
inline |
Definition at line 397 of file Property.hpp.
|
inlinevirtual |
Get an assignable base::DataSource through which this PropertyBase can be manipulated.
Implements RTT::base::PropertyBase.
Definition at line 393 of file Property.hpp.
Referenced by RTT::types::composePropertyBag(), RTT::types::TemplateCompositionFactory< bool >::decomposeType(), and RTT::updateProperties().
|
inlineinherited |
Get a description of the property.
Definition at line 100 of file PropertyBase.hpp.
Referenced by RTT::types::composePropertyBag(), RTT::Property< T >::copy(), RTT::Property< bool >::copy(), RTT::types::decomposePropertyBag(), RTT::marsh::PropertyBagIntrospector::introspect(), RTT::base::PropertyBagVisitor::introspectAndDecompose(), RTT::Property< bool >::operator=(), RTT::Property< T >::update(), RTT::Property< bool >::update(), and RTT::updateProperties().
|
inlineinherited |
Get the name of the property.
Definition at line 88 of file PropertyBase.hpp.
Referenced by RTT::ConfigurationInterface::addProperty(), RTT::types::composePropertyBag(), RTT::types::composeTemplateProperty(), RTT::Property< T >::copy(), RTT::Property< bool >::copy(), RTT::types::decomposePropertyBag(), RTT::findProperty(), RTT::flattenPropertyBag(), RTT::PropertyBag::identify(), RTT::marsh::PropertyBagIntrospector::introspect(), RTT::base::PropertyBagVisitor::introspectAndDecompose(), RTT::PropertyBag::FindPropType< T >::operator()(), RTT::operator<<(), RTT::Property< bool >::operator=(), RTT::Property< bool >::Property(), RTT::refreshProperties(), RTT::refreshProperty(), RTT::ConfigurationInterface::removeProperty(), RTT::marsh::XMLRPCMarshaller< output_stream >::serialize(), RTT::scripting::ConditionBoolProperty::toString(), RTT::updateOrRefreshProperty(), RTT::updateProperties(), RTT::updateProperty(), and RTT::scripting::ValueParser::ValueParser().
|
inlinevirtual |
Returns the type of this PropertyBase.
Uses the naming scheme of DataSourceTypeInfo.
Implements RTT::base::PropertyBase.
Definition at line 417 of file Property.hpp.
Referenced by RTT::Property< bool >::create(), and RTT::Property< bool >::Property().
|
inlinevirtual |
Returns the types::TypeInfo object of this Property.
Implements RTT::base::PropertyBase.
Definition at line 421 of file Property.hpp.
Referenced by RTT::extras::composeProperty().
|
virtual |
A call on this method will lead to a call to the PropertyBagIntrospection interface identifying this Property's proper type.
Reimplemented from RTT::base::PropertyBase.
Definition at line 53 of file Property.cpp.
References RTT::base::PropertyBagVisitor::introspect().
|
virtual |
A call on this method will lead to a call to the PropertyIntrospection interface identifying this Property's proper type.
Implements RTT::base::PropertyBase.
Definition at line 462 of file Property.hpp.
References RTT::base::PropertyIntrospection::introspect().
Referenced by RTT::Property< T >::identify(), and RTT::Property< bool >::rvalue().
|
virtual |
A call on this method will lead to a call to the PropertyBagIntrospection interface identifying this Property's proper type.
Reimplemented from RTT::base::PropertyBase.
Definition at line 468 of file Property.hpp.
References RTT::base::PropertyBase::identify(), RTT::Property< T >::identify(), and RTT_API.
|
virtual |
A call on this method will lead to a call to the PropertyBagIntrospection interface identifying this Property's proper type.
Reimplemented from RTT::base::PropertyBase.
|
static |
Use this method instead of dynamic_cast<> to cast from base::PropertyBase to Property<T>.
You need to delete the returned property if it is no longer needed.
T | The Desired property type, for example 'double'. |
prop | The property to narrow to Property<T>. |
Definition at line 451 of file Property.hpp.
Referenced by RTT::Property< bool >::rvalue().
|
inline |
Get a copy of the value of the property.
Definition at line 237 of file Property.hpp.
|
inline |
Update the value of this property with another property.
Definition at line 217 of file Property.hpp.
|
inline |
Set the property's value.
value | The value to be set. |
Definition at line 181 of file Property.hpp.
|
inlinevirtual |
Mirror another PropertyBase (name, description and value).
source | A pointer to the property to mirror. |
Implements RTT::base::PropertyBase.
Definition at line 191 of file Property.hpp.
|
inlineinherited |
Inspect if this Property is correctly initialised and ready for usage.
A Property may only be used when ready() returns true, otherwise, an exception is thrown.
Definition at line 114 of file PropertyBase.hpp.
Referenced by RTT::PropertyBag::addProperty(), RTT::ConfigurationInterface::addProperty(), RTT::types::composePropertyBag(), RTT::Property< bool >::copy(), RTT::types::decomposePropertyBag(), RTT::findProperty(), RTT::PropertyBag::findValue(), RTT::PropertyBag::ownProperty(), RTT::Property< bool >::refresh(), RTT::removeProperty(), and RTT::Property< bool >::update().
bool RTT::Property< PropertyBag >::refresh | ( | const Property< PropertyBag > & | orig | ) |
Definition at line 274 of file PropertyBag.cpp.
References RTT::refreshProperties(), and RTT::Property< T >::rvalue().
|
inlinevirtual |
Refresh the value of this Property with the value of an other Property.
Refresh does only the minimal update of the value, not adding extra information, or in case of a Property<PropertyBag> not adding extra Properties.
Refresh only works on properties that are ready() and both have the same data type T.
Implements RTT::base::PropertyBase.
Definition at line 314 of file Property.hpp.
Referenced by RTT::Property< bool >::refresh().
|
inline |
Refresh only the value from a Property.
This is a real-time operation.
Definition at line 363 of file Property.hpp.
RTT_API bool RTT::Property< PropertyBag >::refresh | ( | const Property< PropertyBag > & | orig | ) |
|
inline |
Read-only (const&) access to the value of the Property.
Definition at line 285 of file Property.hpp.
Referenced by RTT::Property< T >::copy(), RTT::Property< bool >::copy(), RTT::types::decomposePropertyBag(), RTT::findProperty(), RTT::Property< T >::refresh(), RTT::Property< bool >::refresh(), RTT::refreshProperty(), RTT::Property< T >::update(), RTT::Property< bool >::update(), and RTT::updateProperty().
|
inline |
Access to the value of the Property.
Identical to value().
Definition at line 257 of file Property.hpp.
Referenced by RTT::scripting::PropertyParser::reset().
|
inline |
Set the value of the Property.
Definition at line 265 of file Property.hpp.
|
inlinevirtual |
Assign an external assignable base::DataSource to this property.
dsb | The other data source |
Implements RTT::base::PropertyBase.
Definition at line 406 of file Property.hpp.
Referenced by RTT::Property< bool >::operator=(), and RTT::Property< bool >::Property().
|
inherited |
Set the description of the property.
desc | The description of the property. |
Definition at line 64 of file PropertyBase.cpp.
References RTT::base::PropertyBase::_description.
Referenced by RTT::Property< bool >::doc(), and RTT::Property< bool >::operator=().
|
inherited |
Set the name of the property.
name | The name of the property. |
Definition at line 59 of file PropertyBase.cpp.
References RTT::base::PropertyBase::_name.
Referenced by RTT::ConfigurationInterface::addProperty(), and RTT::Property< bool >::operator=().
bool RTT::Property< PropertyBag >::update | ( | const Property< PropertyBag > & | orig | ) |
Definition at line 264 of file PropertyBag.cpp.
References RTT::base::PropertyBase::getDescription(), RTT::Property< T >::rvalue(), and RTT::updateProperties().
|
inlinevirtual |
Update the value of this Property with the value of an other Property.
Update does a full update of the value, adding extra information if necessary, or in case of a Property<PropertyBag> adding missing Properties.
Update only works on properties that are ready() and both have the same data type T.
Implements RTT::base::PropertyBase.
Definition at line 305 of file Property.hpp.
Referenced by RTT::Property< bool >::operator<<=(), and RTT::Property< bool >::update().
|
inline |
Update the value, optionally also the description if current description is empty.
Definition at line 349 of file Property.hpp.
RTT_API bool RTT::Property< PropertyBag >::update | ( | const Property< PropertyBag > & | orig | ) |
Partial specialisations in case of PropertyBag.
|
inline |
Access to the value of the Property.
Identical to set().
Definition at line 277 of file Property.hpp.
Referenced by RTT::types::composePropertyBag(), RTT::Property< bool >::create(), RTT::extras::decomposeProperty(), RTT::types::decomposePropertyBag(), RTT::types::TemplateCompositionFactory< bool >::decomposeType(), RTT::deletePropertyBag(), RTT::findProperty(), RTT::PropertyBag::findValue(), RTT::flattenPropertyBag(), RTT::marsh::PropertyBagIntrospector::introspect(), RTT::refreshProperty(), RTT::removeProperty(), RTT::marsh::Tiny2CPFHandler::startElement(), RTT::storeProperty(), RTT::updateProperties(), and RTT::updateProperty().
|
protectedinherited |
A lengthy description for this PropertyBase.
Definition at line 228 of file PropertyBase.hpp.
Referenced by RTT::Property< bool >::copy(), RTT::Property< bool >::create(), RTT::base::PropertyBase::setDescription(), and RTT::Property< bool >::update().
|
protectedinherited |
A short name for this PropertyBase.
Definition at line 223 of file PropertyBase.hpp.
Referenced by RTT::Property< bool >::copy(), RTT::Property< bool >::create(), and RTT::base::PropertyBase::setName().
|
protected |
Definition at line 425 of file Property.hpp.
Referenced by RTT::Property< bool >::copy(), RTT::Property< bool >::get(), RTT::Property< bool >::getAssignableDataSource(), RTT::Property< bool >::getDataSource(), RTT::Property< bool >::operator value_t(), RTT::Property< bool >::operator=(), RTT::Property< bool >::Property(), RTT::Property< bool >::refresh(), RTT::Property< bool >::rvalue(), RTT::Property< bool >::set(), RTT::Property< bool >::setDataSource(), and RTT::Property< bool >::update().