Plugin.h
Go to the documentation of this file.
1 // -- BEGIN LICENSE BLOCK ----------------------------------------------
2 // This file is part of FZIs ic_workspace.
3 //
4 // This program is free software licensed under the LGPL
5 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
6 // You can find a copy of this license in LICENSE folder in the top
7 // directory of the source code.
8 //
9 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
10 //
11 // -- END LICENSE BLOCK ------------------------------------------------
12 
13 // ----------------------------------------------------------
14 /*
15  * Plugin.h
16  *
17  * Created by schamm on 22.11.2009.
18  * Copyright 2009
19  * Company Forschungszentrum Informatik (FZI), Abteilung IDS.
20  * All rights reserved.
21  *
22  */
23 // ----------------------------------------------------------
32 // ----------------------------------------------------------
33 
34 
35 #ifndef ICL_CORE_PLUGIN_PLUGIN_H_INCLUDED
36 #define ICL_CORE_PLUGIN_PLUGIN_H_INCLUDED
37 
41 
42 #include <string>
43 
44 #if defined(_SYSTEM_WIN32_) && defined(_IC_STATIC_)
45  #define ICL_CORE_PLUGIN_LINKAGE static
46 #else // defined(_SYSTEM_WIN32_) && defined(_IC_STATIC_)
47  #define ICL_CORE_PLUGIN_LINKAGE
48 #endif // defined(_SYSTEM_WIN32_) && defined(_IC_STATIC_)
49 
50 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN_INTERFACE(name) \
51  public: \
52  virtual std::string Identifier() const = 0; \
53  typedef const char* identifier(); \
54  typedef const char* basetype(); \
55  typedef name* load_plugin(); \
56  typedef void unload_plugin(name*);
57 
58 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN \
59  public: \
60  virtual std::string Identifier() const; \
61 
62 #define ICL_CORE_PLUGIN_REGISTER_PLUGIN_IMPORT_EXPORT(decl, base, derived, plugin_identifier) \
63  std::string derived::Identifier() const \
64  { \
65  return plugin_identifier; \
66  } \
67  \
68  extern "C" ICL_CORE_PLUGIN_LINKAGE decl const char * identifier() \
69  { \
70  return plugin_identifier; \
71  } \
72  \
73  extern "C" ICL_CORE_PLUGIN_LINKAGE decl const char * basetype() \
74  { \
75  return typeid(base).name(); \
76  } \
77  \
78  extern "C" ICL_CORE_PLUGIN_LINKAGE decl base* load_plugin() \
79  { \
80  return new derived; \
81  } \
82  \
83  extern "C" ICL_CORE_PLUGIN_LINKAGE decl void unload_plugin(derived* p) \
84  { \
85  delete p; \
86  }
87 
88 #define ICL_CORE_PLUGIN_REGISTER_PLUGIN(base, derived, plugin_identifier) \
89  ICL_CORE_PLUGIN_REGISTER_PLUGIN_IMPORT_EXPORT(, base, derived, plugin_identifier)
90 
91 #define ICL_CORE_PLUGIN_MANAGER_DEFINITION(name, interface, directory) \
92  name : public icl_core::plugin::PluginManager<interface, directory> { \
93  name() \
94  { \
95  LOGGING_TRACE(icl_core::plugin::Plugin, "Using plugin search path " \
96  << directory << icl_core::logging::endl); \
97  } \
98  };
99 
100 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN_MANAGER(name, interface, directory) \
101  class ICL_CORE_PLUGIN_MANAGER_DEFINITION(name, interface, directory)
102 #define ICL_CORE_PLUGIN_DECLARE_PLUGIN_MANAGER_IMPORT_EXPORT(decl, name, interface, directory) \
103  class decl ICL_CORE_PLUGIN_MANAGER_DEFINITION(name, interface, directory)
104 
105 #endif /* _icl_core_plugin_Plugin_h_ */
Contains import/export definitions for the Win32 plattform.
Contains logging definitions for the icl_core_plugin library.
Contains PluginManager.


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58