Orocos Real-Time Toolkit  2.8.3
PrimitiveSequenceTypeInfo.hpp
Go to the documentation of this file.
1 #ifndef ORO_PRIMITIVE_SEQUENCE_TYPE_INFO_HPP
2 #define ORO_PRIMITIVE_SEQUENCE_TYPE_INFO_HPP
3 
4 #include "PrimitiveTypeInfo.hpp"
6 #include "MemberFactory.hpp"
7 
8 namespace RTT
9 {
10  namespace types
11  {
18  template<class T, bool has_ostream=false>
20  : public PrimitiveTypeInfo<T,has_ostream>,
21  public SequenceTypeInfoBase<T>,
22  public MemberFactory,
23  public CompositionFactory
24  {
25  public:
26  PrimitiveSequenceTypeInfo(std::string name)
27  : PrimitiveTypeInfo<T,has_ostream>(name), SequenceTypeInfoBase<T>()
28  {}
29 
31  // aquire a shared reference to the this object
32  boost::shared_ptr< PrimitiveSequenceTypeInfo<T,has_ostream> > mthis = boost::dynamic_pointer_cast<PrimitiveSequenceTypeInfo<T,has_ostream> >( this->getSharedPtr() );
33  assert(mthis);
34  // Allow base to install first
37 
38  // Install the factories for primitive types
39  ti->setMemberFactory( mthis );
40  ti->setCompositionFactory( mthis );
41 
42  // Don't delete us, we're memory-managed.
43  return false;
44  }
45 
47  base::AttributeBase* buildVariable(std::string name,int size) const
48  {
50  }
51 
53  {
54  return SequenceTypeInfoBase<T>::composeType(dssource, dsresult);
55  }
56 
57  virtual bool resize(base::DataSourceBase::shared_ptr arg, int size) const
58  {
59  return SequenceTypeInfoBase<T>::resize(arg,size);
60  }
62  {
64  }
65  virtual std::vector<std::string> getMemberNames() const {
67  }
68 
69  virtual base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string& name) const {
70  return SequenceTypeInfoBase<T>::getMember(item,name);
71  }
72 
75  return SequenceTypeInfoBase<T>::getMember(item, id);
76  }
77  };
78  }
79 }
80 
81 #endif
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.
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.
bool resize(base::DataSourceBase::shared_ptr arg, int size) const
std::vector< std::string > getMemberNames() const
virtual std::vector< std::string > getMemberNames() const
Returns the list of struct member names of this type.
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
void setCompositionFactory(CompositionFactoryPtr cf)
Definition: TypeInfo.hpp:467
A factory for composing/decomposing and converting types to a form suitable for persistent storage...
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string &name) const
An attribute is a minimalistic, named placeholder for data.
base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
Use getMember() for decomposition...
virtual bool resize(base::DataSourceBase::shared_ptr arg, int size) const
Tries to resize a data source in case it&#39;s a resizable sequence.
A class for representing a user type, and which can build instances of that type. ...
Definition: TypeInfo.hpp:66
base::AttributeBase * buildVariable(std::string name, int size) const
void setMemberFactory(MemberFactoryPtr mf)
Definition: TypeInfo.hpp:459
New-style SequenceTypeInfo which offers type info for sequences which can NOT be sent over flow ports...
bool composeType(base::DataSourceBase::shared_ptr dssource, base::DataSourceBase::shared_ptr dsresult) const
Specialize to resize result given the size of source.
virtual base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
Specialize this function to return an alternate type which represents this one in a compatible way...
Template for data types that are C++ STL Sequences with operator[], size() and capacity() methods...
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.
base::AttributeBase * buildVariable(std::string name, int size) const
Build a modifyable instance of this type.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
This template class allows primitive types, which are not sent over ports, to be added to Orocos...
boost::shared_ptr< PrimitiveTypeInfo< T, use_ostream > > getSharedPtr()