Classes |
class | RTT::ConfigurationInterface |
| A class for keeping track of Attribute, Constant and Property objects of a TaskContext. It allows plugins and remote components to browse the attributes and properties of a TaskContext. More...
|
class | RTT::Property< T > |
| A property represents a named value of any type with a description. More...
|
class | RTT::PropertyBag |
| A container for holding references to properties. More...
|
Modules |
| Recursive Property Bag Operations. |
Functions |
bool | RTT::copyProperties (PropertyBag &target, const PropertyBag &source) |
void | RTT::deleteProperties (PropertyBag &target) |
void | RTT::deletePropertyBag (PropertyBag &target) |
PropertyBase * | RTT::findProperty (const PropertyBag &bag, const std::string &nameSequence, const std::string &separator) |
void | RTT::flattenPropertyBag (PropertyBag &target, const std::string &separator) |
vector< string > | RTT::listProperties (const PropertyBag &source, const std::string &separator) |
vector< string > | RTT::listPropertyDescriptions (const PropertyBag &source, const std::string &separator) |
bool | RTT::refreshProperties (const PropertyBag &target, const PropertyBag &source, bool allprops) |
bool | RTT::refreshProperty (PropertyBag &target, const PropertyBag &source, const std::string &name, const std::string &separator) |
bool | RTT::refreshProperty (const PropertyBag &target, const PropertyBase &source) |
bool | RTT::removeProperty (PropertyBag &bag, const std::string &path, const std::string &separator) |
bool | RTT::storeProperty (PropertyBag &bag, const std::string &path, base::PropertyBase *item, const std::string &separator) |
bool | RTT::updateProperties (PropertyBag &target, const PropertyBag &source) |
bool | RTT::updateProperty (PropertyBag &target, const PropertyBag &source, const std::string &name, const std::string &separator) |
Detailed Description
Properties can be hierarchically stored and be introspected for their type and contents. Properties can be (de-)serialised using Marshallers and Demarshallers.
Function Documentation
RTT_API bool RTT::copyProperties |
( |
PropertyBag & |
target, |
|
|
const PropertyBag & |
source | |
|
) |
| | |
This function copies (recursively) the Properties of one Bag into another Bag. This may cause duplicate entries in target if source contains Properties with the same name. Use updateProperties to avoid duplicates and update exiting Properties.
- Parameters:
-
| target | The bag in which the properties must be copied. |
| source | The bag containing properties for target. |
RTT_API void RTT::deleteProperties |
( |
PropertyBag & |
target |
) |
|
This function iterates over a PropertyBag and deletes all Property objects in it without recursion. This function respects ownership, that is, it deletes the properties that are not owned by target and simply removes properties which are owned by target, such that target can do the cleanup.
- Postcondition:
- All objects in this bag are deleted and no elements reside in the bag anymore.
RTT_API void RTT::deletePropertyBag |
( |
PropertyBag & |
target |
) |
|
This function iterates over a PropertyBag and recursively deletes all Property objects. This function respects ownership, that is, it deletes the properties that are not owned by target and simply removes properties which are owned by target, such that target can do the cleanup.
- Postcondition:
- All objects in this bag (and possible subbags) are deleted and no elements reside in the bag anymore.
RTT_API base::PropertyBase * RTT::findProperty |
( |
const PropertyBag & |
bag, |
|
|
const std::string & |
path, |
|
|
const std::string & |
separator = std::string(".") | |
|
) |
| | |
This function locates a Property in nested PropertyBags.
- Parameters:
-
| bag | The bag to look for a Property. |
| path | A sequence of names, separated by separator indicating the path in the bag to a property, omitting the name of the bag itself. |
| separator | The token to separate properties in the path, Defaults to ".". |
RTT_API void RTT::flattenPropertyBag |
( |
PropertyBag & |
target, |
|
|
const std::string & |
separator = "." | |
|
) |
| | |
This function flattens a PropertyBag recursively. The names of the Propety objects of the included bags are placed in this bag with the included bag's name prefixed. If the Property object in that bag is also a bag, the same operation is performed recursively. So any bag in target will show up at the root of target with the path prefixed.
RTT_API std::vector< std::string > RTT::listProperties |
( |
const PropertyBag & |
source, |
|
|
const std::string & |
separator | |
|
) |
| | |
List all properties in a PropertyBag in a single list. The returned list has the form 'item1'...'subbag.subsubbag.itemN', where item1 is a property in bag, subbag is a bag inside bag and subsubbag is a bag in subbag. And so on.
- Parameters:
-
| bag | The bag to list the properties of. |
| separator | The token to separate properties in the path, Defaults to ".". |
RTT_API std::vector< std::string > RTT::listPropertyDescriptions |
( |
const PropertyBag & |
bag, |
|
|
const std::string & |
separator = std::string(".") | |
|
) |
| | |
List all descriptions of properties in a PropertyBag in a single list. The returned list has the same number of items returned by listProperties(bag) and matches its descriptions 1-to-1 with it.
- Parameters:
-
| bag | The bag to list the property descriptions of. |
| separator | The token to separate properties in the path, Defaults to ".". |
RTT_API bool RTT::refreshProperties |
( |
const PropertyBag & |
target, |
|
|
const PropertyBag & |
source, |
|
|
bool |
strict = false | |
|
) |
| | |
This function refreshes the values of the properties in one PropertyBag with the values of the properties of another PropertyBag. No new properties will be created.
You can use this function to update the properties of a fixed bag.
- Parameters:
-
| target | The bag in which the properties must be refreshed. |
| source | The bag containing new values for target. |
| strict | Set to true if each property of target must be updated with a property of source. If a property from target is not present in source, this function returns false. |
RTT_API bool RTT::refreshProperty |
( |
PropertyBag & |
target, |
|
|
const PropertyBag & |
source, |
|
|
const std::string & |
path, |
|
|
const std::string & |
separator = "." | |
|
) |
| | |
This function refreshes (recursively) the values of a single Property object of one Bag with the property of another bag. It will not create a new Property instances if the Property is not present in the target and hence fail in that case.
- Parameters:
-
| target | The bag in which the property exists and must be refreshed. |
| source | The bag containing prop as one of its children. |
| path | The path to a property in source (or in a sub-bag of source), which must be created or updated in target. |
| separator | The token to separate properties in the path, |
RTT_API bool RTT::refreshProperty |
( |
const PropertyBag & |
target, |
|
|
const base::PropertyBase & |
source | |
|
) |
| | |
Refresh one Property in the target bag with the new value.
- Parameters:
-
| target | The bag in which a property with name source->getName() can be found. |
| source | A property which contains a new value for a property with the same name in target. |
RTT_API bool RTT::removeProperty |
( |
PropertyBag & |
bag, |
|
|
const std::string & |
path, |
|
|
const std::string & |
separator = std::string(".") | |
|
) |
| | |
RTT_API bool RTT::storeProperty |
( |
PropertyBag & |
bag, |
|
|
const std::string & |
path, |
|
|
base::PropertyBase * |
item, |
|
|
const std::string & |
separator = std::string(".") | |
|
) |
| | |
Stores a property in a bag given a certain path with transfer of ownership. This allows you to store a property directly in (nested) subbags, instead of browsing manually to the required level and then calling PropertyBag::ownProperty().
- See also:
- PropertyBag::ownProperty()
RTT_API bool RTT::updateProperties |
( |
PropertyBag & |
target, |
|
|
const PropertyBag & |
source | |
|
) |
| | |
This function updates (recursively) the values of Property objects of one Bag with the values of Property objects of another bag. It creates new Property instances if a Property is not present in the target and updates existing Properties.
Use copyProperties if you want complete duplication.
- Parameters:
-
| target | The bag in which the properties must be updated. |
| source | The bag containing new values, descriptions or properties for target. |
RTT_API bool RTT::updateProperty |
( |
PropertyBag & |
target, |
|
|
const PropertyBag & |
source, |
|
|
const std::string & |
path, |
|
|
const std::string & |
separator = "." | |
|
) |
| | |
This function updates (recursively) the values of a single Property object of one Bag with the property of another bag. It creates a new Property instances if the Property is not present in the target and updates existing Properties.
Use copyProperties if you want complete duplication.
- Parameters:
-
| target | The bag in which the property must be updated. |
| source | The bag containing prop as one of its children. |
| path | The path to a property in source (or in a sub-bag of source), which must be created or updated in target. |
| separator | The token to separate properties in the path, |