File indexing completed on 2025-01-30 09:17:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/Primitives.h>
0017 #include <DD4hep/Plugins.h>
0018 #include <DDDigi/DigiKernel.h>
0019 #include <DDDigi/DigiAction.h>
0020 #include <DDDigi/DigiPlugins.h>
0021
0022 static inline dd4hep::ComponentCast* component(void* p) { return (dd4hep::ComponentCast*)p; }
0023
0024 void* dd4hep::digi::create_action(const std::string& factory,
0025 const dd4hep::digi::DigiKernel& kernel,
0026 const std::string& arg, void* (*cast)(void*)) {
0027 void* object = PluginService::Create<DigiAction*>(factory, &kernel, arg);
0028 if ( !object ) {
0029 PluginDebug dbg;
0030 object = PluginService::Create<DigiAction*>(factory, &kernel, arg);
0031 if ( !object ) {
0032 except("createPlugin","dd4hep-plugins: Failed to locate plugin %s. \n%s.",
0033 factory.c_str(), dbg.missingFactory(factory).c_str());
0034 }
0035 }
0036 if ( cast ) {
0037 void* obj = cast(object);
0038 if ( obj ) return obj;
0039 ComponentCast* c = component(object);
0040 invalidHandleAssignmentError(typeid(cast),typeid(*c));
0041 }
0042 return object;
0043 }