Properties can be hierarchically stored and be introspected for their type and contents. More...
Classes | |
class | RTT::Marshaller |
A Marshaller converts Property objects to a (file/text) format. More... | |
class | RTT::Demarshaller |
An interface for extracting properties from a format. 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... | |
Functions | |
RTT_API PropertyBase * | RTT::findProperty (const PropertyBag &bag, const std::string &path, const std::string &separator=std::string(".")) |
This function locates a Property in nested PropertyBags. | |
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. | |
RTT_API bool | RTT::refreshProperty (const PropertyBag &target, const PropertyBase &source) |
Refresh one Property in the target bag with the new value. | |
RTT_API bool | RTT::copyProperties (PropertyBag &target, const PropertyBag &source) |
This function copies (recursively) the Properties of one Bag into another Bag. | |
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. | |
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. | |
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. | |
RTT_API void | RTT::deleteProperties (PropertyBag &target) |
This function iterates over a PropertyBag and deletes all Property objects in it without recursion. | |
RTT_API void | RTT::deletePropertyBag (PropertyBag &target) |
This function iterates over a PropertyBag and recursively deletes all Property objects. | |
RTT_API void | RTT::flattenPropertyBag (PropertyBag &target, const std::string &separator=".") |
This function flattens a PropertyBag recursively. |
Properties can be hierarchically stored and be introspected for their type and contents.
Properties can be (de-)serialised using Marshallers and Demarshallers.
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.
target | The bag in which the properties must be copied. | |
source | The bag containing properties for target. |
Referenced by RTT::copy().
RTT_API void RTT::deleteProperties | ( | PropertyBag & | target | ) |
This function iterates over a PropertyBag and deletes all Property objects in it without recursion.
Referenced by RTT::PropertyBagIntrospector::introspect().
RTT_API void RTT::deletePropertyBag | ( | PropertyBag & | target | ) |
This function iterates over a PropertyBag and recursively deletes all Property objects.
RTT_API PropertyBase* RTT::findProperty | ( | const PropertyBag & | bag, | |
const std::string & | path, | |||
const std::string & | separator = std::string(".") | |||
) |
This function locates a Property in nested PropertyBags.
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 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.
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. |
Referenced by RTT::update().
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.
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 PropertyBase & | source | |||
) |
Refresh one Property in the target bag with the new value.
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::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.
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.
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, |