00001 /*************************************************************************** 00002 Copyright (c) 2009 S Roderick <xxxkiwi DOT xxxnet AT macxxx DOT comxxx> 00003 (remove the x's above) 00004 00005 *************************************************************************** 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU General Public * 00008 * License as published by the Free Software Foundation; * 00009 * version 2 of the License. * 00010 * * 00011 * As a special exception, you may use this file as part of a free * 00012 * software library without restriction. Specifically, if other files * 00013 * instantiate templates or use macros or inline functions from this * 00014 * file, or you compile this file and link it with other files to * 00015 * produce an executable, this file does not by itself cause the * 00016 * resulting executable to be covered by the GNU General Public * 00017 * License. This exception does not however invalidate any other * 00018 * reasons why the executable file might be covered by the GNU General * 00019 * Public License. * 00020 * * 00021 * This library is distributed in the hope that it will be useful, * 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00024 * Lesser General Public License for more details. * 00025 * * 00026 * You should have received a copy of the GNU General Public * 00027 * License along with this library; if not, write to the Free Software * 00028 * Foundation, Inc., 59 Temple Place, * 00029 * Suite 330, Boston, MA 02111-1307 USA * 00030 * * 00031 ***************************************************************************/ 00032 00033 00034 #ifndef ORO_TYPEKITPLUGIN_HPP 00035 #define ORO_TYPEKITPLUGIN_HPP 1 00036 00037 #include <string> 00038 #include <vector> 00039 #include "../rtt-config.h" 00040 00041 namespace RTT 00042 { namespace types { 00043 00044 00051 class RTT_API TypekitPlugin 00052 { 00053 public: 00054 virtual ~TypekitPlugin() {} 00055 00067 virtual bool loadTypes() = 0; 00068 00079 virtual bool loadOperators() = 0; 00080 00092 virtual bool loadConstructors() = 0; 00093 00099 virtual bool loadGlobals() { return true; } 00100 00106 virtual std::string getName() = 0; 00107 }; 00108 00109 }} 00110 00111 #include "TypekitRepository.hpp" 00112 00113 // Disable foo() has C-linkage specified, but returns UDT 'bar' which is incompatible with C 00114 #ifdef _MSC_VER 00115 #pragma warning (disable:4190) 00116 #endif 00117 00127 #define ORO_TYPEKIT_PLUGIN( TYPEKIT ) \ 00128 namespace RTT { class TaskContext; } \ 00129 extern "C" { \ 00130 RTT_EXPORT bool loadRTTPlugin(RTT::TaskContext* tc); \ 00131 bool loadRTTPlugin(RTT::TaskContext* tc) { \ 00132 if (tc == 0) { \ 00133 RTT::types::TypekitRepository::Import( new TYPEKIT() ); \ 00134 return true; \ 00135 } \ 00136 return false; \ 00137 } \ 00138 RTT_EXPORT std::string getRTTPluginName(); \ 00139 std::string getRTTPluginName() { \ 00140 TYPEKIT tk; \ 00141 return tk.getName(); \ 00142 } \ 00143 RTT_EXPORT std::string getRTTTargetName(); \ 00144 std::string getRTTTargetName() { \ 00145 return OROCOS_TARGET_NAME; \ 00146 } \ 00147 } 00148 00149 #endif