RTT::AttributeRepository Class Reference

A class for keeping track of Attribute, Constant and Property objects of a TaskContext. More...

#include <rtt/AttributeRepository.hpp>

List of all members.

Public Types

typedef std::vector< std::string > AttributeNames
 A vector containing the names of all attribute objects in this repository.
typedef std::vector
< AttributeBase * > 
AttributeObjects
 A vector containing pointers to all attribute objects stored in this repository.

Public Member Functions

 AttributeRepository ()
 Create an empty AttributeRepository.
void clear ()
 Erases the whole repository.
bool hasAttribute (const std::string &name) const
 Check if an attribute is present in this interface.
bool addAttribute (AttributeBase *a)
 Add an AttributeBase which remains owned by the user.
template<class T >
Attribute< T > * getAttribute (const std::string &name) const
void removeAttribute (const std::string &name)
 Remove an attribute from the repository.
bool addConstant (AttributeBase *c)
 Add a Constant with a given value.
template<class T >
Constant< T > * getConstant (const std::string &name) const
bool hasProperty (const std::string &name) const
 Check if a property is present.
bool addProperty (PropertyBase *pb)
 Add an PropertyBase as a property.
bool removeProperty (PropertyBase *p)
 Remove a previously added Property and associated attribute.
bool setValue (AttributeBase *ab)
 Transfer the ownership of an attribute to the repository.
AttributeBasegetValue (const std::string &name) const
bool removeValue (const std::string &name)
 Delete a value added with setValue from the repository.
template<class T >
bool addDataObject (DataObjectInterface< T > *doi)
 Add a DataObject as an Attribute.
AttributeRepositorycopy (std::map< const DataSourceBase *, DataSourceBase * > &repl, bool instantiate) const
 Return a new copy of this repository with the copy operation semantics.
AttributeNames names () const
 Return the names of all attributes.
AttributeNames getAttributes () const
 Return the names of all attributes in this repository.
PropertyBagproperties () const
 Return a bag of all properties.

Detailed Description

A class for keeping track of Attribute, Constant and Property objects of a TaskContext.

It allows to store objects of these types and retrieve this type. It is used by the script parsers to browse the attributes and properties of a TaskContext.

Definition at line 55 of file AttributeRepository.hpp.


Member Function Documentation

bool RTT::AttributeRepository::addAttribute ( AttributeBase a  )  [inline]

Add an AttributeBase which remains owned by the user.

Parameters:
a remains owned by the user, and becomes served by the repository.

Definition at line 92 of file AttributeRepository.hpp.

bool RTT::AttributeRepository::addConstant ( AttributeBase c  )  [inline]

Add a Constant with a given value.

See also:
getConstant

Definition at line 122 of file AttributeRepository.hpp.

template<class T >
bool RTT::AttributeRepository::addDataObject ( DataObjectInterface< T > *  doi  )  [inline]

Add a DataObject as an Attribute.

This is especially useful to add the thread-safe DataObjects as thread-safe attributes. You can retrieve it through getValue().

Parameters:
doi The DataObject, which remains owned by the user.
Returns:
true if doi->getName() is unique within this repository.

Definition at line 190 of file AttributeRepository.hpp.

bool RTT::AttributeRepository::addProperty ( PropertyBase pb  ) 

Add an PropertyBase as a property.

Returns:
false if a property with the same name already exists.
See also:
removeProperty
AttributeRepository* RTT::AttributeRepository::copy ( std::map< const DataSourceBase *, DataSourceBase * > &  repl,
bool  instantiate 
) const

Return a new copy of this repository with the copy operation semantics.

Parameters:
instantiate set to true if you want a copy which will upon any future copy return the same DataSources, thus 'fixating' or 'instantiating' the DataSources.
See also:
CommandInterface
Note:
this does not copy the properties() within this repository.
AttributeNames RTT::AttributeRepository::names (  )  const

Return the names of all attributes.

Deprecated:
by getAttributes()
PropertyBag* RTT::AttributeRepository::properties (  )  const

Return a bag of all properties.

Returns:
null if none present.
Deprecated:
Properties should no longer be used as a part of the AttributeRepository, but accessed using TaskContext::properties().
bool RTT::AttributeRepository::removeProperty ( PropertyBase p  ) 

Remove a previously added Property and associated attribute.

Returns:
false if no such property by that name exists.
bool RTT::AttributeRepository::setValue ( AttributeBase ab  ) 

Transfer the ownership of an attribute to the repository.

Parameters:
ab The attribute which becomes owned by this repository.
Returns:
false if an Attribute with the same name already present.

The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:39 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3