RTT::PropertySequence< T > Class Template Reference

A container for a sequence of properties of the same type Property<T> [EXPERIMENTAL]. More...

#include <rtt/PropertySequence.hpp>

List of all members.

Classes

struct  FindProp
 A function object for finding a Property by name. More...

Public Types

typedef std::vector< T * > PropertyContainerType
typedef
PropertyContainerType::iterator 
iterator
typedef
PropertyContainerType::const_iterator 
const_iterator

Public Member Functions

 PropertySequence ()
 The default constructor.
 PropertySequence (const std::string &_type)
 The typed constructor.
 PropertySequence (const PropertySequence< T > &orig)
 The copy constructor.
void add (T *p)
 Add a property to the container.
void remove (T *p)
 Remove a property from the container.
void clear ()
 Removes all PropertyBases from this sequence, without deleting them.
void list (std::vector< std::string > &names) const
 List all properties.
T * find (const std::string &name) const
 Find the PropertyBase with name name.
PropertySequence< T > & operator= (const PropertySequence< T > &orig)
 This assignment assigns all PropertyBases of another sequence in this sequence, making an exact copy or the original.
PropertySequence< T > & operator<<= (const PropertySequence< T > &source)
 The update operator.
const std::string & getType () const
const PropertyContainerType & getProperties () const

Protected Attributes

PropertyContainerType _properties
const std::string type

Detailed Description

template<class T>
class RTT::PropertySequence< T >

A container for a sequence of properties of the same type Property<T> [EXPERIMENTAL].

This class groups properties of equal types into a single container. It is used for optimised access to fixed type contents. It is thus very much like a vector.

A PropertySequence object can handed to a Marshaller object which will serialize the contents of the PropertySequence.

All operations on a PropertySequence are non recursive. The PropertySequence itself is not aware of the possible hierarchical structure. You need to use the global scope functions for handling hierarchical structures.

A PropertySequence is not the owner of the properties within. It defines a group of properties, nothing more. When this group of properties contains another PropertySequence, this sequence is considered as a 'pointer' to other properties. Even such a sequence is not owned by the PropertySequence.

Constructing PropertySequences. It can happen in an application that a PropertySequence is filled with dynamically created Property objects. The sequence is not responsible for cleaning up these objects once they are no longer needed. The application which uses the PropertySequence has to find a way of deleting the possible dangling pointers.

The elements in a PropertySequence are unordered. Operations on the sequence may change the relative order of the elements.

See also:
PropertyBag
Parameters:
T The type of the sequence.
Note:
THIS CLASS IS EXPERIMENTAL AND SHOULD NOT BE USED BY THE UNWARY

Definition at line 84 of file PropertySequence.hpp.


Constructor & Destructor Documentation

template<class T>
RTT::PropertySequence< T >::PropertySequence ( const std::string &  _type  )  [inline]

The typed constructor.

Parameters:
type The type of PropertySequence.

Definition at line 103 of file PropertySequence.hpp.

template<class T>
RTT::PropertySequence< T >::PropertySequence ( const PropertySequence< T > &  orig  )  [inline]

The copy constructor.

The copy constructor of the PropertySequence makes non-deep copies of its elements.

Definition at line 112 of file PropertySequence.hpp.


Member Function Documentation

template<class T>
void RTT::PropertySequence< T >::add ( T *  p  )  [inline]

Add a property to the container.

Parameters:
p Pointer to the property to be added.

Definition at line 121 of file PropertySequence.hpp.

Referenced by RTT::PropertySequence< T >::operator<<=(), and RTT::PropertySequence< T >::operator=().

template<class T>
void RTT::PropertySequence< T >::clear ( void   )  [inline]

Removes all PropertyBases from this sequence, without deleting them.

This is a not recursive function.

Definition at line 141 of file PropertySequence.hpp.

template<class T>
T* RTT::PropertySequence< T >::find ( const std::string &  name  )  const [inline]

Find the PropertyBase with name name.

Parameters:
name The name of the property to search for.
Returns:
The PropertyBase with this name, zero if it does not exist.

Definition at line 170 of file PropertySequence.hpp.

Referenced by RTT::PropertySequence< T >::operator<<=(), and RTT::PropertySequence< T >::remove().

template<class T>
void RTT::PropertySequence< T >::list ( std::vector< std::string > &  names  )  const [inline]

List all properties.

Parameters:
names The container which will be used to store all available property names in.

Definition at line 152 of file PropertySequence.hpp.

template<class T>
PropertySequence<T>& RTT::PropertySequence< T >::operator<<= ( const PropertySequence< T > &  source  )  [inline]

The update operator.

It updates this sequence so it contains all PropertyBases of another sequence, removing own PropertyBases if duplicate names exist in the source sequence.

Definition at line 204 of file PropertySequence.hpp.

References RTT::PropertySequence< T >::add(), and RTT::PropertySequence< T >::find().

template<class T>
void RTT::PropertySequence< T >::remove ( T *  p  )  [inline]

Remove a property from the container.

Parameters:
p Pointer to the property to be removed.

Definition at line 130 of file PropertySequence.hpp.

References RTT::PropertySequence< T >::find().


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