Orocos Real-Time Toolkit  2.9.0
SequenceTypeInfo.hpp
Go to the documentation of this file.
1 #ifndef ORO_SEQUENCE_TYPE_INFO_HPP
2 #define ORO_SEQUENCE_TYPE_INFO_HPP
3 
4 #include "TemplateTypeInfo.hpp"
6 #include "MemberFactory.hpp"
7 
8 namespace RTT
9 {
10  namespace types
11  {
16  template<class T, bool has_ostream=false>
17  class SequenceTypeInfo
18  : public TemplateTypeInfo<T,has_ostream>, public SequenceTypeInfoBase<T>, public MemberFactory
19  {
20  public:
21  SequenceTypeInfo(std::string name)
22  : TemplateTypeInfo<T,has_ostream>(name), SequenceTypeInfoBase<T>()
23  {}
24 
26  // aquire a shared reference to the this object
27  boost::shared_ptr< SequenceTypeInfo<T,has_ostream> > mthis = boost::dynamic_pointer_cast<SequenceTypeInfo<T,has_ostream> >( this->getSharedPtr() );
28  assert(mthis);
29  // Allow base to install first
32  // Install the factories for primitive types
33  ti->setMemberFactory( mthis );
34  // Don't delete us, we're memory-managed.
35  return false;
36  }
37 
39  base::AttributeBase* buildVariable(std::string name,int size) const
40  {
42  }
43 
45  {
46  return SequenceTypeInfoBase<T>::composeType(dssource, dsresult);
47  }
48 
49  virtual bool resize(base::DataSourceBase::shared_ptr arg, int size) const
50  {
51  return SequenceTypeInfoBase<T>::resize(arg,size);
52  }
54  {
56  }
57  virtual std::vector<std::string> getMemberNames() const {
59  }
60 
61  virtual base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string& name) const {
62  return SequenceTypeInfoBase<T>::getMember(item,name);
63  }
64 
67  return SequenceTypeInfoBase<T>::getMember(item, id);
68  }
69  };
70  }
71 }
72 
73 #endif
This template class allows user types to be used in all Orocos primitives.
bool resize(base::DataSourceBase::shared_ptr arg, int size) const
std::vector< std::string > getMemberNames() const
virtual base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
A primitive type is decomposed into itself.
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.
SequenceTypeInfo(std::string name)
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
Returns a member of a given data source identified by a data source id.
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 composeType(base::DataSourceBase::shared_ptr dssource, base::DataSourceBase::shared_ptr dsresult) const
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
A class for representing a user type, and which can build instances of that type. ...
Definition: TypeInfo.hpp:67
base::AttributeBase * buildVariable(std::string name, int size) const
void setMemberFactory(MemberFactoryPtr mf)
Definition: TypeInfo.hpp:461
bool composeType(base::DataSourceBase::shared_ptr dssource, base::DataSourceBase::shared_ptr dsresult) const
Specialize to resize result given the size of source.
Template for data types that are C++ STL Sequences with operator[], size() and capacity() methods...
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
virtual std::vector< std::string > getMemberNames() const
Returns the list of struct member names 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:52
Old-style SequenceTypeInfo which offers type info for sequences which can be sent over flow ports...
base::AttributeBase * buildVariable(std::string name, int size) const
Build a modifyable instance of this type.
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.
boost::shared_ptr< PrimitiveTypeInfo< T, use_ostream > > getSharedPtr()