File indexing completed on 2026-06-06 07:52:36
0001 #ifndef GAUDIPLUGINSERVICE_INTERFACE_DD4HEP_H
0002 #define GAUDIPLUGINSERVICE_INTERFACE_DD4HEP_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <string>
0017 #include <sstream>
0018 #include <map>
0019 #include <set>
0020 #include <typeinfo>
0021 #include <utility>
0022 #include <any>
0023
0024 #ifdef __clang__
0025 #pragma clang diagnostic push
0026 #pragma clang diagnostic ignored "-Wkeyword-macro"
0027 #pragma clang diagnostic pop
0028 #endif
0029
0030 #if GAUDI_PLUGIN_SERVICE_VERSION == 2
0031 #define GAUDI_PLUGIN_SERVICE_V2 1
0032 #include <Gaudi/PluginService.h>
0033 #elif GAUDI_PLUGIN_SERVICE_VERSION == 1
0034 #define private public
0035 #define GAUDI_PLUGIN_SERVICE_V1 1
0036 #include <Gaudi/PluginService.h>
0037 #undef private
0038 #endif
0039
0040 #define MAKE_GAUDI_PLUGIN_SERVICE_ENTRY(n,v) dd4hep_pluginmgr_##n##_V##v
0041 #define MAKE_FUNC(name,version) MAKE_GAUDI_PLUGIN_SERVICE_ENTRY(name,version)
0042
0043 extern "C" {
0044
0045 int MAKE_FUNC(getdebug,GAUDI_PLUGIN_SERVICE_VERSION) () {
0046 return (int)Gaudi::PluginService::Debug();
0047 }
0048
0049 int MAKE_FUNC(setdebug,GAUDI_PLUGIN_SERVICE_VERSION)(int value) {
0050 int debug = (int)Gaudi::PluginService::Debug();
0051 Gaudi::PluginService::SetDebug(value);
0052 return debug;
0053 }
0054
0055 #if GAUDI_PLUGIN_SERVICE_VERSION==2
0056 std::any MAKE_FUNC(create,GAUDI_PLUGIN_SERVICE_VERSION)(const char* id, const char* ) {
0057 using namespace Gaudi::PluginService::v2;
0058 const Details::Registry::FactoryInfo& info = Details::Registry::instance().getInfo(id, true);
0059 return info.factory;
0060 }
0061 #elif GAUDI_PLUGIN_SERVICE_VERSION==1
0062 std::any MAKE_FUNC(create,GAUDI_PLUGIN_SERVICE_VERSION)(const char* id, const char* sig) {
0063 std::any ret;
0064 ret = (void*)Gaudi::PluginService::Details::getCreator(id,sig);
0065 return ret;
0066 }
0067 #endif
0068 #if GAUDI_PLUGIN_SERVICE_VERSION==2
0069
0070 void MAKE_FUNC(add_factory,GAUDI_PLUGIN_SERVICE_VERSION)(const char* id, std::any&& stub, const char* , const char* ) {
0071 using namespace Gaudi::PluginService::v2;
0072 Details::Registry::Properties props = {};
0073 std::string lib_name = "";
0074 Details::Registry::instance().add( id, {std::move(lib_name), std::move( stub ), std::move( props )} );
0075 }
0076 #elif GAUDI_PLUGIN_SERVICE_VERSION==1
0077
0078 void MAKE_FUNC(add_factory,GAUDI_PLUGIN_SERVICE_VERSION)(const char* id, std::any&& stub, const char* sig, const char* ret) {
0079 Gaudi::PluginService::Details::Registry::instance().add(id, std::any_cast<void*>(stub), sig, ret, id);
0080 }
0081 #endif
0082 }
0083
0084 #endif