ServicePlugin.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: The SourceWorks  Tue Sep 7 00:55:18 CEST 2010  ServicePlugin.hpp
00003 
00004                         ServicePlugin.hpp -  description
00005                            -------------------
00006     begin                : Tue September 07 2010
00007     copyright            : (C) 2010 The SourceWorks
00008     email                : peter@thesourceworks.com
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00039 #ifndef ORO_SERVICEPLUGIN_HPP_
00040 #define ORO_SERVICEPLUGIN_HPP_
00041 
00042 #include <string>
00043 #include "../TaskContext.hpp"
00044 
00045 namespace RTT {
00046     namespace plugin {
00047 
00048     }
00049 }
00050 
00051 #define ORO_SERVICEPLUGIN_xstr(s) ORO_SERVICEPLUGIN_str(s)
00052 #define ORO_SERVICEPLUGIN_str(s) #s
00053 
00054 // Disable foo() has C-linkage specified, but returns UDT 'bar' which is incompatible with C
00055 #ifdef _MSC_VER
00056 #pragma warning (disable:4190)
00057 #endif
00058 
00070 #define ORO_SERVICE_NAMED_PLUGIN( SERVICE, NAME ) \
00071     extern "C" {\
00072         RTT_EXPORT bool loadRTTPlugin(RTT::TaskContext* tc);  \
00073         bool loadRTTPlugin(RTT::TaskContext* tc) {    \
00074             if (tc == 0) return true; \
00075             RTT::Service::shared_ptr sp( new SERVICE( tc ) ); \
00076             return tc->provides()->addService( sp ); \
00077         } \
00078         RTT_EXPORT RTT::Service::shared_ptr createService();  \
00079         RTT::Service::shared_ptr createService() {    \
00080             RTT::Service::shared_ptr sp( new SERVICE( 0 ) ); \
00081             return sp; \
00082         } \
00083         RTT_EXPORT std::string getRTTPluginName(); \
00084         std::string getRTTPluginName() { \
00085             return NAME; \
00086         } \
00087         RTT_EXPORT std::string getRTTTargetName(); \
00088         std::string getRTTTargetName() { \
00089             return OROCOS_TARGET_NAME; \
00090         } \
00091     }
00092 
00103 #define ORO_SERVICE_PLUGIN( SERVICE ) \
00104     extern "C" {                      \
00105         RTT_EXPORT bool loadRTTPlugin(RTT::TaskContext* tc); \
00106         bool loadRTTPlugin(RTT::TaskContext* tc) {    \
00107             if (tc == 0) return true; \
00108             RTT::Service::shared_ptr sp( new SERVICE( tc ) ); \
00109             return tc->provides()->addService( sp ); \
00110         } \
00111         RTT_EXPORT RTT::Service::shared_ptr createService();  \
00112         RTT::Service::shared_ptr createService() {    \
00113             RTT::Service::shared_ptr sp( new SERVICE( 0 ) ); \
00114             return sp; \
00115         } \
00116         RTT_EXPORT std::string getRTTPluginName(); \
00117         std::string getRTTPluginName() { \
00118             return ORO_SERVICEPLUGIN_xstr(SERVICE); \
00119         } \
00120         RTT_EXPORT std::string getRTTTargetName(); \
00121         std::string getRTTTargetName() { \
00122             return OROCOS_TARGET_NAME; \
00123         } \
00124     }
00125 
00126 #endif /* ORO_SERVICEPLUGIN_HPP_ */


rtt
Author(s): RTT Developers
autogenerated on Thu Jan 2 2014 11:35:25