DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
PluginCreators.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
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 
27  // Forward declarations
28  class Detector;
29 
31 
36  void* createPlugin(const std::string& factory, Detector& description, void* (*cast)(void*));
37  void* createPlugin(const std::string& factory, Detector& description, const std::string& arg, void* (*cast)(void*));
38  void* createPlugin(const std::string& factory, Detector& description, int argc, char** argv, void* (*cast)(void*));
39  void* createProcessor(Detector& description, int argc, char** argv, void* (*cast)(void*));
40 
42  template <typename T> T* createPlugin(const std::string& factory, Detector& description) {
43  struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
44  return (T*)createPlugin(factory, description, __cast::cast);
45  }
47  template <typename T> T* createPlugin(const std::string& factory, Detector& description, const std::string& arg) {
48  struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
49  return (T*)createPlugin(factory, description, arg, __cast::cast);
50  }
52  template <typename T> T* createPlugin(const std::string& factory, Detector& description, int argc, const void** argv) {
53  struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
54  return (T*)createPlugin(factory, description, argc, (char**)argv, __cast::cast);
55  }
56 
58  template <typename T> T* createProcessor(Detector& description, int argc, char** argv) {
59  struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
60  return (T*)createProcessor(description, argc, argv, __cast::cast);
61  }
62 
64  template <typename T> T* createProcessor(Detector& description, int argc, const void** argv) {
65  struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
66  return (T*)createProcessor(description, argc, (char**)argv, __cast::cast);
67  }
68 
69 } /* End namespace dd4hep */
70 
71 #endif // DD4HEP_PLUGINCREATORS_H
dd4hep::createProcessor
void * createProcessor(Detector &description, int argc, char **argv, void *(*cast)(void *))
Definition: PluginCreators.cpp:29
dd4hep::createPlugin
void * createPlugin(const std::string &factory, Detector &description, void *(*cast)(void *))
Handler for factories of type: ConstructionFactory.
Definition: PluginCreators.cpp:90
Primitives.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90