Skip to content

Commit

Permalink
Issue 875 (plugin return codes). Incuding fixes to examples and plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusFrankATcernch committed Jul 26, 2022
1 parent 7e6ef2f commit 45f06b8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
10 changes: 5 additions & 5 deletions DDCore/include/DD4hep/Factories.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ namespace {

DD4HEP_PLUGIN_FACTORY_ARGS_3(long,dd4hep::Detector*,int,char**) {
static long ret;
ret = dd4hep::ApplyFactory<P>::create(*a0,a1,a2);
//return dd4hep::PluginFactoryBase::make_return<long>(ret);
return (long)&ret;
long result = dd4hep::ApplyFactory<P>::create(*a0,a1,a2);
ret = result;
return long(&ret);
}

DD4HEP_PLUGIN_FACTORY_ARGS_2(ns::Named*,dd4hep::Detector*,ns::xml_h*)
Expand All @@ -233,8 +233,8 @@ namespace {

DD4HEP_PLUGIN_FACTORY_ARGS_2(long,dd4hep::Detector*,ns::xml_h*) {
static long ret;
ret = dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1);
//return dd4hep::PluginFactoryBase::make_return<long>(ret);
long result = dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1);
ret = result;
return long(&ret);
}

Expand Down
7 changes: 0 additions & 7 deletions DDCore/include/DD4hep/Plugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace dd4hep {
template <typename T> static T val(const T* _p) { return T(*_p); }
template <typename T> static T value(const void* _p) { return (T)_p; }
static const char* value(const void* _p) { return (const char*)(_p); }
//template <typename T> static T make_return(const T& _p);// { return _p; }
};
template <> inline int PluginFactoryBase::value<int>(const void* _p) { return *(int*)(_p); }
template <> inline long PluginFactoryBase::value<long>(const void* _p) { return *(long*)(_p); }
Expand Down Expand Up @@ -142,12 +141,6 @@ namespace {
/// Base factory template
template <typename P, typename S> class Factory {};
}
#if 0
namespace dd4hep {
template <> inline long PluginFactoryBase::make_return(const long& value)
{ static long stored=value; return (long)&stored; }
}
#endif

#define DD4HEP_FACTORY_CALL(type,name,signature) dd4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::call)
#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(X,Y)
Expand Down
3 changes: 2 additions & 1 deletion DDG4/include/DDG4/Factories.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ namespace {

DD4HEP_PLUGIN_FACTORY_ARGS_3(long, dd4hep::Detector*, const _ns::GH*, const _ns::STRM*) {
static long ret;
ret = dd4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2);
long result = dd4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2);
ret = result;
return long(&ret);
}
/// Factory to create Geant4 sensitive detectors
Expand Down
1 change: 1 addition & 0 deletions examples/CLICSiD/scripts/CLICSiDAClick.C
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int setupG4_CINT(bool interactive) {
kernel.loadGeometry(("file:"+det_dir+"/DDDetectors/compact/SiD.xml").c_str());
kernel.loadXML(("file:"+install_dir+"/examples/CLICSiD/sim/field.xml").c_str());

kernel.property("NumEvents") = 10;
if ( interactive ) {
kernel.property("UI") = "UI";
setPrintLevel(DEBUG);
Expand Down
1 change: 1 addition & 0 deletions examples/CLICSiD/scripts/CLICSiDXML.C
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int setupG4_XML(bool interactive) {
kernel.loadXML((prefix+"CLICSiD/sim/field.xml").c_str());
kernel.loadXML((prefix+"CLICSiD/sim/sequences.xml").c_str());
kernel.loadXML((prefix+"CLICSiD/sim/physics.xml").c_str());
kernel.property("NumEvents") = 10;
if ( interactive ) {
kernel.property("UI") = "UI";
}
Expand Down

0 comments on commit 45f06b8

Please sign in to comment.