Orocos Real-Time Toolkit  2.8.3
TemplateTypeInfo.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 19 14:11:26 CET 2004 Types.hpp
3 
4  Types.hpp - description
5  -------------------
6  begin : Mon January 19 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 #ifndef ORO_TEMPLATE_TYPEINFO_HPP
39 #define ORO_TEMPLATE_TYPEINFO_HPP
40 
41 #include "Types.hpp"
42 #include "../Property.hpp"
43 #include "../Attribute.hpp"
44 #include "../Logger.hpp"
45 #include "../InputPort.hpp"
46 #include "../OutputPort.hpp"
47 #include "PrimitiveTypeInfo.hpp"
48 #include "TemplateConnFactory.hpp"
50 
51 #include "../rtt-config.h"
52 
53 namespace RTT
54 {
55  namespace types {
56 
73  template<typename T, bool use_ostream = false>
74  class TemplateTypeInfo
75  : public PrimitiveTypeInfo<T, use_ostream>,
76  public TemplateConnFactory<T>,
77  public TemplateCompositionFactory<T>
78  {
79  public:
83  typedef T UserType;
84 
92  TemplateTypeInfo(std::string name)
93  : PrimitiveTypeInfo<T,use_ostream>(name)
94  {
95  }
96 
98  {
99  }
100 
101 
103  base::OutputPortInterface& output_port,
104  types::TypeInfo const* type_info,
105  base::InputPortInterface& input, const ConnPolicy& policy) {
107  }
108 
110  // aquire a shared reference to the this object
111  boost::shared_ptr< TemplateTypeInfo<T,use_ostream> > mthis = boost::dynamic_pointer_cast<TemplateTypeInfo<T,use_ostream> >( this->getSharedPtr() );
112  assert(mthis);
113  // Allow base to install first
115  // Install the factories for primitive types
116  ti->setPortFactory( mthis );
117  ti->setCompositionFactory( mthis );
118 
119  // Don't delete us, we're memory-managed.
120  return false;
121  }
122  };
123 }}
124 
125 #endif
The base class of the InputPort.
virtual base::ChannelElementBase::shared_ptr buildRemoteChannelOutput(base::OutputPortInterface &output_port, types::TypeInfo const *type_info, base::InputPortInterface &input, const ConnPolicy &policy)
This template class allows user types to be used in all Orocos primitives.
void setCompositionFactory(CompositionFactoryPtr cf)
Definition: TypeInfo.hpp:467
A connection policy object describes how a given connection should behave.
Definition: ConnPolicy.hpp:92
The base class of each OutputPort.
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
TemplateTypeInfo(std::string name)
Setup Type Information for type name.
A class for representing a user type, and which can build instances of that type. ...
Definition: TypeInfo.hpp:66
boost::intrusive_ptr< ChannelElementBase > shared_ptr
T UserType
The given T parameter is the type for reading DataSources.
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
void setPortFactory(ConnFactoryPtr cf)
Installs a new port factory such that in-process data can be communicated between components...
Definition: TypeInfo.hpp:455
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()