File indexing completed on 2025-02-21 09:58:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef DD4HEP_PLUGINCREATORS_H
0016 #define DD4HEP_PLUGINCREATORS_H 1
0017
0018
0019 #include <DD4hep/Primitives.h>
0020
0021
0022 #include <string>
0023
0024
0025 namespace dd4hep {
0026
0027
0028 class Detector;
0029
0030
0031
0032
0033
0034
0035
0036 void* createPlugin(const std::string& factory, Detector& description, void* (*cast)(void*));
0037 void* createPlugin(const std::string& factory, Detector& description, const std::string& arg, void* (*cast)(void*));
0038 void* createPlugin(const std::string& factory, Detector& description, int argc, char** argv, void* (*cast)(void*));
0039 void* createProcessor(Detector& description, int argc, char** argv, void* (*cast)(void*));
0040
0041
0042 template <typename T> T* createPlugin(const std::string& factory, Detector& description) {
0043 struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
0044 return (T*)createPlugin(factory, description, __cast::cast);
0045 }
0046
0047 template <typename T> T* createPlugin(const std::string& factory, Detector& description, const std::string& arg) {
0048 struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
0049 return (T*)createPlugin(factory, description, arg, __cast::cast);
0050 }
0051
0052 template <typename T> T* createPlugin(const std::string& factory, Detector& description, int argc, const void** argv) {
0053 struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
0054 return (T*)createPlugin(factory, description, argc, (char**)argv, __cast::cast);
0055 }
0056
0057
0058 template <typename T> T* createProcessor(Detector& description, int argc, char** argv) {
0059 struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
0060 return (T*)createProcessor(description, argc, argv, __cast::cast);
0061 }
0062
0063
0064 template <typename T> T* createProcessor(Detector& description, int argc, const void** argv) {
0065 struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
0066 return (T*)createProcessor(description, argc, (char**)argv, __cast::cast);
0067 }
0068
0069 }
0070
0071 #endif