Plugin.h
Go to the documentation of this file.
00001 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00002 // This file is part of FZIs ic_workspace.
00003 //
00004 // This program is free software licensed under the LGPL
00005 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00006 // You can find a copy of this license in LICENSE folder in the top
00007 // directory of the source code.
00008 //
00009 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00010 //
00011 // -- END LICENSE BLOCK ------------------------------------------------
00012 
00013 // ----------------------------------------------------------
00014 /*
00015  * Plugin.h
00016  *
00017  * Created by schamm on 22.11.2009.
00018  * Copyright 2009
00019  * Company Forschungszentrum Informatik (FZI), Abteilung IDS.
00020  * All rights reserved.
00021  *
00022  */
00023 // ----------------------------------------------------------
00032 // ----------------------------------------------------------
00033 
00034 
00035 #ifndef ICL_CORE_PLUGIN_PLUGIN_H_INCLUDED
00036 #define ICL_CORE_PLUGIN_PLUGIN_H_INCLUDED
00037 
00038 #include "icl_core_plugin/ImportExport.h"
00039 #include "icl_core_plugin/PluginManager.h"
00040 #include "icl_core_plugin/Logging.h"
00041 
00042 #include <string>
00043 
00044 #if defined(_SYSTEM_WIN32_) && defined(_IC_STATIC_)
00045   #define ICL_CORE_PLUGIN_LINKAGE static
00046 #else // defined(_SYSTEM_WIN32_) && defined(_IC_STATIC_)
00047   #define ICL_CORE_PLUGIN_LINKAGE
00048 #endif // defined(_SYSTEM_WIN32_) && defined(_IC_STATIC_)
00049 
00050 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN_INTERFACE(name)  \
00051   public:                                               \
00052   virtual std::string Identifier() const = 0;           \
00053   typedef const char* identifier();                     \
00054   typedef const char* basetype();                       \
00055   typedef name* load_plugin();                          \
00056   typedef void unload_plugin(name*);
00057 
00058 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN          \
00059   public:                                       \
00060   virtual std::string Identifier() const;       \
00061 
00062 #define ICL_CORE_PLUGIN_REGISTER_PLUGIN_IMPORT_EXPORT(decl, base, derived, plugin_identifier) \
00063   std::string derived::Identifier() const                               \
00064   {                                                                     \
00065     return plugin_identifier;                                           \
00066   }                                                                     \
00067                                                                         \
00068   extern "C" ICL_CORE_PLUGIN_LINKAGE decl const char * identifier()          \
00069   {                                                                     \
00070     return plugin_identifier;                                           \
00071   }                                                                     \
00072                                                                         \
00073   extern "C" ICL_CORE_PLUGIN_LINKAGE decl const char * basetype()            \
00074   {                                                                     \
00075     return typeid(base).name();                                         \
00076   }                                                                     \
00077                                                                         \
00078   extern "C" ICL_CORE_PLUGIN_LINKAGE decl base* load_plugin()                \
00079   {                                                                     \
00080     return new derived;                                                 \
00081   }                                                                     \
00082                                                                         \
00083   extern "C" ICL_CORE_PLUGIN_LINKAGE decl void unload_plugin(derived* p)     \
00084   {                                                                     \
00085     delete p;                                                           \
00086   }
00087 
00088 #define ICL_CORE_PLUGIN_REGISTER_PLUGIN(base, derived, plugin_identifier) \
00089   ICL_CORE_PLUGIN_REGISTER_PLUGIN_IMPORT_EXPORT(, base, derived, plugin_identifier)
00090 
00091 #define ICL_CORE_PLUGIN_MANAGER_DEFINITION(name, interface, directory)  \
00092   name : public icl_core::plugin::PluginManager<interface, directory> { \
00093     name()                                                              \
00094     {                                                                   \
00095       LOGGING_TRACE(icl_core::plugin::Plugin, "Using plugin search path " \
00096                     << directory << icl_core::logging::endl);           \
00097     }                                                                   \
00098   };
00099 
00100 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN_MANAGER(name, interface, directory) \
00101   class ICL_CORE_PLUGIN_MANAGER_DEFINITION(name, interface, directory)
00102 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN_MANAGER_IMPORT_EXPORT(decl, name, interface, directory) \
00103   class decl ICL_CORE_PLUGIN_MANAGER_DEFINITION(name, interface, directory)
00104 
00105 #endif /* _icl_core_plugin_Plugin_h_ */


fzi_icl_core
Author(s):
autogenerated on Tue Aug 8 2017 02:28:03