RTT::TypeInfo Class Reference

A class for representing a user type, and which can build instances of that type. More...

#include <rtt/Types.hpp>

Inheritance diagram for RTT::TypeInfo:
RTT::EmptyTypeInfo RTT::TemplateTypeInfo< T, use_ostream > RTT::TemplateTypeInfo< std::vector< T >, has_ostream > RTT::TemplateTypeInfo< T, has_ostream > RTT::TypeInfoName< T > RTT::TemplateContainerTypeInfo< std::vector< T >, int, T, ArrayIndexChecker< std::vector< T > >, SizeAssignChecker< std::vector< T > >, has_ostream > RTT::TemplateContainerTypeInfo< T, IndexType, SetType, IPred, APred, has_ostream > RTT::TemplateIndexTypeInfo< T, IndexType, SetType, IPred, APred, has_ostream >

List of all members.

Public Member Functions

virtual const std::string & getTypeName () const =0
 Return unique the type name.
virtual std::string getTypeIdName () const =0
Type building/factory functions

Used to create objects that hold data of a certain type.

virtual AttributeBasebuildConstant (std::string name, DataSourceBase::shared_ptr, int sizehint) const
 Build a non modifyable instance of this type.
virtual AttributeBasebuildConstant (std::string name, DataSourceBase::shared_ptr) const =0
 Build a non modifyable instance of this type.
virtual AttributeBasebuildVariable (std::string name, int sizehint) const
 Build a modifyable instance of this type.
virtual AttributeBasebuildVariable (std::string name) const =0
 Build a non modifyable instance of this type.
virtual DataSourceBase::shared_ptr construct (const std::vector< DataSourceBase::shared_ptr > &args) const
 Constructor syntax: construct a DataSource which returns an instance of data depending on the given arguments.
virtual DataSourceBase::shared_ptr convert (DataSourceBase::shared_ptr arg) const
 Automatic conversion: convert a DataSource to this type.
virtual void addConstructor (TypeBuilder *tb)
 Add a constructor/convertor object.
virtual AttributeBasebuildAlias (std::string name, DataSourceBase::shared_ptr b) const =0
 build an alias with b as the value.
virtual PropertyBasebuildProperty (const std::string &name, const std::string &desc, DataSourceBase::shared_ptr source=0) const =0
 Build a Property of this type.
virtual AttributeBasebuildAttribute (std::string name, DataSourceBase::shared_ptr source=0) const =0
 Build an Attribute of this type.
virtual DataSourceBase::shared_ptr buildValue () const =0
 Build a ValueDataSource of this type.
Conversion to/from text

Used to convert data to human readable text and vice versa.

virtual std::ostream & write (std::ostream &os, DataSourceBase::shared_ptr in) const =0
 Output this datasource as a human readable string.
virtual std::istream & read (std::istream &os, DataSourceBase::shared_ptr out) const =0
 Read a new value for this datasource from a human readable string.
virtual std::string toString (DataSourceBase::shared_ptr in) const
 Usability function which converts data to a string.
virtual bool fromString (const std::string &value, DataSourceBase::shared_ptr out) const
 Usability function which converts a string to data.
Inspecting data structures.

Used to write a complex type to an external representation, like XML.

virtual bool decomposeType (DataSourceBase::shared_ptr source, PropertyBag &targetbag) const =0
 Decompose a structure as basic components into a PropertyBag.
virtual bool composeType (DataSourceBase::shared_ptr source, DataSourceBase::shared_ptr target) const =0
 Compose a structure from a PropertyBase containing its basic components.
Distribution of objects

Used to transport data over a network.

bool addProtocol (int protocol_id, detail::TypeTransporter *tt)
 Register a protocol for data transport over a network.
detail::TypeTransportergetProtocol (int protocol_id) const
 Register a protocol for data transport over a network.
std::vector< int > getTransportNames () const
 Return a list of protocols that have transporters.

Protected Types

typedef std::vector
< TypeBuilder * > 
Constructors
typedef std::vector
< detail::TypeTransporter * > 
Transporters

Protected Attributes

Constructors constructors
Transporters transporters

Detailed Description

A class for representing a user type, and which can build instances of that type.

Definition at line 94 of file Types.hpp.


Member Function Documentation

virtual AttributeBase* RTT::TypeInfo::buildAlias ( std::string  name,
DataSourceBase::shared_ptr  b 
) const [pure virtual]

build an alias with b as the value.

If b is of the wrong type, 0 will be returned..

Implemented in RTT::TemplateTypeInfo< T, use_ostream >, RTT::EmptyTypeInfo, RTT::TemplateTypeInfo< T, has_ostream >, and RTT::TemplateTypeInfo< std::vector< T >, has_ostream >.

virtual AttributeBase* RTT::TypeInfo::buildConstant ( std::string  name,
DataSourceBase::shared_ptr   
) const [pure virtual]

Build a non modifyable instance of this type.

Parameters:
sizehint For variable size instances, use it to hint the size of the instance.

Implemented in RTT::TemplateTypeInfo< T, use_ostream >, RTT::EmptyTypeInfo, RTT::TemplateTypeInfo< T, has_ostream >, and RTT::TemplateTypeInfo< std::vector< T >, has_ostream >.

virtual AttributeBase* RTT::TypeInfo::buildConstant ( std::string  name,
DataSourceBase::shared_ptr  ,
int  sizehint 
) const [virtual]

Build a non modifyable instance of this type.

Parameters:
sizehint For variable size instances, use it to hint the size of the instance.
virtual AttributeBase* RTT::TypeInfo::buildVariable ( std::string  name  )  const [pure virtual]
virtual AttributeBase* RTT::TypeInfo::buildVariable ( std::string  name,
int  sizehint 
) const [virtual]

Build a modifyable instance of this type.

Parameters:
sizehint For variable size instances, use it to hint the size of the instance.

Reimplemented in RTT::TemplateContainerTypeInfo< T, IndexType, SetType, IPred, APred, has_ostream >, and RTT::TemplateContainerTypeInfo< std::vector< T >, int, T, ArrayIndexChecker< std::vector< T > >, SizeAssignChecker< std::vector< T > >, has_ostream >.

virtual bool RTT::TypeInfo::composeType ( DataSourceBase::shared_ptr  source,
DataSourceBase::shared_ptr  target 
) const [pure virtual]

Compose a structure from a PropertyBase containing its basic components.

The default behavior tries to assign source to target. If this does not work, because source and target have different type, this function returns false.

Implemented in RTT::TemplateTypeInfo< T, use_ostream >, RTT::EmptyTypeInfo, RTT::TemplateTypeInfo< T, has_ostream >, and RTT::TemplateTypeInfo< std::vector< T >, has_ostream >.

virtual DataSourceBase::shared_ptr RTT::TypeInfo::construct ( const std::vector< DataSourceBase::shared_ptr > &  args  )  const [virtual]

Constructor syntax: construct a DataSource which returns an instance of data depending on the given arguments.

When args is empty, the default 'variable' is returned.

Reimplemented in RTT::EmptyTypeInfo.

virtual DataSourceBase::shared_ptr RTT::TypeInfo::convert ( DataSourceBase::shared_ptr  arg  )  const [virtual]

Automatic conversion: convert a DataSource to this type.

For example, for converting float -> double. If no valid conversion was found, returns arg again, otherwise, a new data source.

virtual bool RTT::TypeInfo::decomposeType ( DataSourceBase::shared_ptr  source,
PropertyBag targetbag 
) const [pure virtual]

Decompose a structure as basic components into a PropertyBag.

Return values:
true decomposition resulted in new types added to targetbag.
false nothing was added to targetbag.

Implemented in RTT::TemplateTypeInfo< T, use_ostream >, RTT::EmptyTypeInfo, RTT::TemplateTypeInfo< T, has_ostream >, and RTT::TemplateTypeInfo< std::vector< T >, has_ostream >.

Referenced by RTT::decomposeProperty(), and RTT::PropertyBagIntrospector::introspect().

virtual std::istream& RTT::TypeInfo::read ( std::istream &  os,
DataSourceBase::shared_ptr  out 
) const [pure virtual]

Read a new value for this datasource from a human readable string.

The default does nothing.

Implemented in RTT::TemplateTypeInfo< T, use_ostream >, RTT::EmptyTypeInfo, RTT::TemplateTypeInfo< T, has_ostream >, and RTT::TemplateTypeInfo< std::vector< T >, has_ostream >.

virtual std::ostream& RTT::TypeInfo::write ( std::ostream &  os,
DataSourceBase::shared_ptr  in 
) const [pure virtual]

Output this datasource as a human readable string.

The default just writes the type name in parentheses to os.

Implemented in RTT::TemplateTypeInfo< T, use_ostream >, RTT::EmptyTypeInfo, RTT::TemplateTypeInfo< T, has_ostream >, and RTT::TemplateTypeInfo< std::vector< T >, has_ostream >.


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