39 #ifndef RTT_CONFIGURATIONINTERFACE_HPP 40 #define RTT_CONFIGURATIONINTERFACE_HPP 90 bool hasAttribute(
const std::string& name )
const;
102 if ( !chkPtr(
"addAttribute", name, &attr) )
return false;
104 return this->addAttribute( a );
116 if ( !chkPtr(
"addAttribute", name, &attr) )
return attr;
121 this->addAttribute( attr );
122 assert(attr.
ready());
136 if ( !chkPtr(
"addConstant", name, &cnst) )
return false;
138 return this->addAttribute( a );
151 if ( !chkPtr(
"addConstant", name, &cnst) )
return cnst;
156 this->addConstant( cnst );
157 assert(cnst.
ready());
173 return this->properties()->addProperty( name, prop );
185 if ( !chkPtr(
"addProperty", name, &prop) )
return prop;
190 this->properties()->addProperty( prop );
191 assert(prop.
ready());
206 if ( !chkPtr(
"addAttribute",
"AttributeBase", &a) )
return false;
220 return this->getValue( name );
226 void removeAttribute(
const std::string& name );
247 return this->getValue( name );
253 bool hasProperty(
const std::string& name )
const;
277 return bag.find(name);
301 bool removeValue(
const std::string& name );
310 ConfigurationInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& repl,
bool instantiate )
const;
315 void loadValues( AttributeObjects
const& new_values);
327 AttributeNames getAttributeNames()
const;
335 bool chkPtr(
const std::string &where,
const std::string& name,
const void* ptr);
336 typedef std::vector<base::AttributeBase*>
map_t;
bool ready() const
Inspect if this Property is correctly initialised and ready for usage.
bool addAttribute(base::AttributeBase &a)
Add an base::AttributeBase which remains owned by the user.
virtual AttributeBase * clone() const =0
Returns a clone of this AttributeBase.
Constant< T > & addConstant(const std::string &name, Constant< T > &cnst)
Adds an existing constant object to the configuration interface.
Base class for all properties.
A DataSource which is used to manipulate a reference to an external value.
bool addConstant(base::AttributeBase &c)
Add a Constant with a given value.
A DataSource which is used to read a const reference to an external value.
A container for holding references to properties.
virtual DataSourceBase::shared_ptr getDataSource() const =0
Return a internal::DataSource which contains the same contents.
std::vector< base::AttributeBase * > map_t
std::vector< std::string > AttributeNames
A vector containing the names of all attribute objects in this repository.
An attribute is a minimalistic, named placeholder for data.
AttributeObjects const & getValues() const
Returns all attributes in this repository.
base::PropertyBase * getProperty(const std::string &name) const
Get a Property with name name.
A property represents a named value of any type with a description.
base::AttributeBase * getAttribute(const std::string &name) const
This class is used to return a 'default' value when no value is available ('Not Available').
A class for keeping track of Attribute, Constant and Property objects of a TaskContext.
void setName(const std::string &name)
Set the name of the property.
Property< T > & addProperty(const std::string &name, T &prop)
Adds a variable of any type as a property to the configuration interface.
bool ready() const
Returns true if the Attribute was correctly initialised.
bool removeProperty(PropertyBag &bag, const std::string &path, const std::string &separator)
Removes a property from a bag given a certain path.
Property< T > & addProperty(const std::string &name, Property< T > &prop)
Adds an existing property object to the configuration interface.
bool addConstant(const std::string &name, const T &cnst)
Adds a variable of any type as read-only attribute to the configuration interface.
std::vector< base::AttributeBase * > AttributeObjects
A vector containing pointers to all attribute objects stored in this repository.
base::AttributeBase * getConstant(const std::string &name) const
std::vector< typename MapT::mapped_type > values(const MapT &map)
An Attribute has a name and contains data which can be set and get.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
As opposed to a Attribute, a Constant can not be assigned to a new value after creation.
This class is the most basic Attribute implementation (only suitable for reading a internal::DataSour...
void setName(std::string const &new_name)
Get the name of this instance.
Attribute< T > & addAttribute(const std::string &name, Attribute< T > &attr)
Adds an existing attribute object to the configuration interface.
bool addAttribute(const std::string &name, T &attr)
Adds a variable of any type as read/write attribute to the configuration interface.