DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PluginCreators.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation for LCD
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // \author Markus Frank
11 // \date 2016-01-29
12 // \version 1.0
13 //
14 //==========================================================================
15 #ifndef DD4HEP_PLUGINCREATORS_H
16 #define DD4HEP_PLUGINCREATORS_H 1
17 
18 // Framework include files
19 #include "DD4hep/Primitives.h"
20 
21 // C/C++ include files
22 #include <string>
23 
25 namespace DD4hep {
26 
28  namespace Geometry {
29  // Forward declarations
30  class LCDD;
31  }
32 
34 
39  void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, void* (*cast)(void*));
40  void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, const std::string& arg, void* (*cast)(void*));
41  void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, int argc, char** argv, void* (*cast)(void*));
42  void* createProcessor(Geometry::LCDD& lcdd, int argc, char** argv, void* (*cast)(void*));
43 
45  template <typename T> T* createPlugin(const std::string& factory, Geometry::LCDD& lcdd) {
46  typedef T plugin_t;
47  struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } };
48  return (plugin_t*)createPlugin(factory, lcdd, __cast::cast);
49  }
51  template <typename T> T* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, const std::string& arg) {
52  typedef T plugin_t;
53  struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } };
54  return (plugin_t*)createPlugin(factory, lcdd, arg, __cast::cast);
55  }
57  template <typename T> T* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, int argc, const void** argv) {
58  typedef T plugin_t;
59  struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } };
60  return (plugin_t*)createPlugin(factory, lcdd, argc, (char**)argv, __cast::cast);
61  }
62 
64  template <typename T> T* createProcessor(Geometry::LCDD& lcdd, int argc, char** argv) {
65  typedef T plugin_t;
66  struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } };
67  return (plugin_t*)createProcessor(lcdd, argc, argv, __cast::cast);
68  }
69 
71  template <typename T> T* createProcessor(Geometry::LCDD& lcdd, int argc, const void** argv) {
72  typedef T plugin_t;
73  struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } };
74  return (plugin_t*)createProcessor(lcdd, argc, (char**)argv, __cast::cast);
75  }
76 
77 } /* End namespace DD4hep */
78 
79 #endif // DD4HEP_PLUGINCREATORS_H
void * createPlugin(const std::string &factory, Geometry::LCDD &lcdd, int argc, char **argv, void *(*cast)(void *))
void * createProcessor(Geometry::LCDD &lcdd, int argc, char **argv, void *(*cast)(void *))
The main interface to the DD4hep detector description package.
Definition: LCDD.h:82