Orocos Real-Time Toolkit  2.9.0
TypeInfoRepository.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 19 14:11:26 CET 2004 TypeInfoRepository.hpp
3 
4  TypeInfoRepository.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_CORELIB_TYPEINFOREPOSITORY_HPP
39 #define ORO_CORELIB_TYPEINFOREPOSITORY_HPP
40 
41 #include <map>
42 #include <vector>
43 #include <string>
44 #include <boost/shared_ptr.hpp>
45 #include <boost/function.hpp>
46 #include "TypeInfo.hpp"
47 #include "TypeInfoGenerator.hpp"
48 
49 namespace RTT
50 { namespace types {
51 
57  {
59  typedef std::map<std::string, TypeInfo*> map_t;
60  map_t data;
61 
62  typedef std::vector<TransportPlugin*> Transports;
63  Transports transports;
64  mutable os::Mutex type_lock;
65 
66  boost::function<bool (const std::string &)> loadTypeKitForName;
67 
68  TypeInfo* typeInternal( const std::string& name ) const;
69  public:
70  ~TypeInfoRepository();
71  typedef boost::shared_ptr<TypeInfoRepository> shared_ptr;
72  static shared_ptr Instance();
73  static void Release();
74 
75  void setAutoLoader(const boost::function<bool (const std::string &)> &loader);
76 
82  TypeInfo* type( const std::string& name ) const;
83 
91  bool addType( TypeInfo* ti );
92 
98  bool addType( TypeInfoGenerator* tig );
99 
105  std::vector<std::string> getTypes() const;
106 
111  std::vector<std::string> getDottedTypes() const;
112 
117  std::string toDot( const std::string& type ) const;
118 
122  TypeInfo* getTypeById(TypeInfo::TypeId type_id) const;
123 
127  TypeInfo* getTypeById(const char * type_id_name) const;
128 
132  template<class T>
134  return getTypeById( &typeid(T) );
135  }
136 
141  void registerTransport( TransportPlugin* tr );
142 
147  void logTypeInfo() const;
148 
149  };
150 
151 }}
152 
153 #endif
This class contains all known types to Orocos.
const std::type_info * TypeId
Definition: TypeInfo.hpp:70
TypeInfo * getTypeInfo() const
Return the type info structure of a given type T.
#define RTT_API
Definition: rtt-config.h:97
A class which registers TypeTransporter instances to types.
All generator classes inherit from this object in order to allow them to be added to the TypeInfoRepo...
A class for representing a user type, and which can build instances of that type. ...
Definition: TypeInfo.hpp:67
An object oriented wrapper around a non recursive mutex.
Definition: Mutex.hpp:92
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
boost::shared_ptr< TypeInfoRepository > shared_ptr