Orocos Real-Time Toolkit  2.9.0
TypekitPlugin.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright (c) 2009 S Roderick <xxxkiwi DOT xxxnet AT macxxx DOT comxxx>
3  (remove the x's above)
4 
5  ***************************************************************************
6  * This library is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public *
8  * License as published by the Free Software Foundation; *
9  * version 2 of the License. *
10  * *
11  * As a special exception, you may use this file as part of a free *
12  * software library without restriction. Specifically, if other files *
13  * instantiate templates or use macros or inline functions from this *
14  * file, or you compile this file and link it with other files to *
15  * produce an executable, this file does not by itself cause the *
16  * resulting executable to be covered by the GNU General Public *
17  * License. This exception does not however invalidate any other *
18  * reasons why the executable file might be covered by the GNU General *
19  * Public License. *
20  * *
21  * This library is distributed in the hope that it will be useful, *
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
24  * Lesser General Public License for more details. *
25  * *
26  * You should have received a copy of the GNU General Public *
27  * License along with this library; if not, write to the Free Software *
28  * Foundation, Inc., 59 Temple Place, *
29  * Suite 330, Boston, MA 02111-1307 USA *
30  * *
31  ***************************************************************************/
32 
33 
34 #ifndef ORO_TYPEKITPLUGIN_HPP
35 #define ORO_TYPEKITPLUGIN_HPP 1
36 
37 #include <string>
38 #include <vector>
39 #include "../rtt-config.h"
40 
41 namespace RTT
42 { namespace types {
43 
44 
52  {
53  public:
54  virtual ~TypekitPlugin() {}
55 
67  virtual bool loadTypes() = 0;
68 
79  virtual bool loadOperators() = 0;
80 
92  virtual bool loadConstructors() = 0;
93 
99  virtual bool loadGlobals() { return true; }
100 
106  virtual std::string getName() = 0;
107  };
108 
109 }}
110 
111 #include "TypekitRepository.hpp"
112 
113 // Disable foo() has C-linkage specified, but returns UDT 'bar' which is incompatible with C
114 #ifdef _MSC_VER
115 #pragma warning (disable:4190)
116 #endif
117 
118 #ifdef __clang__
119 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
120 #endif
121 
131 #define ORO_TYPEKIT_PLUGIN( TYPEKIT ) \
132  namespace RTT { class TaskContext; } \
133  extern "C" { \
134  RTT_EXPORT bool loadRTTPlugin(RTT::TaskContext* tc); \
135  bool loadRTTPlugin(RTT::TaskContext* tc) { \
136  if (tc == 0) { \
137  RTT::types::TypekitRepository::Import( new TYPEKIT() ); \
138  return true; \
139  } \
140  return false; \
141  } \
142  RTT_EXPORT std::string getRTTPluginName(); \
143  std::string getRTTPluginName() { \
144  TYPEKIT tk; \
145  return tk.getName(); \
146  } \
147  RTT_EXPORT std::string getRTTTargetName(); \
148  std::string getRTTTargetName() { \
149  return OROCOS_TARGET_NAME; \
150  } \
151  }
152 
153 #endif
virtual bool loadGlobals()
Implement this function to add global variables to the type system.
This interface defines how additional typekits are loaded into Orocos.
#define RTT_API
Definition: rtt-config.h:97
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52