Load and save properties of a TaskContext. More...
#include <rtt/MarshallingAccess.hpp>
Public Member Functions | |
MarshallingAccess (TaskContext *parent) | |
This object is normally created by a TaskContext. | |
bool | loadProperties (const std::string &filename) const |
Read a property file and update (or create any missing) properties in the TaskContext. | |
bool | storeProperties (const std::string &filename) const |
Stores all properties of a TaskContext in a new file or overwrite an existing one. | |
bool | readProperties (const std::string &filename) const |
Read the property file and 'refresh' all the properties of the TaskContext. | |
bool | updateProperties (const std::string &filename) const |
Read the property file and 'refresh' some properties of the TaskContext. | |
bool | readProperty (const std::string &name, const std::string &filename) |
Read a single property from a file. | |
bool | writeProperties (const std::string &filename) const |
Write the property file with the properties of a TaskContext. | |
bool | updateFile (const std::string &filename) const |
Write the property file with the properties of a TaskContext, which are already present in filename. | |
bool | writeProperty (const std::string &name, const std::string &filename) |
Write a single property to a file. |
Load and save properties of a TaskContext.
Definition at line 53 of file MarshallingAccess.hpp.
bool RTT::MarshallingAccess::loadProperties | ( | const std::string & | filename | ) | const |
Read a property file and update (or create any missing) properties in the TaskContext.
This function allows to dynamically add properties to a component. This can be useful in combination with Orocos scripts when the script requires additional properties from the parent TaskContext.
bool RTT::MarshallingAccess::readProperties | ( | const std::string & | filename | ) | const |
Read the property file and 'refresh' all the properties of the TaskContext.
There may be more properties in the file than properties in the TaskContext, but all properties of the TaskContext must be present in filename. In case a type mismatch occurs, this method will fail and update no properties.
filename | The file to read from. |
bool RTT::MarshallingAccess::readProperty | ( | const std::string & | name, | |
const std::string & | filename | |||
) |
Read a single property from a file.
The name may be a 'path' like location of a Property in the hierarchy.
name | The name of the property in the file. For example "MyProp" for a top-level property or "Settings.XML.Editor" to specify a dot-separated 'path' to the property 'Editor'. | |
filename | The name of the file in which to lookup name. |
bool RTT::MarshallingAccess::storeProperties | ( | const std::string & | filename | ) | const |
Stores all properties of a TaskContext in a new file or overwrite an existing one.
The file given in filename will always be overwritten and any existing content will be lost.
filename | The file to store to. |
bool RTT::MarshallingAccess::updateFile | ( | const std::string & | filename | ) | const |
Write the property file with the properties of a TaskContext, which are already present in filename.
No new entries are created in the file, only existing ones are updated. The file is first read in, the resulting tree is updated with the task's properties, and then written to disk again.
filename | The file to read from and write to. |
bool RTT::MarshallingAccess::updateProperties | ( | const std::string & | filename | ) | const |
Read the property file and 'refresh' some properties of the TaskContext.
There may be more properties in the file than properties in the TaskContext, and some may be missing in the file. This method will update 'as much as possible' properties. In case a type mismatch occurs, this method will fail and update no properties.
filename | The file to read all the properties from. |
bool RTT::MarshallingAccess::writeProperties | ( | const std::string & | filename | ) | const |
Write the property file with the properties of a TaskContext.
The file is first read in, the resulting tree is updated with the task's properties and then written to disk again. This allows to share files between tasks.
filename | The file to read from and write to (updating). |
bool RTT::MarshallingAccess::writeProperty | ( | const std::string & | name, | |
const std::string & | filename | |||
) |
Write a single property to a file.
The name may be a 'path' like location of a Property in the hierarchy.
name | The name of the property in the file. For example "MyProp" for a top-level property or "Settings.XML.Editor" to specify a dot-separated 'path' to the property 'Editor'. | |
filename | The name of the file in which to write name. |