Orocos Real-Time Toolkit  2.6.0
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes
RTT::types::TemplateTypeInfo< T, use_ostream > Class Template Reference

This template class allows user types to be used in all Orocos primitives. More...

#include <rtt/types/TemplateTypeInfo.hpp>

Inheritance diagram for RTT::types::TemplateTypeInfo< T, use_ostream >:
RTT::types::PrimitiveTypeInfo< T, use_ostream > RTT::types::TypeInfoGenerator RTT::types::SequenceTypeInfo< rt_string, true > RTT::types::SequenceTypeInfo< std::string, true > RTT::types::SequenceTypeInfo< std::vector< double >, true > RTT::types::SequenceTypeInfo< std::vector< T >, has_ostream > RTT::types::RTStringTypeInfo RTT::types::StdStringTypeInfo RTT::types::StdVectorTypeInfo

List of all members.

Public Types

typedef T UserType
 The given T parameter is the type for reading DataSources.
typedef T DataType
 The given T parameter is the type of the DataSources.

Public Member Functions

 TemplateTypeInfo (std::string name)
 Setup Type Information for type name.
virtual
base::ChannelElementBase::shared_ptr 
buildRemoteChannelOutput (base::OutputPortInterface &output_port, types::TypeInfo const *type_info, base::InputPortInterface &input, const ConnPolicy &policy)
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.
boost::shared_ptr
< PrimitiveTypeInfo< T,
use_ostream > > 
getSharedPtr ()
TypeInfogetTypeInfoObject () const
 Returns the TypeInfo object of this type, or null if none exists yet.
virtual const std::string & getTypeName () const
 Return the type name for which this generator generates type info features.
virtual std::ostream & write (std::ostream &os, base::DataSourceBase::shared_ptr in) const
virtual std::istream & read (std::istream &os, base::DataSourceBase::shared_ptr out) const
virtual bool isStreamable () const
virtual bool composeType (base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr result) const
virtual
base::DataSourceBase::shared_ptr 
decomposeType (base::DataSourceBase::shared_ptr source) const
 A primitive type is decomposed into itself.
virtual bool decomposeType (base::DataSourceBase::shared_ptr source, PropertyBag &targetbag) const
base::AttributeBasebuildConstant (std::string name, base::DataSourceBase::shared_ptr dsb) const
base::AttributeBasebuildVariable (std::string name) const
base::AttributeBasebuildAttribute (std::string name, base::DataSourceBase::shared_ptr in) const
base::AttributeBasebuildAlias (std::string name, base::DataSourceBase::shared_ptr in) const
base::DataSourceBase::shared_ptr buildActionAlias (base::ActionInterface *action, base::DataSourceBase::shared_ptr in) const
virtual base::PropertyBasebuildProperty (const std::string &name, const std::string &desc, base::DataSourceBase::shared_ptr source=0) const
virtual
base::DataSourceBase::shared_ptr 
buildValue () const
virtual
base::DataSourceBase::shared_ptr 
buildReference (void *ptr) const
base::InputPortInterfaceinputPort (std::string const &name) const
base::OutputPortInterfaceoutputPort (std::string const &name) const
base::ChannelElementBase::shared_ptr buildDataStorage (ConnPolicy const &policy) const
base::ChannelElementBase::shared_ptr buildChannelOutput (base::InputPortInterface &port) const
base::ChannelElementBase::shared_ptr buildChannelInput (base::OutputPortInterface &port) const
virtual bool composeType (base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr result) 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().
virtual bool composeTypeImpl (const PropertyBag &source, typename internal::AssignableDataSource< T >::reference_t result) const
 User, implement this function in case you want to control reading the XML data format.
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.
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.
Type building/factory functions

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

virtual base::AttributeBasebuildConstant (std::string name, base::DataSourceBase::shared_ptr, int sizehint) const
 Build a non modifyable instance of this type.
virtual base::AttributeBasebuildVariable (std::string name, int sizehint) const
 Build a modifyable instance of this type.
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.
virtual bool fromString (const std::string &value, base::DataSourceBase::shared_ptr out) const
 Usability function which converts a string to data.

Static Public Member Functions

template<typename T >
static base::ChannelElementBasebuildDataStorage (ConnPolicy const &policy, const T &initial_value=T())
 This method creates the connection element that will store data inside the connection, based on the given policy.
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildChannelOutput (InputPort< T > &port, ConnID *conn_id)
 During the process of building a connection between two ports, this method builds the output part of the channel, that is the half that is connected to the input port.
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildChannelInput (OutputPort< T > &port, ConnID *conn_id, base::ChannelElementBase::shared_ptr output_channel)
 During the process of building a connection between two ports, this method builds the input half (starting from the OutputPort).
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildBufferedChannelInput (OutputPort< T > &port, ConnID *conn_id, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr output_channel)
 Extended version of buildChannelInput that also installs a buffer after the channel input endpoint, according to a policy.
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildBufferedChannelOutput (InputPort< T > &port, ConnID *conn_id, ConnPolicy const &policy, T const &initial_value=T())
 Extended version of buildChannelOutput that also installs a buffer before the channel output endpoint, according to a policy.
template<typename T >
static bool createConnection (OutputPort< T > &output_port, base::InputPortInterface &input_port, ConnPolicy const &policy)
 Creates a connection from a local output_port to a local or remote input_port.
template<class T >
static bool createStream (OutputPort< T > &output_port, ConnPolicy const &policy)
 Creates, attaches and checks an outbound stream to an Output port.
template<class T >
static bool createStream (InputPort< T > &input_port, ConnPolicy const &policy)
 Creates, attaches and checks an inbound stream to an Input port.
static bool createAndCheckStream (base::OutputPortInterface &output_port, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr chan, StreamConnID *conn_id)

Static Protected Member Functions

static bool createAndCheckStream (base::InputPortInterface &input_port, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr outhalf, StreamConnID *conn_id)
static bool createAndCheckConnection (base::OutputPortInterface &output_port, base::InputPortInterface &input_port, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy policy)
static
base::ChannelElementBase::shared_ptr 
createRemoteConnection (base::OutputPortInterface &output_port, base::InputPortInterface &input_port, ConnPolicy const &policy)
template<class T >
static
base::ChannelElementBase::shared_ptr 
createOutOfBandConnection (OutputPort< T > &output_port, InputPort< T > &input_port, ConnPolicy const &policy)
 This code is for setting up an in-process out-of-band connection.
static
base::ChannelElementBase::shared_ptr 
createAndCheckOutOfBandConnection (base::OutputPortInterface &output_port, base::InputPortInterface &input_port, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr output_half, StreamConnID *conn_id)

Protected Attributes

const std::string tname
boost::shared_ptr
< PrimitiveTypeInfo< T,
use_ostream > > 
mshared

Detailed Description

template<typename T, bool use_ostream = false>
class RTT::types::TemplateTypeInfo< T, use_ostream >

This template class allows user types to be used in all Orocos primitives.

It provides 'default' implementations for virtual functions of TypeInfo. For user defined types, this is very likely not satisfactory and the user needs to override the methods of this class in a subclass or provide specialised global functions.

Parameters:
TThe user class type.
use_ostreamWhen set to true, the class will use operator<<(std::ostream&, T) to write out the type to a stream. When set to false, the class will use this function and write '( type name )' to a stream instead. Defaults to false. Set to true if your class T has the above mentioned function.
See also:
TypeInfoRepository.
operator<<
StructTypeInfo, SequenceTypeInfo

Definition at line 74 of file TemplateTypeInfo.hpp.


Constructor & Destructor Documentation

template<typename T, bool use_ostream = false>
RTT::types::TemplateTypeInfo< T, use_ostream >::TemplateTypeInfo ( std::string  name) [inline]

Setup Type Information for type name.

This causes a switch from 'unknown' type to basic type information for type T.

Parameters:
namethe 'Orocos' type name.

Definition at line 92 of file TemplateTypeInfo.hpp.


Member Function Documentation

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildBufferedChannelInput ( OutputPort< T > &  port,
ConnID conn_id,
ConnPolicy const &  policy,
base::ChannelElementBase::shared_ptr  output_channel 
) [inline, static, inherited]

Extended version of buildChannelInput that also installs a buffer after the channel input endpoint, according to a policy.

Parameters:
portThe output port to which the connection will be added by client code.
conn_idA unique connection id which identifies this connection
policyThe policy dictating which kind of buffer must be installed. The transport and other parameters are ignored.
output_channelOptional. If present, the buffer will be connected to this element.

Definition at line 219 of file ConnFactory.hpp.

References RTT::base::ChannelElementBase::setOutput().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildBufferedChannelOutput ( InputPort< T > &  port,
ConnID conn_id,
ConnPolicy const &  policy,
T const &  initial_value = T() 
) [inline, static, inherited]

Extended version of buildChannelOutput that also installs a buffer before the channel output endpoint, according to a policy.

Parameters:
portThe input port to which the connection is added.
conn_idA unique connection id which identifies this connection
policyThe policy dictating which kind of buffer must be installed. The transport and other parameters are ignored.
initial_valueThe value to use to initialize the connection's storage buffer.

Definition at line 255 of file ConnFactory.hpp.

References RTT::base::ChannelElementBase::setOutput().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildChannelInput ( OutputPort< T > &  port,
ConnID conn_id,
base::ChannelElementBase::shared_ptr  output_channel 
) [inline, static, inherited]

During the process of building a connection between two ports, this method builds the input half (starting from the OutputPort).

The output_channel argument is the connection element that has been returned by buildChannelOutput.

See also:
buildChannelOutput

Definition at line 199 of file ConnFactory.hpp.

References RTT::base::ChannelElementBase::setOutput().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildChannelOutput ( InputPort< T > &  port,
ConnID conn_id 
) [inline, static, inherited]

During the process of building a connection between two ports, this method builds the output part of the channel, that is the half that is connected to the input port.

The returned value is the connection element that should be connected to the end of the input-half.

See also:
buildChannelInput

Definition at line 238 of file ConnFactory.hpp.

AttributeBase * RTT::ValueFactory::buildConstant ( std::string  name,
base::DataSourceBase::shared_ptr  dsb,
int  sizehint 
) const [virtual, inherited]

Build a non modifyable instance of this type.

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

Definition at line 14 of file ValueFactory.cpp.

template<typename T >
static base::ChannelElementBase* RTT::internal::ConnFactory::buildDataStorage ( ConnPolicy const &  policy,
const T &  initial_value = T() 
) [inline, static, inherited]

This method creates the connection element that will store data inside the connection, based on the given policy.

Todo:
: shouldn't this belong in the template type info ? This allows the type lib to choose which locked/lockfree algorithms are implemented and leaves out 4x code generation for each alternative in each compilation unit.

Contra: needs T in typelib.

Todo:
: since setDataSample, initial_value is no longer needed.

Definition at line 139 of file ConnFactory.hpp.

References RTT::ConnPolicy::lock_policy, RTT::ConnPolicy::size, and RTT::ConnPolicy::type.

AttributeBase * RTT::ValueFactory::buildVariable ( std::string  name,
int  sizehint 
) const [virtual, inherited]

Build a modifyable instance of this type.

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

Reimplemented in RTT::types::CArrayTypeInfo< T, has_ostream >.

Definition at line 10 of file ValueFactory.cpp.

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.

Returns:
null if this type is not convertible to anything else.
Deprecated:
by decomposeType. We want to rename convertType to decomposeType. This function is left here for transitional purposes.

Definition at line 6 of file CompositionFactory.cpp.

bool ConnFactory::createAndCheckStream ( base::OutputPortInterface output_port,
ConnPolicy const &  policy,
base::ChannelElementBase::shared_ptr  chan,
StreamConnID conn_id 
) [static, inherited]
template<typename T >
static bool RTT::internal::ConnFactory::createConnection ( OutputPort< T > &  output_port,
base::InputPortInterface input_port,
ConnPolicy const &  policy 
) [inline, static, inherited]

Creates a connection from a local output_port to a local or remote input_port.

This function contains all logic to decide on how connections must be created to local or remote input ports.

In order to set up out-of-band communication between input_port and output_port, use a different transport number in the policy parameter than the transport of the input port.

Definition at line 274 of file ConnFactory.hpp.

References RTT::OutputPort< T >::getLastWrittenValue(), RTT::base::PortInterface::getName(), RTT::base::PortInterface::getPortID(), RTT::base::PortInterface::isLocal(), and RTT::ConnPolicy::transport.

template<class T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::createOutOfBandConnection ( OutputPort< T > &  output_port,
InputPort< T > &  input_port,
ConnPolicy const &  policy 
) [inline, static, protected, inherited]

This code is for setting up an in-process out-of-band connection.

This means that both input and output port are present in the same process. This function is used when the policy dictates a transport protocol, but both ports are local.

Returns:
a channel element chain with a channel output endpoint, but no channel input endpoint.

Definition at line 370 of file ConnFactory.hpp.

References RTT::ConnPolicy::name_id.

template<class T >
static bool RTT::internal::ConnFactory::createStream ( OutputPort< T > &  output_port,
ConnPolicy const &  policy 
) [inline, static, inherited]

Creates, attaches and checks an outbound stream to an Output port.

Parameters:
output_portThe port to connect the stream to.
policyThe policy dictating which transport to use.
Returns:
true if the stream could be created and connected to output_port.

Definition at line 327 of file ConnFactory.hpp.

References RTT::ConnPolicy::name_id.

template<class T >
static bool RTT::internal::ConnFactory::createStream ( InputPort< T > &  input_port,
ConnPolicy const &  policy 
) [inline, static, inherited]

Creates, attaches and checks an inbound stream to an Input port.

Parameters:
input_portThe port to connect the stream to.
policyThe policy dictating which transport to use.
Returns:
true if the stream could be created and connected to input_port.

Definition at line 345 of file ConnFactory.hpp.

References RTT::ConnPolicy::name_id, and RTT::base::InputPortInterface::removeConnection().

template<typename T>
virtual base::DataSourceBase::shared_ptr RTT::types::TemplateCompositionFactory< T >::decomposeType ( base::DataSourceBase::shared_ptr  source) const [inline, virtual, inherited]

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.

Definition at line 46 of file TemplateCompositionFactory.hpp.

template<typename T>
virtual bool RTT::types::TemplateCompositionFactory< T >::decomposeTypeImpl ( typename internal::AssignableDataSource< T >::const_reference_t  source,
PropertyBag targetbag 
) const [inline, virtual, inherited]

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.

template<typename T, bool use_ostream = false>
TypeInfo* RTT::types::PrimitiveTypeInfo< T, use_ostream >::getTypeInfoObject ( ) const [inline, virtual, inherited]

Returns the TypeInfo object of this type, or null if none exists yet.

Returns:
All generators should return here TypeInfoRepository::Instance()->getTypeInfo<T>();

Implements RTT::types::TypeInfoGenerator.

Definition at line 83 of file PrimitiveTypeInfo.hpp.

template<typename T, bool use_ostream = false>
virtual const std::string& RTT::types::PrimitiveTypeInfo< T, use_ostream >::getTypeName ( ) const [inline, virtual, inherited]

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 87 of file PrimitiveTypeInfo.hpp.

Referenced by RTT::types::EnumTypeInfo< T >::decomposeType().

template<typename T, bool use_ostream = false>
bool RTT::types::TemplateTypeInfo< T, use_ostream >::installTypeInfoObject ( TypeInfo ti) [inline, virtual]

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.

Parameters:
tiA valid TypeInfo object into which new features may be installed
Returns:
true if this object may be deleted, false if not.
Postcondition:
When true is returned, this instance is still valid and the caller (TypeInfoRepository) will delete it. When false is returned, the validity is undefined and the instance will not be used anymore by the caller.

Reimplemented from RTT::types::PrimitiveTypeInfo< T, use_ostream >.

Reimplemented in RTT::types::EnumTypeInfo< T >, and RTT::types::StructTypeInfo< T, has_ostream >.

Definition at line 109 of file TemplateTypeInfo.hpp.

Referenced by RTT::types::TemplateTypeInfo< T, false >::installTypeInfoObject().


The documentation for this class was generated from the following file: