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

Template for data types that are C-style arrays. More...

#include <rtt/types/CArrayTypeInfo.hpp>

Inheritance diagram for RTT::types::CArrayTypeInfo< T, has_ostream >:
RTT::types::PrimitiveTypeInfo< T, has_ostream > RTT::types::CompositionFactory RTT::types::TypeInfoGenerator

List of all members.

Public Types

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

Public Member Functions

 CArrayTypeInfo (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.
virtual base::AttributeBasebuildVariable (std::string name, int sizehint) const
 Build a modifyable instance of this type.
virtual std::vector< std::string > getMemberNames () const
virtual
base::DataSourceBase::shared_ptr 
getMember (base::DataSourceBase::shared_ptr item, const std::string &name) const
virtual
base::DataSourceBase::shared_ptr 
getMember (base::DataSourceBase::shared_ptr item, base::DataSourceBase::shared_ptr id) const
virtual
base::DataSourceBase::shared_ptr 
decomposeType (base::DataSourceBase::shared_ptr source) const
 Use getMember() for decomposition...
virtual bool composeType (base::DataSourceBase::shared_ptr dssource, base::DataSourceBase::shared_ptr dsresult) const
 Compose a type (target) from a DataSourceBase (source) containing its members.
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 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
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.
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.
Inspecting data structures.

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

virtual bool resize (base::DataSourceBase::shared_ptr arg, int size) const
 Tries to resize a data source in case it's a resizable sequence.
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.

Protected Attributes

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

Detailed Description

template<typename T, bool has_ostream = false>
class RTT::types::CArrayTypeInfo< T, has_ostream >

Template for data types that are C-style arrays.

You can not use this type as a port data type.

C-style arrays are represented by the carray<T> wrapper in the RTT type system.

Parameters:
TA carray<U> wrapper, where U is a C data type.

Definition at line 63 of file CArrayTypeInfo.hpp.


Member Function Documentation

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 , bool has_ostream = false>
virtual base::AttributeBase* RTT::types::CArrayTypeInfo< T, has_ostream >::buildVariable ( std::string  name,
int  sizehint 
) const [inline, virtual]

Build a modifyable instance of this type.

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

Reimplemented from RTT::types::ValueFactory.

Definition at line 87 of file CArrayTypeInfo.hpp.

References RTT::internal::ArrayDataSource< T >::get(), and RTT::internal::ArrayDataSource< T >::newArray().

template<typename T , bool has_ostream = false>
virtual bool RTT::types::CArrayTypeInfo< T, has_ostream >::composeType ( base::DataSourceBase::shared_ptr  source,
base::DataSourceBase::shared_ptr  target 
) const [inline, virtual]

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().

Parameters:
sourceA data source of the same type as target OR a PropertyBag that contains the parts of target to be refreshed.
targetA data source of the same type as this TypeInfo object which contains the data to be updated from source.
Returns:
true if source could be updated, false otherwise.
See also:
types::propertyDecomposition and types::typeDecomposition for the inverse function, decomposing a type into datasources and hierarchical properties.
decomposeType to do the inverse operation.

Implements RTT::types::CompositionFactory.

Definition at line 176 of file CArrayTypeInfo.hpp.

References RTT::types::composePropertyBag(), RTT::base::DataSourceBase::ref(), RTT::refreshProperties(), RTT::internal::DataSource< T >::rvalue(), RTT::internal::AssignableDataSource< T >::set(), RTT::PropertyBag::size(), RTT::types::typeDecomposition(), and RTT::types::Types().

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.

virtual bool RTT::types::MemberFactory::getMember ( internal::Reference ref,
base::DataSourceBase::shared_ptr  item,
const std::string &  name 
) const [virtual, inherited]

Stores a reference to a member of a struct identified by its name.

This method does not allocate memory when item is assignable..

Parameters:
refThe reference object in which to store the reference.
itemThe 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.
nameThe name of a member within item.
Returns:
false if no such member exists, true if ref got filled in otherwise.
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.

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.

template<typename T , bool has_ostream = false>
bool RTT::types::CArrayTypeInfo< T, has_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, has_ostream >.

Definition at line 73 of file CArrayTypeInfo.hpp.

bool MemberFactory::resize ( base::DataSourceBase::shared_ptr  arg,
int  size 
) const [virtual, inherited]

Tries to resize a data source in case it's a resizable sequence.

Returns:
true if the resizing could be done, false otherwise.

Definition at line 8 of file MemberFactory.cpp.


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