Skip to content
Snippets Groups Projects
Commit 480ef37e authored by Markus Frank's avatar Markus Frank Committed by MarkusFrankATcernch
Browse files

Externalize properties

parent f5854933
No related branches found
No related tags found
No related merge requests found
......@@ -26,14 +26,23 @@
#include "DD4hep/Primitives.h"
#include "DD4hep/BasicGrammar.h"
#include "XML/Evaluator.h"
#ifdef DD4HEP_USE_BOOST
#if defined(DD4HEP_PARSER_HEADER)
#define DD4HEP_NEED_EVALUATOR
// This is the case, if the parsers are externalized
// and the DD4hep namespace is renamed!
#include DD4HEP_PARSER_HEADER
#else
#include "XML/Evaluator.h"
#include "DD4hep/Parsers.h"
#include "DD4hep/ToStream.h"
namespace DD4hep { XmlTools::Evaluator& g4Evaluator(); }
#endif
namespace { static XmlTools::Evaluator& s__eval(DD4hep::g4Evaluator()); }
#endif
#endif
#ifndef DD4HEP_PARSERS_NO_ROOT
#include "Math/Point3D.h"
......
......@@ -71,6 +71,7 @@ namespace DD4hep {
} // End namespace DD4hep
#ifndef DD4HEP_PARSERS_NO_ROOT
// These operators do not really belong here, but also nowhere else.....
// ....except the proper ROOT headers perhaps?
#include "Math/Point3D.h"
......@@ -80,13 +81,14 @@ namespace DD4hep {
namespace ROOT {
namespace Math {
/// Allow point insertion of a point in maps
bool operator<(const XYZPoint& a, const XYZPoint& b);
inline bool operator<(const XYZPoint& a, const XYZPoint& b);
/// Allow 3-vector insertion of a in maps
bool operator<(const XYZVector& a, const XYZVector& b);
inline bool operator<(const XYZVector& a, const XYZVector& b);
/// Allow 4-vector insertion of a in maps
bool operator<(const PxPyPzEVector& a, const PxPyPzEVector& b);
inline bool operator<(const PxPyPzEVector& a, const PxPyPzEVector& b);
}
}
#endif
// Instantiate single property
#define DD4HEP_DEFINE_PROPERTY_TYPE(x) \
......
......@@ -19,7 +19,10 @@
#include <string>
#include <vector>
#include <typeinfo>
#ifndef DD4HEP_PARSERS_NO_ROOT
#include "RVersion.h"
#endif
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
......@@ -109,7 +112,7 @@ namespace DD4hep {
const std::type_info& signature_type,
const std::type_info& return_type);
#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#if !defined(DD4HEP_PARSERS_NO_ROOT) && ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
template <typename R> static R Create(const std::string& name);
template <typename R, typename A0>
......@@ -142,7 +145,7 @@ namespace DD4hep {
public:
typedef PluginService svc_t;
typedef SIGNATURE signature_t;
#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#if !defined(DD4HEP_PARSERS_NO_ROOT) && ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
typedef void (*stub_t)(void *retaddr, void*, const std::vector<void*>& arg, void*);
static void add(const char* name, stub_t stub);
#else
......@@ -153,7 +156,7 @@ namespace DD4hep {
};
} /* End namespace DD4hep */
#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#if !defined(DD4HEP_PARSERS_NO_ROOT) && ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#define DD4HEP_FACTORY_CALL(type,name,signature) DD4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::wrapper);
#else
namespace DD4hep {
......
......@@ -17,7 +17,7 @@
#include "DD4hep/Plugins.h"
#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#if !defined(DD4HEP_PARSERS_NO_ROOT) && ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#include <set>
#include <map>
#include <list>
......
......@@ -253,10 +253,6 @@ namespace DD4hep {
#include <set>
#include <map>
#include "Math/Point3D.h"
#include "Math/Vector3D.h"
#include "Math/Vector4D.h"
#include "DD4hep/BasicGrammar_inl.h"
#include "DD4hep/ComponentProperties_inl.h"
DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(Property)
......@@ -290,9 +286,17 @@ namespace DD4hep {
typedef map<string, string> map_string_string;
DD4HEP_DEFINE_PROPERTY_TYPE(map_string_string);
}
#ifndef DD4HEP_PARSERS_NO_ROOT
#include "Math/Point3D.h"
#include "Math/Vector3D.h"
#include "Math/Vector4D.h"
namespace DD4hep {
// ROOT::Math Object instances
DD4HEP_DEFINE_PROPERTY_TYPE(ROOT::Math::XYZPoint);
DD4HEP_DEFINE_PROPERTY_TYPE(ROOT::Math::XYZVector);
DD4HEP_DEFINE_PROPERTY_TYPE(ROOT::Math::PxPyPzEVector);
}
#endif
......@@ -13,11 +13,11 @@
//==========================================================================
// Framework include files
#include "DD4hep/LCDD.h"
#include "DD4hep/Handle.h"
//#include "DD4hep/LCDD.h"
//#include "DD4hep/Handle.h"
#include "DD4hep/Plugins.inl"
#include "DD4hep/GeoHandler.h"
#include "XML/XMLElements.h"
//#include "DD4hep/GeoHandler.h"
//#include "XML/XMLElements.h"
using namespace std;
using namespace DD4hep;
......@@ -40,7 +40,7 @@ bool PluginService::setDebug(bool new_value) {
return old_value;
}
#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
#if !defined(DD4HEP_PARSERS_NO_ROOT) && ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
/// Default constructor
PluginDebug::PluginDebug(int dbg)
......@@ -68,7 +68,11 @@ void PluginService::addFactory(const std::string&, void*, const std::type_info&
#else // ROOT 6
#include "DD4hep/Printout.h"
#if !defined(DD4HEP_PARSERS_NO_ROOT)
#include "TSystem.h"
#else
#include <dlfcn.h>
#endif
namespace {
struct PluginInterface {
......@@ -88,7 +92,14 @@ namespace {
template <typename T>
static inline T get_func(const char* plugin, const char* entry) {
#if !defined(DD4HEP_PARSERS_NO_ROOT)
PluginService::FuncPointer<Func_t> fun(gSystem->DynFindSymbol(plugin,entry));
#else
PluginService::FuncPointer<Func_t> fun(0);
if ( 0 == fun.fun.ptr ) {
}
#endif
PluginService::FuncPointer<T> fp(fun.fptr.ptr);
if ( 0 == fp.fptr.ptr ) {
string err = "DD4hep:PluginService: Failed to access symbol "
......
......@@ -14,6 +14,8 @@
// Framework include files
#if defined(DD4HEP_PARSER_HEADER)
#define DD4HEP_NEED_EVALUATOR
// This is the case, if the parsers are externalized
// and the DD4hep namespace is renamed!
#include DD4HEP_PARSER_HEADER
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment