Orocos Real-Time Toolkit
2.9.0
|
Type Information for data types that are structs, ie all user data types fall in this category. More...
#include <rtt/types/rtt-types-fwd.hpp>
Public Types | |
typedef T | UserType |
The given T parameter is the type for reading DataSources. More... | |
typedef T | DataType |
The given T parameter is the type of the DataSources. More... | |
Public Member Functions | |
StructTypeInfo (std::string name) | |
bool | installTypeInfoObject (TypeInfo *ti) |
Installs the type info object in the global data source type info handler and adds any additional features to the type info object. More... | |
virtual std::vector< std::string > | getMemberNames () const |
Returns the list of struct member names of this type. More... | |
virtual base::DataSourceBase::shared_ptr | getMember (base::DataSourceBase::shared_ptr item, base::DataSourceBase::shared_ptr id) const |
Returns a member of a given data source identified by a data source id. More... | |
virtual base::DataSourceBase::shared_ptr | getMember (base::DataSourceBase::shared_ptr item, const std::string &name) const |
Returns a member of a given data source struct identified by its name. More... | |
virtual bool | getMember (internal::Reference *ref, base::DataSourceBase::shared_ptr item, const std::string &name) const |
Stores a reference to a member of a struct identified by its name. More... | |
virtual bool | resize (base::DataSourceBase::shared_ptr arg, int size) const |
Tries to resize a data source in case it's a resizable sequence. More... | |
virtual bool | composeTypeImpl (const PropertyBag &source, typename internal::AssignableDataSource< T >::reference_t result) const |
Implementation that updates result with the matching parts in source Relies on the fact that getMember returns a C++ reference to each part of result, which is then updated with a property found in source. More... | |
virtual base::ChannelElementBase::shared_ptr | buildRemoteChannelOutput (base::OutputPortInterface &output_port, types::TypeInfo const *type_info, base::InputPortInterface &input, const ConnPolicy &policy) |
boost::shared_ptr< PrimitiveTypeInfo< T, use_ostream > > | getSharedPtr () |
TypeInfo * | getTypeInfoObject () const |
Returns the TypeInfo object of this type, or null if none exists yet. More... | |
virtual const std::string & | getTypeName () const |
Return the type name for which this generator generates type info features. More... | |
virtual std::ostream & | write (std::ostream &os, base::DataSourceBase::shared_ptr in) const |
Output this datasource as a human readable string. More... | |
virtual std::istream & | read (std::istream &os, base::DataSourceBase::shared_ptr out) const |
Read a new value for this datasource from a human readable string. More... | |
virtual bool | isStreamable () const |
Returns true if this type is directly streamable using read()/write() or toString()/fromString(). More... | |
virtual bool | composeType (base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr result) const |
virtual bool | composeType (base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr result) const |
Compose a type (target) from a DataSourceBase (source) containing its members. More... | |
virtual base::DataSourceBase::shared_ptr | decomposeType (base::DataSourceBase::shared_ptr source) const |
A primitive type is decomposed into itself. More... | |
virtual bool | decomposeType (base::DataSourceBase::shared_ptr source, PropertyBag &targetbag) const |
virtual base::DataSourceBase::shared_ptr | decomposeType (base::DataSourceBase::shared_ptr source) const |
This default implementation sets up a PropertyBag which is passed to decomposeTypeImpl(). More... | |
base::AttributeBase * | buildConstant (std::string name, base::DataSourceBase::shared_ptr dsb) const |
Build a non modifyable instance of this type. More... | |
base::AttributeBase * | buildVariable (std::string name) const |
Build a non modifyable instance of this type. More... | |
base::AttributeBase * | buildAttribute (std::string name, base::DataSourceBase::shared_ptr in) const |
Build an Attribute of this type. More... | |
base::AttributeBase * | buildAlias (std::string name, base::DataSourceBase::shared_ptr in) const |
build an alias with b as the value. More... | |
base::DataSourceBase::shared_ptr | buildActionAlias (base::ActionInterface *action, base::DataSourceBase::shared_ptr in) const |
Returns a DataSource that first executes an action and returns the result of another data source. More... | |
virtual base::PropertyBase * | buildProperty (const std::string &name, const std::string &desc, base::DataSourceBase::shared_ptr source=0) const |
Build a Property of this type. More... | |
virtual base::DataSourceBase::shared_ptr | buildValue () const |
Build a internal::ValueDataSource of this type. More... | |
virtual base::DataSourceBase::shared_ptr | buildReference (void *ptr) const |
Build a internal::ReferenceDataSource of this type, pointing to the given pointer. More... | |
base::InputPortInterface * | inputPort (std::string const &name) const |
base::OutputPortInterface * | outputPort (std::string const &name) const |
base::ChannelElementBase::shared_ptr | buildDataStorage (ConnPolicy const &policy) const |
base::ChannelElementBase::shared_ptr | buildChannelOutput (base::InputPortInterface &port, ConnPolicy const &policy) const |
base::ChannelElementBase::shared_ptr | buildChannelInput (base::OutputPortInterface &port, ConnPolicy const &policy) const |
internal::SharedConnectionBase::shared_ptr | buildSharedConnection (base::OutputPortInterface *output_port, base::InputPortInterface *input_port, ConnPolicy const &policy) const |
virtual bool | decomposeTypeImpl (typename internal::AssignableDataSource< T >::const_reference_t source, PropertyBag &targetbag) const |
User, implement this function in case you want to control writing the XML data format. More... | |
virtual base::DataSourceBase::shared_ptr | convertType (base::DataSourceBase::shared_ptr source) const |
Specialize this function to return an alternate type which represents this one in a compatible way. More... | |
Type building/factory functions | |
Used to create objects that hold data of a certain type. | |
virtual base::AttributeBase * | buildConstant (std::string name, base::DataSourceBase::shared_ptr, int sizehint) const |
Build a non modifyable instance of this type. More... | |
virtual base::AttributeBase * | buildVariable (std::string name, int sizehint) const |
Build a modifyable instance of this type. More... | |
Conversion to/from text | |
Used to convert data to human readable text and vice versa. | |
virtual std::string | toString (base::DataSourceBase::shared_ptr in) const |
Usability function which converts data to a string. More... | |
virtual bool | fromString (const std::string &value, base::DataSourceBase::shared_ptr out) const |
Usability function which converts a string to data. More... | |
Protected Attributes | |
const std::string | tname |
boost::shared_ptr< PrimitiveTypeInfo< T, use_ostream > > | mshared |
Type Information for data types that are structs, ie all user data types fall in this category.
Use this class to register your data type to the Orocos type system.
This class requires that your struct is compatible with the boost::serialization API. This means that it must provide a serialize() function or that you define a free function serialize() in the boost::serialization namespace. If no such function exists, you can fall back to StdTypeInfo or even TemplateTypeInfo.
Definition at line 33 of file rtt-types-fwd.hpp.
|
inherited |
The given T parameter is the type of the DataSources.
Definition at line 44 of file PrimitiveTypeInfo.hpp.
|
inherited |
The given T parameter is the type for reading DataSources.
Definition at line 83 of file TemplateTypeInfo.hpp.
|
inline |
Definition at line 65 of file StructTypeInfo.hpp.
|
inlinevirtualinherited |
Returns a DataSource that first executes an action and returns the result of another data source.
If source is an AssignableDataSource, an AssignableDataSource is returned of the same type, otherwise, a plain DataSource is returned.
Implements RTT::types::ValueFactory.
Definition at line 62 of file TemplateValueFactory.hpp.
|
inlinevirtualinherited |
build an alias with b as the value.
If b is of the wrong type, 0 will be returned..
Implements RTT::types::ValueFactory.
Definition at line 54 of file TemplateValueFactory.hpp.
|
inlinevirtualinherited |
Build an Attribute of this type.
Implements RTT::types::ValueFactory.
Definition at line 40 of file TemplateValueFactory.hpp.
|
inlineinherited |
Definition at line 31 of file TemplateConnFactory.hpp.
|
inlineinherited |
Definition at line 26 of file TemplateConnFactory.hpp.
|
inlinevirtualinherited |
Build a non modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
Implements RTT::types::ValueFactory.
Definition at line 20 of file TemplateValueFactory.hpp.
|
virtualinherited |
Build a non modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
Definition at line 14 of file ValueFactory.cpp.
|
inlineinherited |
Definition at line 22 of file TemplateConnFactory.hpp.
|
inlinevirtualinherited |
Build a Property of this type.
Implements RTT::types::ValueFactory.
Definition at line 74 of file TemplateValueFactory.hpp.
|
inlinevirtualinherited |
Build a internal::ReferenceDataSource of this type, pointing to the given pointer.
Implements RTT::types::ValueFactory.
Definition at line 90 of file TemplateValueFactory.hpp.
|
inlinevirtualinherited |
Definition at line 102 of file TemplateTypeInfo.hpp.
|
inlineinherited |
Definition at line 36 of file TemplateConnFactory.hpp.
|
inlinevirtualinherited |
Build a internal::ValueDataSource of this type.
Implements RTT::types::ValueFactory.
Definition at line 87 of file TemplateValueFactory.hpp.
|
inlinevirtualinherited |
Build a non modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
Implements RTT::types::ValueFactory.
Definition at line 33 of file TemplateValueFactory.hpp.
|
virtualinherited |
Build a modifyable instance of this type.
sizehint | For variable size instances, use it to hint the size of the instance. |
Reimplemented in RTT::types::CArrayTypeInfo< T, has_ostream >, RTT::types::StdStringTypeInfo, RTT::types::RTStringTypeInfo, RTT::types::PrimitiveSequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< rt_string, true >, RTT::types::SequenceTypeInfo< std::string, true >, RTT::types::SequenceTypeInfo< std::vector< double >, true >, and RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream >.
Definition at line 10 of file ValueFactory.cpp.
|
inlinevirtualinherited |
Compose a type (target) from a DataSourceBase (source) containing its members.
The default behavior tries to assign source to target. If that fails, it tries to decompose target into its members and update the members of target with the contents of source.
The default implementation in TemplateTypeInfo works for most types, but can be overridden in case there are multiple versions/possibilities to make a target from a source. For example, in order to support legacy formats or in order to do the inverse of decomposeType().
source | A data source of the same type as target OR a PropertyBag that contains the parts of target to be refreshed. |
target | A data source of the same type as this TypeInfo object which contains the data to be updated from source. |
Implements RTT::types::CompositionFactory.
Reimplemented in RTT::types::EnumTypeInfo< T >, RTT::types::StdStringTypeInfo, RTT::types::RTStringTypeInfo, RTT::types::StdTypeInfo< T >, RTT::types::StdTypeInfo< bool >, RTT::types::StdVectorTemplateTypeInfo< T, has_ostream >, RTT::types::StdVectorTypeInfo, RTT::types::SequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< rt_string, true >, RTT::types::SequenceTypeInfo< std::string, true >, RTT::types::SequenceTypeInfo< std::vector< double >, true >, and RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream >.
Definition at line 21 of file TemplateCompositionFactory.hpp.
|
inlinevirtualinherited |
Reimplemented in RTT::types::CArrayTypeInfo< T, has_ostream >, RTT::types::BoostArrayTypeInfo< T, has_ostream >, RTT::types::EnumTypeInfo< T >, RTT::types::StdStringTypeInfo, RTT::types::RTStringTypeInfo, RTT::types::StdTypeInfo< T >, RTT::types::StdTypeInfo< bool >, RTT::types::StdVectorTemplateTypeInfo< T, has_ostream >, RTT::types::StdVectorTypeInfo, RTT::types::PrimitiveSequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< rt_string, true >, RTT::types::SequenceTypeInfo< std::string, true >, RTT::types::SequenceTypeInfo< std::vector< double >, true >, and RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream >.
Definition at line 111 of file PrimitiveTypeInfo.hpp.
|
inlinevirtual |
Implementation that updates result with the matching parts in source Relies on the fact that getMember returns a C++ reference to each part of result, which is then updated with a property found in source.
Reimplemented from RTT::types::TemplateCompositionFactory< T >.
Definition at line 150 of file StructTypeInfo.hpp.
References RTT::PropertyBag::getType(), RTT::base::DataSourceBase::ref(), RTT::refreshProperties(), RTT::types::typeDecomposition(), and RTT::types::Types().
|
virtualinherited |
Specialize this function to return an alternate type which represents this one in a compatible way.
For example, a short converts to an long or an enum to an int or a string.
Definition at line 6 of file CompositionFactory.cpp.
Referenced by RTT::types::CompositionFactory::decomposeType().
|
inlinevirtualinherited |
This default implementation sets up a PropertyBag which is passed to decomposeTypeImpl().
It is advised to implement that function and to leave this function as-is, unless you don't want to return a PropertyBag, but another data type.
Reimplemented from RTT::types::CompositionFactory.
Reimplemented in RTT::types::EnumTypeInfo< T >, RTT::types::StdStringTypeInfo, RTT::types::RTStringTypeInfo, RTT::types::StdTypeInfo< T >, RTT::types::StdTypeInfo< bool >, RTT::types::SequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< rt_string, true >, RTT::types::SequenceTypeInfo< std::string, true >, RTT::types::SequenceTypeInfo< std::vector< double >, true >, and RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream >.
Definition at line 46 of file TemplateCompositionFactory.hpp.
|
inlinevirtualinherited |
A primitive type is decomposed into itself.
Reimplemented in RTT::types::CArrayTypeInfo< T, has_ostream >, RTT::types::BoostArrayTypeInfo< T, has_ostream >, RTT::types::EnumTypeInfo< T >, RTT::types::StdStringTypeInfo, RTT::types::RTStringTypeInfo, RTT::types::StdTypeInfo< T >, RTT::types::StdTypeInfo< bool >, RTT::types::PrimitiveSequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< T, has_ostream >, RTT::types::SequenceTypeInfo< rt_string, true >, RTT::types::SequenceTypeInfo< std::string, true >, RTT::types::SequenceTypeInfo< std::vector< double >, true >, and RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream >.
Definition at line 118 of file PrimitiveTypeInfo.hpp.
|
inlinevirtualinherited |
Definition at line 123 of file PrimitiveTypeInfo.hpp.
|
inlinevirtualinherited |
User, implement this function in case you want to control writing the XML data format.
Add the structural elements of source to targetbag.
Definition at line 69 of file TemplateCompositionFactory.hpp.
Referenced by RTT::types::TemplateCompositionFactory< bool >::decomposeType().
|
virtualinherited |
Usability function which converts a string to data.
Definition at line 23 of file StreamFactory.cpp.
|
inlinevirtual |
Returns a member of a given data source identified by a data source id.
This will be an int (for indexing) or a string (for the member name).
item | The item of which to return a member |
id | Or a string data source containing the name of a member if item is a struct, Or an unsigned int data source containing the index of an element if item is a sequence |
Reimplemented from RTT::types::MemberFactory.
Definition at line 91 of file StructTypeInfo.hpp.
|
inlinevirtual |
Returns a member of a given data source struct identified by its name.
item | The item of which to return a reference to a member |
name | The name of a member within item. Is a name of a member in case of a struct or an index number in case of a sequence. |
Reimplemented from RTT::types::MemberFactory.
Definition at line 101 of file StructTypeInfo.hpp.
References RTT::types::type_discovery::discoverMember(), RTT::Error, RTT::internal::DataSource< T >::get(), RTT::types::PrimitiveTypeInfo< T, use_ostream >::getTypeName(), and RTT::internal::AssignableDataSource< T >::set().
|
inlinevirtual |
Stores a reference to a member of a struct identified by its name.
This method does not allocate memory when item is assignable..
ref | The reference object in which to store the reference. |
item | The item of which to return a reference to a member. It must be assignable, otherwise, a reference to a copy of item will be returned. This copy will allocate memory. |
name | The name of a member within item. |
Reimplemented from RTT::types::MemberFactory.
Definition at line 120 of file StructTypeInfo.hpp.
References RTT::Error, RTT::internal::DataSource< T >::get(), RTT::types::PrimitiveTypeInfo< T, use_ostream >::getTypeName(), RTT::types::type_discovery::referenceMember(), and RTT::internal::AssignableDataSource< T >::set().
|
inlinevirtual |
Returns the list of struct member names of this type.
In case this type is not a struct, returns an empty list.
Reimplemented from RTT::types::MemberFactory.
Definition at line 83 of file StructTypeInfo.hpp.
References RTT::types::type_discovery::discover(), and RTT::types::type_discovery::mnames.
|
inlineinherited |
Definition at line 62 of file PrimitiveTypeInfo.hpp.
Referenced by RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream >::installTypeInfoObject(), RTT::types::PrimitiveTypeInfo< std::vector< T >, use_ostream >::installTypeInfoObject(), RTT::types::StructTypeInfo< T, has_ostream >::installTypeInfoObject(), and RTT::types::TemplateTypeInfo< T, false >::installTypeInfoObject().
|
inlinevirtualinherited |
Returns the TypeInfo object of this type, or null if none exists yet.
Implements RTT::types::TypeInfoGenerator.
Definition at line 84 of file PrimitiveTypeInfo.hpp.
|
inlinevirtualinherited |
Return the type name for which this generator generates type info features.
This name will be aliased by the TypeInfo object.
Implements RTT::types::TypeInfoGenerator.
Definition at line 88 of file PrimitiveTypeInfo.hpp.
Referenced by RTT::types::StructTypeInfo< T, has_ostream >::getMember().
|
inlineinherited |
Definition at line 19 of file TemplateConnFactory.hpp.
|
inlinevirtual |
Installs the type info object in the global data source type info handler and adds any additional features to the type info object.
This method will be called by the TypeInfoRepository, in order to register this type's factories into the TypeInfo object.
ti | A valid TypeInfo object into which new features may be installed |
Reimplemented from RTT::types::PrimitiveTypeInfo< T, use_ostream >.
Definition at line 70 of file StructTypeInfo.hpp.
References RTT::types::PrimitiveTypeInfo< T, use_ostream >::getSharedPtr(), RTT::types::TemplateTypeInfo< T, use_ostream >::installTypeInfoObject(), and RTT::types::TypeInfo::setMemberFactory().
|
inlinevirtualinherited |
Returns true if this type is directly streamable using read()/write() or toString()/fromString().
Implements RTT::types::StreamFactory.
Reimplemented in RTT::types::BoolTypeInfo.
Definition at line 107 of file PrimitiveTypeInfo.hpp.
|
inlineinherited |
Definition at line 20 of file TemplateConnFactory.hpp.
|
inlinevirtualinherited |
Read a new value for this datasource from a human readable string.
The default does nothing.
Implements RTT::types::StreamFactory.
Reimplemented in RTT::types::BoolTypeInfo.
Definition at line 98 of file PrimitiveTypeInfo.hpp.
|
inlinevirtual |
Tries to resize a data source in case it's a resizable sequence.
Reimplemented from RTT::types::MemberFactory.
Definition at line 139 of file StructTypeInfo.hpp.
|
virtualinherited |
Usability function which converts data to a string.
Definition at line 12 of file StreamFactory.cpp.
|
inlinevirtualinherited |
Output this datasource as a human readable string.
The default just writes the type name in parentheses to os.
Implements RTT::types::StreamFactory.
Reimplemented in RTT::types::BoolTypeInfo.
Definition at line 90 of file PrimitiveTypeInfo.hpp.
|
protectedinherited |
Definition at line 39 of file PrimitiveTypeInfo.hpp.
Referenced by RTT::types::PrimitiveTypeInfo< std::vector< T >, use_ostream >::getSharedPtr().
|
protectedinherited |
Definition at line 38 of file PrimitiveTypeInfo.hpp.
Referenced by RTT::types::PrimitiveTypeInfo< std::vector< T >, use_ostream >::getTypeName().