Template for indexable types. More...
#include <rtt/TemplateTypeInfo.hpp>
Public Types | |
typedef T | UserType |
The given T parameter is the type for reading DataSources. | |
typedef Property< T > ::DataSourceType | PropertyType |
When Properties of T are constructed, they are non-const, non-reference. | |
Public Member Functions | |
TemplateIndexTypeInfo (std::string name) | |
AttributeBase * | buildVariable (std::string name) const |
Build a non modifyable instance of this type. | |
DataSourceBase::shared_ptr | buildValue () const |
Build a ValueDataSource of this type. | |
AttributeBase * | buildConstant (std::string name, DataSourceBase::shared_ptr dsb) const |
Build a non modifyable instance of this type. | |
AttributeBase * | buildAttribute (std::string name, DataSourceBase::shared_ptr in) const |
Build an Attribute of this type. | |
AttributeBase * | buildAlias (std::string name, DataSourceBase::shared_ptr in) const |
build an alias with b as the value. | |
virtual const std::string & | getTypeName () const |
Return unique the type name. | |
virtual PropertyBase * | buildProperty (const std::string &name, const std::string &desc, DataSourceBase::shared_ptr source=0) const |
Build a Property of this type. | |
virtual std::ostream & | write (std::ostream &os, DataSourceBase::shared_ptr in) const |
Output this datasource as a human readable string. | |
virtual std::istream & | read (std::istream &os, DataSourceBase::shared_ptr out) const |
Read a new value for this datasource from a human readable string. | |
virtual bool | decomposeType (DataSourceBase::shared_ptr source, PropertyBag &targetbag) const |
Decompose a structure as basic components into a PropertyBag. | |
virtual bool | decomposeTypeImpl (typename AssignableDataSource< T >::const_reference_t source, PropertyBag &targetbag) const |
User, implement this function. | |
virtual bool | composeType (DataSourceBase::shared_ptr source, DataSourceBase::shared_ptr result) const |
Compose a structure from a PropertyBase containing its basic components. | |
virtual bool | composeTypeImpl (const PropertyBag &source, typename AssignableDataSource< T >::reference_t result) const |
User, implement this function. | |
std::string | getTypeIdName () const |
Type building/factory functions | |
virtual AttributeBase * | buildConstant (std::string name, DataSourceBase::shared_ptr, int sizehint) const |
Build a non modifyable instance of this type. | |
virtual AttributeBase * | buildVariable (std::string name, int sizehint) const |
Build a 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. | |
Conversion to/from text | |
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. | |
Distribution of objects | |
bool | addProtocol (int protocol_id, detail::TypeTransporter *tt) |
Register a protocol for data transport over a network. | |
detail::TypeTransporter * | getProtocol (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 |
Template for indexable types.
Definition at line 426 of file TemplateTypeInfo.hpp.
AttributeBase* RTT::TemplateTypeInfo< T, use_ostream >::buildAlias | ( | std::string | name, | |
DataSourceBase::shared_ptr | b | |||
) | const [inline, virtual, inherited] |
build an alias with b as the value.
If b is of the wrong type, 0 will be returned..
Implements RTT::TypeInfo.
Definition at line 232 of file TemplateTypeInfo.hpp.
virtual AttributeBase* RTT::TypeInfo::buildConstant | ( | std::string | name, | |
DataSourceBase::shared_ptr | , | |||
int | sizehint | |||
) | const [virtual, inherited] |
Build a non modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
AttributeBase* RTT::TemplateTypeInfo< T, use_ostream >::buildConstant | ( | std::string | name, | |
DataSourceBase::shared_ptr | ||||
) | const [inline, virtual, inherited] |
Build a non modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
Implements RTT::TypeInfo.
Definition at line 198 of file TemplateTypeInfo.hpp.
virtual AttributeBase* RTT::TypeInfo::buildVariable | ( | std::string | name, | |
int | sizehint | |||
) | const [virtual, inherited] |
Build a modifyable instance of this type.
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 >.
AttributeBase* RTT::TemplateIndexTypeInfo< T, IndexType, SetType, IPred, APred, has_ostream >::buildVariable | ( | std::string | name | ) | const [inline, virtual] |
Build a non modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
Reimplemented from RTT::TemplateTypeInfo< T, has_ostream >.
Definition at line 437 of file TemplateTypeInfo.hpp.
virtual bool RTT::TemplateTypeInfo< T, use_ostream >::composeType | ( | DataSourceBase::shared_ptr | source, | |
DataSourceBase::shared_ptr | target | |||
) | const [inline, virtual, inherited] |
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.
Implements RTT::TypeInfo.
Definition at line 296 of file TemplateTypeInfo.hpp.
virtual bool RTT::TemplateTypeInfo< T, use_ostream >::composeTypeImpl | ( | const PropertyBag & | source, | |
typename AssignableDataSource< T >::reference_t | result | |||
) | const [inline, virtual, inherited] |
User, implement this function.
Extract the structural elements in source to result.
Definition at line 322 of file TemplateTypeInfo.hpp.
virtual DataSourceBase::shared_ptr RTT::TypeInfo::construct | ( | const std::vector< DataSourceBase::shared_ptr > & | args | ) | const [virtual, inherited] |
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, inherited] |
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::TemplateTypeInfo< T, use_ostream >::decomposeType | ( | DataSourceBase::shared_ptr | source, | |
PropertyBag & | targetbag | |||
) | const [inline, virtual, inherited] |
Decompose a structure as basic components into a PropertyBag.
true | decomposition resulted in new types added to targetbag. | |
false | nothing was added to targetbag. |
Implements RTT::TypeInfo.
Definition at line 280 of file TemplateTypeInfo.hpp.
virtual bool RTT::TemplateTypeInfo< T, use_ostream >::decomposeTypeImpl | ( | typename AssignableDataSource< T >::const_reference_t | source, | |
PropertyBag & | targetbag | |||
) | const [inline, virtual, inherited] |
User, implement this function.
Add the structural elements of source to targetbag.
Definition at line 292 of file TemplateTypeInfo.hpp.
virtual std::istream& RTT::TemplateTypeInfo< T, use_ostream >::read | ( | std::istream & | os, | |
DataSourceBase::shared_ptr | out | |||
) | const [inline, virtual, inherited] |
Read a new value for this datasource from a human readable string.
The default does nothing.
Implements RTT::TypeInfo.
Definition at line 271 of file TemplateTypeInfo.hpp.
virtual std::ostream& RTT::TemplateTypeInfo< T, use_ostream >::write | ( | std::ostream & | os, | |
DataSourceBase::shared_ptr | in | |||
) | const [inline, virtual, inherited] |
Output this datasource as a human readable string.
The default just writes the type name in parentheses to os.
Implements RTT::TypeInfo.
Definition at line 257 of file TemplateTypeInfo.hpp.