41 #include "../TaskContext.hpp" 42 #include "../plugin/ServicePlugin.hpp" 45 #if !defined(ORO_EMBEDDED) 46 #include "../OperationCaller.hpp" 54 using namespace detail;
58 parent->
provides()->addService( sp );
63 :
Service(
"marshalling", parent)
65 this->
doc(
"Property marshalling interface. Use this service to read and write properties from/to a file.");
67 .doc(
"Read, and create if necessary, Properties from a file.")
68 .arg(
"Filename",
"The file to read the (new) Properties from.");
71 .doc(
"Store properties in a file and overwrite any existing content.")
72 .arg(
"Filename",
"The file to write the Properties to.");
75 .doc(
"Read all Properties from a file. Returns false if one or more properties are missing or have a wrong type in that file.").arg(
"Filename",
"The file to read the Properties from.");
77 .doc(
"Read a single Property from a file.").arg(
"Name",
"The name of (or the path to) the property to read.").arg(
"Filename",
"The file to read the Properties from.");
80 .doc(
"Read some Properties from a file. Updates only matching properties. Returns false upon type mismatch.")
81 .arg(
"Filename",
"The file to read the Properties from.");
83 .doc(
"Write some Properties to a file, ie, only the ones that are already present in the file.").arg(
"Filename",
"The file to write the Properties to.");
86 .doc(
"Write all Properties to a file, but keep existing ones in that file.").arg(
"Filename",
"The file to write the Properties to.");
88 .doc(
"Write a single Property to a file and keep existing ones in that file.").arg(
"Name",
"The name of (or the path to) the property to write.").arg(
"Filename",
"The file to write the Properties to.");
91 .doc(
"Read, and create if necessary, Properties from a file.")
92 .arg(
"Filename",
"The file to read the (new) Properties from.")
93 .arg(
"Servicename",
"The Service to load the (new) Properties to.");
95 .doc(
"Store properties in a file and overwrite any existing content.")
96 .arg(
"Filename",
"The file to write the Properties to.")
97 .arg(
"Servicename",
"The Service store the Properties of.");
100 .doc(
"Read all Properties from a file. Returns false if one or more properties are missing or have a wrong type in that file.")
101 .arg(
"Filename",
"The file to read the Properties from.")
102 .arg(
"Servicename",
"The Service to load the Properties to.");
104 .doc(
"Read a single Property from a file.")
105 .arg(
"Name",
"The name of (or the path to) the property to read.")
106 .arg(
"Filename",
"The file to read the Property from.")
107 .arg(
"Servicename",
"The Service to load the Property to.");
110 .doc(
"Read some Properties from a file. Updates only matching properties. Returns false upon type mismatch.")
111 .arg(
"Filename",
"The file to read the Properties from.")
112 .arg(
"Servicename",
"The Service to update the Properties of.");
115 .doc(
"Write some Properties to a file, ie, only the ones that are already present in the file.")
116 .arg(
"Filename",
"The file to write the Properties to.")
117 .arg(
"Servicename",
"The Service to update the Properties of.");
120 .doc(
"Write all Properties to a file, but keep existing ones in that file.")
121 .arg(
"Filename",
"The file to write the Properties to.")
122 .arg(
"Servicename",
"The Service to write the Properties of.");
125 .doc(
"Write a single Property to a file and keep existing ones in that file.")
126 .arg(
"Name",
"The name of (or the path to) the property to write.")
127 .arg(
"Filename",
"The file to write the Properties to.")
128 .arg(
"Servicename",
"The Service to write the Property of.");
135 return pl.
load( filename );
141 return pl.
store( filename );
157 return pl.
save( filename,
true);
162 return pl.
save( filename,
false);
172 return pl.
save(filename, name);
180 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
184 return pl.
load( filename );
191 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
195 return pl.
store( filename );
202 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
212 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
222 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
226 return pl.
save( filename,
true);
232 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
236 return pl.
save( filename,
false);
242 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
252 log(
Error)<<this->
getParent()->getName()<<
" does not have a service called "<<servicename<<endlog();
256 return pl.
save(filename, name);
const std::string & getName() const
Returns the name of this service instance.
bool readServiceProperties(const std::string &filename, const std::string &servicename) const
Read the property file and 'refresh' all the properties of a Service.
bool updateServiceProperties(const std::string &filename, const std::string &servicename) const
Read the property file and 'refresh' some properties of the Service.
Service::shared_ptr provides()
Returns this Service, unless no shared_ptr yet exists.
bool writeProperties(const std::string &filename) const
Write the property file with the properties of a TaskContext.
Service::shared_ptr provides()
Returns this Service.
bool configure(const std::string &filename, bool all=true) const
Read the XML cpf file and 'refresh' the matching properties of the given Service. ...
bool loadServiceProperties(const std::string &filename, const std::string &servicename) const
Read a property file and update (or create any missing) properties of a Service.
bool updateServiceFile(const std::string &filename, const std::string &servicename) const
Write the property file with the properties of a Service, which are already present in filename...
bool load(const std::string &filename) const
Read the XML cpf file and create (or refresh the matching properties) of the given Service...
#define ORO_SERVICE_NAMED_PLUGIN(SERVICE, NAME)
You can use this macro to make any Service available as a plugin.
Operation< Signature > & addOperation(Operation< Signature > &op)
Add an operation object to the interface.
shared_ptr getParent() const
The parent is the direct parent of this service.
bool updateProperties(const std::string &filename) const
Read the property file and 'refresh' some properties of the TaskContext.
bool writeServiceProperties(const std::string &filename, const std::string &servicename) const
Write the property file with the properties of a Service.
Load and save property files to a Service's PropertyBag.
This class allows storage and retrieval of operations, ports, attributes and properties provided by a...
Service which loads and saves properties of a TaskContext.
bool save(const std::string &filename, bool all=true) const
Write the XML cpf file with the properties of the given Service.
bool loadProperties(const std::string &filename) const
Read a property file and update (or create any missing) properties in the TaskContext.
bool writeProperty(const std::string &name, const std::string &filename)
Write a single property to a file.
const std::string & doc() const
Returns a descriptive text for this service.
bool hasService(const std::string &service_name)
Check if this service has the sub-service service_name.
bool store(const std::string &filename) const
Stores all properties of a Service in a new file or overwrite an existing one.
bool readProperty(const std::string &name, const std::string &filename)
Read a single property from a file.
bool storeServiceProperties(const std::string &filename, const std::string &servicename) const
Stores all properties of a Service in a new file or overwrite an existing one.
Notify the Logger in which 'module' the message occured.
bool readServiceProperty(const std::string &name, const std::string &filename, const std::string &servicename)
Read a single property from a file.
The TaskContext is the C++ representation of an Orocos component.
bool updateFile(const std::string &filename) const
Write the property file with the properties of a TaskContext, which are already present in filename...
bool writeServiceProperty(const std::string &name, const std::string &filename, const std::string &servicename)
Write a single property to a file.
bool readProperties(const std::string &filename) const
Read the property file and 'refresh' all the properties of the TaskContext.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
bool storeProperties(const std::string &filename) const
Stores all properties of a TaskContext in a new file or overwrite an existing one.
boost::shared_ptr< MarshallingService > shared_ptr