From 314dff32346391b4c5d14dc2b0feb81bd663b932 Mon Sep 17 00:00:00 2001
From: Markus FRANK <Markus.Frank@cern.ch>
Date: Thu, 28 Jan 2021 21:00:15 +0100
Subject: [PATCH] Move Grammar headers to public include directory

---
 DDCore/CMakeLists.txt                         |  4 +-
 DDCore/include/DD4hep/Conditions.h            | 20 ++++-
 .../Grammar_parsed.h => GrammarParsed.h}      | 10 ++-
 .../Grammar_unparsed.h => GrammarUnparsed.h}  | 10 ++-
 DDCore/include/DD4hep/OpaqueData.h            | 56 ++++++++++--
 DDCore/include/Parsers/Primitives.h           | 85 ++++++++++++++-----
 DDCore/src/AlignmentData.cpp                  |  2 +-
 DDCore/src/AlignmentsCalculator.cpp           |  2 +-
 DDCore/src/AlignmentsInterna.cpp              |  2 +-
 DDCore/src/ComponentProperties.cpp            |  2 +-
 DDCore/src/ConditionsData.cpp                 |  2 +-
 DDCore/src/GrammarTypes.cpp                   |  2 +-
 DDCore/src/OpaqueData.cpp                     |  2 +-
 DDCore/src/Primitives.cpp                     | 51 +++++------
 .../Conditions/src/NonDefaultCtorCond.cpp     |  2 +-
 15 files changed, 173 insertions(+), 79 deletions(-)
 rename DDCore/include/DD4hep/{detail/Grammar_parsed.h => GrammarParsed.h} (97%)
 rename DDCore/include/DD4hep/{detail/Grammar_unparsed.h => GrammarUnparsed.h} (78%)

diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
index cd36c08a6..021d25ca5 100644
--- a/DDCore/CMakeLists.txt
+++ b/DDCore/CMakeLists.txt
@@ -34,8 +34,8 @@ dd4hep_add_dictionary( G__DD4hep
   include/DD4hep/Plugins.h
   include/DD4hep/IoStreams.h
   include/DD4hep/SurfaceInstaller.h
-  include/DD4hep/detail/Grammar_parsed.h
-  include/DD4hep/detail/Grammar_unparsed.h
+  include/DD4hep/GrammarParsed.h
+  include/DD4hep/GrammarUnparsed.h
   include/XML/UnicodeValues.h
   include/XML/tinyxml.h
   include/XML/tinystring.h
diff --git a/DDCore/include/DD4hep/Conditions.h b/DDCore/include/DD4hep/Conditions.h
index c83df7a64..86acba07f 100644
--- a/DDCore/include/DD4hep/Conditions.h
+++ b/DDCore/include/DD4hep/Conditions.h
@@ -229,6 +229,10 @@ namespace dd4hep {
     template <typename T> T& get();
     /// Generic getter (const version). Specify the exact type, not a polymorph type
     template <typename T> const T& get() const;
+    /// Generic getter. Resolves polymorph types. It is mandatory that the datatype is polymorph!
+    template <typename T> T& as();
+    /// Generic getter (const version). Resolves polymorph types. It is mandatory that the datatype is polymorph!
+    template <typename T> const T& as() const;
   };
 
   /// Initializing constructor
@@ -244,20 +248,28 @@ namespace dd4hep {
     return data().construct<T,Args...>(args...);
   }
   /// Bind the data of the conditions object to a given format.
-  template <typename T> T& Condition::bind()   {
+  template <typename T> inline T& Condition::bind()   {
     return data().bind<T>();
   }
   /// Bind the data of the conditions object to a given format and fill data from string representation.
-  template <typename T> T& Condition::bind(const std::string& val)   {
+  template <typename T> inline T& Condition::bind(const std::string& val)   {
     return data().bind<T>(val);
   }
   /// Generic getter. Specify the exact type, not a polymorph type
-  template <typename T> T& Condition::get() {
+  template <typename T> inline T& Condition::get() {
     return data().get<T>();
   }
   /// Generic getter (const version). Specify the exact type, not a polymorph type
-  template <typename T> const T& Condition::get() const {
+  template <typename T> inline const T& Condition::get() const {
     return data().get<T>();
+  }    
+  /// Generic getter. Specify the exact type, not a polymorph type
+  template <typename T> inline T& Condition::as() {
+    return data().as<T>();
+  }
+  /// Generic getter (const version). Specify the exact type, not a polymorph type
+  template <typename T> inline const T& Condition::as() const {
+    return data().as<T>();
   }
     
   /// Key definition to optimize ans simplyfy the access to conditions entities
diff --git a/DDCore/include/DD4hep/detail/Grammar_parsed.h b/DDCore/include/DD4hep/GrammarParsed.h
similarity index 97%
rename from DDCore/include/DD4hep/detail/Grammar_parsed.h
rename to DDCore/include/DD4hep/GrammarParsed.h
index 2b22fc352..3b916a736 100644
--- a/DDCore/include/DD4hep/detail/Grammar_parsed.h
+++ b/DDCore/include/DD4hep/GrammarParsed.h
@@ -18,8 +18,12 @@
 // sufficient for all practical purposes.
 //
 //==========================================================================
-#ifndef DD4HEP_DETAIL_GRAMMAR_PARSED_H
-#define DD4HEP_DETAIL_GRAMMAR_PARSED_H
+#ifndef DD4HEP_DDCORE_GRAMMARPARSED_H
+#define DD4HEP_DDCORE_GRAMMARPARSED_H
+
+#if defined(DD4HEP_DDCORE_GRAMMARUNPARSED_H)
+#pragma error "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit!"
+#endif
 
 /// Framework include files
 #include "DD4hep/Grammar.h"
@@ -311,4 +315,4 @@ namespace dd4hep {
 #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL(x,eval_func) DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL_SERIAL(__LINE__,x,eval_func)
 #define DD4HEP_DEFINE_PARSER_GRAMMAR_DUMMY(x,func)        DD4HEP_DEFINE_PARSER_GRAMMAR_DUMMY_SERIAL(__LINE__,x,func)
 
-#endif // DD4HEP_DETAIL_GRAMMAR_PARSED_H
+#endif // DD4HEP_DDCORE_GRAMMARPARSED_H
diff --git a/DDCore/include/DD4hep/detail/Grammar_unparsed.h b/DDCore/include/DD4hep/GrammarUnparsed.h
similarity index 78%
rename from DDCore/include/DD4hep/detail/Grammar_unparsed.h
rename to DDCore/include/DD4hep/GrammarUnparsed.h
index 2c00c9b13..83d0961f3 100644
--- a/DDCore/include/DD4hep/detail/Grammar_unparsed.h
+++ b/DDCore/include/DD4hep/GrammarUnparsed.h
@@ -18,8 +18,12 @@
 // sufficient for all practical purposes.
 //
 //==========================================================================
-#ifndef DD4HEP_DETAIL_GRAMMAR_UNPARSED_H
-#define DD4HEP_DETAIL_GRAMMAR_UNPARSED_H
+#ifndef DD4HEP_DDCORE_GRAMMARUNPARSED_H
+#define DD4HEP_DDCORE_GRAMMARUNPARSED_H
+
+#if defined(DD4HEP_DDCORE_GRAMMARPARSED_H)
+#pragma error "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit!"
+#endif
 
 // Framework include files
 #include "DD4hep/Grammar.h"
@@ -33,4 +37,4 @@ namespace dd4hep {
     return s_gr;
   }
 }
-#endif // DD4HEP_DETAIL_GRAMMAR_UNPARSED_H
+#endif // DD4HEP_DDCORE_GRAMMARUNPARSED_H
diff --git a/DDCore/include/DD4hep/OpaqueData.h b/DDCore/include/DD4hep/OpaqueData.h
index ded8016e6..e614e3e6f 100644
--- a/DDCore/include/DD4hep/OpaqueData.h
+++ b/DDCore/include/DD4hep/OpaqueData.h
@@ -56,6 +56,18 @@ namespace dd4hep {
     /// Pointer to object data
     void* pointer = 0;                //! No ROOT persistency
 
+    /// Helper class to perform resolution of non-polymorph types
+    /**
+     *
+     *  \author  M.Frank
+     *  \version 1.0
+     *  \ingroup DD4HEP_CONDITIONS
+     */
+    class dyn_cast  {
+    public:
+      virtual ~dyn_cast() = default;
+    };
+
   public:
     /// Create data block from string representation
     bool fromString(const std::string& rep);
@@ -73,6 +85,10 @@ namespace dd4hep {
     template <typename T> T& get();
     /// Generic getter (const version). Specify the exact type, not a polymorph type
     template <typename T> const T& get() const;
+    /// Generic getter. Resolves polymorph types. It is mandatory that the datatype is polymorph!
+    template <typename T> T& as();
+    /// Generic getter (const version). Resolves polymorph types. It is mandatory that the datatype is polymorph!
+    template <typename T> const T& as() const;
   };
 
   
@@ -139,37 +155,61 @@ namespace dd4hep {
   };
 
   /// Generic getter. Specify the exact type, not a polymorph type
-  template <typename T> T& OpaqueData::get() {
+  template <typename T> inline T& OpaqueData::get() {
     if (!grammar || !grammar->equals(typeid(T))) { throw std::bad_cast(); }
     return *(T*)pointer;
   }
 
   /// Generic getter (const version). Specify the exact type, not a polymorph type
-  template <typename T> const T& OpaqueData::get() const {
+  template <typename T> inline const T& OpaqueData::get() const {
     if (!grammar || !grammar->equals(typeid(T))) { throw std::bad_cast(); }
     return *(T*)pointer;
   }
 
+  /// Generic getter. Specify the exact type, not a polymorph type
+  template <typename T> inline T& OpaqueData::as() {
+    union _cast {
+      void* ptr;
+      dyn_cast* dynamic;
+      _cast(void* p)   { ptr = p; }
+    } cast(this->pointer);
+    T* obj = dynamic_cast<T*>(cast.dynamic);
+    if ( obj ) return *obj;
+    throw std::bad_cast();
+  }
+
+  /// Generic getter (const version). Specify the exact type, not a polymorph type
+  template <typename T> inline const T& OpaqueData::as() const {
+    union _cast {
+      const void* ptr;
+      const dyn_cast* dynamic;
+      _cast(const void* p)   { ptr = p; }
+    } cast(this->pointer);
+    const T* obj = dynamic_cast<const T*>(cast.dynamic);
+    if ( obj ) return *obj;
+    throw std::bad_cast();
+  }
+
   /// Construct conditions object and bind the data
-  template <typename T, typename... Args> T& OpaqueDataBlock::construct(Args... args)   {
+  template <typename T, typename... Args> inline T& OpaqueDataBlock::construct(Args... args)   {
     this->bind(&BasicGrammar::instance<T>());
     return *(new(this->pointer) T(std::forward<Args>(args)...));
   }
 
   /// Bind data value
-  template <typename T> T& OpaqueDataBlock::bind()  {
+  template <typename T> inline T& OpaqueDataBlock::bind()  {
     this->bind(&BasicGrammar::instance<T>());
     return *(new(this->pointer) T());
   }
 
   /// Bind data value
-  template <typename T> T& OpaqueDataBlock::bind(void* ptr, size_t len)  {
+  template <typename T> inline T& OpaqueDataBlock::bind(void* ptr, size_t len)  {
     this->bind(ptr,len,&BasicGrammar::instance<T>());
     return *(new(this->pointer) T());
   }
 
   /// Bind grammar and assign value
-  template <typename T> T& OpaqueDataBlock::bind(const std::string& value)   {
+  template <typename T> inline T& OpaqueDataBlock::bind(const std::string& value)   {
     T& ret = this->bind<T>();
     if ( !value.empty() && !this->fromString(value) )  {
       throw std::runtime_error("OpaqueDataBlock::set> Failed to bind type "+
@@ -179,7 +219,7 @@ namespace dd4hep {
   }
 
   /// Bind grammar and assign value
-  template <typename T> T& OpaqueDataBlock::bind(void* ptr, size_t len, const std::string& value)   {
+  template <typename T> inline T& OpaqueDataBlock::bind(void* ptr, size_t len, const std::string& value)   {
     T& ret = this->bind<T>(ptr, len);
     if ( !value.empty() && !this->fromString(value) )  {
       throw std::runtime_error("OpaqueDataBlock::set> Failed to bind type "+
@@ -188,7 +228,7 @@ namespace dd4hep {
     return ret;
   }
   /// Bind external data value to the pointer
-  template <typename T> void OpaqueDataBlock::bindExtern(T* ptr)    {
+  template <typename T> inline void OpaqueDataBlock::bindExtern(T* ptr)    {
     bindExtern(ptr, &BasicGrammar::instance<T>());
   }
 
diff --git a/DDCore/include/Parsers/Primitives.h b/DDCore/include/Parsers/Primitives.h
index 389bcfa38..410fe129a 100644
--- a/DDCore/include/Parsers/Primitives.h
+++ b/DDCore/include/Parsers/Primitives.h
@@ -100,7 +100,7 @@ namespace dd4hep {
   void notImplemented(const std::string& msg);
 
   /// Class to perform dynamic casts using unknown pointers.
-  /** @class ComponentCast Primitives.h dd4hep/Primitives.h
+  /** @class Cast Primitives.h dd4hep/Primitives.h
    *
    *  It is mandatory that the pointers referred do actually
    *  support the asked functionalty.
@@ -109,7 +109,7 @@ namespace dd4hep {
    *   @author  M.Frank
    *   @date    13.08.2013
    */
-  class ComponentCast {
+  class Cast {
   public:
     typedef void  (*destroy_t)(void*);
     typedef void* (*cast_t)(const void*);
@@ -118,37 +118,84 @@ namespace dd4hep {
 #else
     const std::type_info& type;
 #endif
-    const void* abi_class;
-    destroy_t   destroy;
+#ifdef __APPLE__
     cast_t      cast;
-
-  private:
+  protected:
     /// Initializing Constructor
-    ComponentCast(const std::type_info& t, destroy_t d, cast_t c);
-    /// Defautl destructor
-    virtual ~ComponentCast();
-
+    Cast(const std::type_info& t, cast_t c);
   public:
-    template <typename TYPE> static void _destroy(void* arg)  {
-      TYPE* ptr = (TYPE*)arg;
-      if (ptr)    delete ptr;
-    }
     template <typename TYPE> static void* _cast(const void* arg)  {
       TYPE* ptr = (TYPE*)arg;
       ptr = dynamic_cast<TYPE*>(ptr);
       return (void*)ptr;
     }
-    template <typename TYPE> static ComponentCast& instance() {
-      static ComponentCast c(typeid(TYPE),_destroy<TYPE>,_cast<TYPE>);
+    /// Instantiation method    
+    template <typename TYPE> static Cast& instance() {
+      static Cast c(typeid(TYPE),_cast<TYPE>);
       return c;
     }
+#else
+    const void* abi_class;
+  protected:
+    /// Initializing Constructor
+    Cast(const std::type_info& t);
+    /// Instantiation method
+    template <typename TYPE> static Cast& instance() {
+      static Cast c(typeid(TYPE));
+      return c;
+    }
+#endif
+    /// Defautl destructor
+    virtual ~Cast();
 
+  public:
     /// Apply cast using typeinfo instead of dynamic_cast
-    void* apply_dynCast(const ComponentCast& to, const void* ptr) const;
+    void* apply_dynCast(const Cast& to, const void* ptr) const;
     /// Apply cast using typeinfo instead of dynamic_cast
-    void* apply_upCast(const ComponentCast& to, const void* ptr) const;
+    void* apply_upCast(const Cast& to, const void* ptr) const;
     /// Apply cast using typeinfo instead of dynamic_cast
-    void* apply_downCast(const ComponentCast& to, const void* ptr) const;
+    void* apply_downCast(const Cast& to, const void* ptr) const;
+  };
+
+  /// Class to perform dynamic casts using unknown pointers.
+  /** @class ComponentCast Primitives.h dd4hep/Primitives.h
+   *
+   *  It is mandatory that the pointers referred do actually
+   *  support the asked functionalty.
+   *  Miracles also I cannot do.....
+   *
+   *   @author  M.Frank
+   *   @date    13.08.2013
+   */
+  class ComponentCast : public Cast {
+  public:
+    typedef void  (*destroy_t)(void*);
+    destroy_t   destroy;
+
+  private:
+    /// Defautl destructor
+    virtual ~ComponentCast();
+    template <typename TYPE> static void _destroy(void* arg)  {
+      TYPE* ptr = (TYPE*)arg;
+      if (ptr)    delete ptr;
+    }
+#ifdef __APPLE__
+    /// Initializing Constructor
+    ComponentCast(const std::type_info& t, destroy_t d, cast_t c);
+  public:
+    template <typename TYPE> static ComponentCast& instance() {
+      static ComponentCast c(typeid(TYPE),_destroy<TYPE>,_cast<TYPE>);
+      return c;
+    }
+#else
+    /// Initializing Constructor
+    ComponentCast(const std::type_info& t, destroy_t d);
+  public:
+    template <typename TYPE> static ComponentCast& instance() {
+      static ComponentCast c(typeid(TYPE),_destroy<TYPE>);
+      return c;
+    }
+#endif
   };
 
   /// Convert volumeID to string format (016X)
diff --git a/DDCore/src/AlignmentData.cpp b/DDCore/src/AlignmentData.cpp
index 8d0559d89..e01746b49 100644
--- a/DDCore/src/AlignmentData.cpp
+++ b/DDCore/src/AlignmentData.cpp
@@ -229,7 +229,7 @@ Alignment AlignmentData::nominal() const   {
   return detector.nominal();
 }
 
-#include "DD4hep/detail/Grammar_unparsed.h"
+#include "DD4hep/GrammarUnparsed.h"
 static auto s_registry = GrammarRegistry::pre_note<Delta>(1)
               .pre_note<AlignmentData>(1)
               .pre_note<std::map<DetElement, Delta> >(1);
diff --git a/DDCore/src/AlignmentsCalculator.cpp b/DDCore/src/AlignmentsCalculator.cpp
index 49af590d1..6436110b8 100644
--- a/DDCore/src/AlignmentsCalculator.cpp
+++ b/DDCore/src/AlignmentsCalculator.cpp
@@ -324,5 +324,5 @@ size_t AlignmentsCalculator::extract_deltas(DetElement start,
   return deltas.size();
 }
 
-#include "DD4hep/detail/Grammar_unparsed.h"
+#include "DD4hep/GrammarUnparsed.h"
 static auto s_registry = GrammarRegistry::pre_note<AlignmentsCalculator::OrderedDeltas>(1);
diff --git a/DDCore/src/AlignmentsInterna.cpp b/DDCore/src/AlignmentsInterna.cpp
index 7d1ed7585..e8a3be4f8 100644
--- a/DDCore/src/AlignmentsInterna.cpp
+++ b/DDCore/src/AlignmentsInterna.cpp
@@ -67,5 +67,5 @@ void AlignmentObject::clear()   {
   flags = Condition::ALIGNMENT_DERIVED;
 }
 
-#include "DD4hep/detail/Grammar_unparsed.h"
+#include "DD4hep/GrammarUnparsed.h"
 static auto s_registry = GrammarRegistry::pre_note<AlignmentObject>();
diff --git a/DDCore/src/ComponentProperties.cpp b/DDCore/src/ComponentProperties.cpp
index edd395cc7..797f9aee0 100644
--- a/DDCore/src/ComponentProperties.cpp
+++ b/DDCore/src/ComponentProperties.cpp
@@ -229,7 +229,7 @@ Property& PropertyConfigurable::property(const string& nam)   {
   return properties()[nam];
 }
 
-#include "DD4hep/detail/Grammar_parsed.h"
+#include "DD4hep/GrammarParsed.h"
 namespace dd4hep { 
   namespace Parsers {
     template <> int parse(Property& result, const std::string& input) {
diff --git a/DDCore/src/ConditionsData.cpp b/DDCore/src/ConditionsData.cpp
index 69666c8e6..2392bc02d 100644
--- a/DDCore/src/ConditionsData.cpp
+++ b/DDCore/src/ConditionsData.cpp
@@ -76,5 +76,5 @@ AbstractMap& AbstractMap::operator=(const AbstractMap& c)  {
   return *this;
 }
 
-#include "DD4hep/detail/Grammar_unparsed.h"
+#include "DD4hep/GrammarUnparsed.h"
 static auto s_registry = dd4hep::GrammarRegistry::pre_note<AbstractMap>(1);
diff --git a/DDCore/src/GrammarTypes.cpp b/DDCore/src/GrammarTypes.cpp
index 4d5e98acb..ca20aa902 100644
--- a/DDCore/src/GrammarTypes.cpp
+++ b/DDCore/src/GrammarTypes.cpp
@@ -13,7 +13,7 @@
 
 // Framework include files
 #include "DD4hep/Objects.h"
-#include "DD4hep/detail/Grammar_parsed.h"
+#include "DD4hep/GrammarParsed.h"
 
 #ifndef DD4HEP_PARSERS_NO_ROOT
 DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(ROOT::Math::XYZPoint,eval_obj)
diff --git a/DDCore/src/OpaqueData.cpp b/DDCore/src/OpaqueData.cpp
index 04f19d6df..36fa8189e 100644
--- a/DDCore/src/OpaqueData.cpp
+++ b/DDCore/src/OpaqueData.cpp
@@ -180,5 +180,5 @@ void* OpaqueDataBlock::bind(void* ptr, size_t size, const BasicGrammar* g)   {
   return 0;
 }
 
-#include "DD4hep/detail/Grammar_unparsed.h"
+#include "DD4hep/GrammarUnparsed.h"
 static auto s_registry = GrammarRegistry::pre_note<OpaqueDataBlock>(1);
diff --git a/DDCore/src/Primitives.cpp b/DDCore/src/Primitives.cpp
index bafb16a51..6412e130c 100644
--- a/DDCore/src/Primitives.cpp
+++ b/DDCore/src/Primitives.cpp
@@ -410,51 +410,38 @@ namespace dd4hep   {
   }
 }
 
+#ifdef __APPLE__
+/// Initializing Constructor
+dd4hep::Cast::Cast(const std::type_info& t, cast_t c) : type(t), cast(c)  {
+}
 /// Initializing Constructor
 dd4hep::ComponentCast::ComponentCast(const std::type_info& t, destroy_t d, cast_t c)
-  : type(t), destroy(d), cast(c) {
-#ifdef __APPLE__
-  abi_class = 0;
+  : Cast(t, c), destroy(d)    {
+}
 #else
+/// Initializing Constructor
+dd4hep::Cast::Cast(const std::type_info& t) : type(t)   {
   abi_class = dynamic_cast<const class_t*>(&type);
   if (!abi_class) {
     throw std::runtime_error("Class type " + typeName(type) + " is not an abi object type!");
   }
-#endif
 }
+/// Initializing Constructor
+dd4hep::ComponentCast::ComponentCast(const std::type_info& t, destroy_t d)
+  : Cast(t), destroy(d)   {
+}
+#endif
 
 /// Defautl destructor
-dd4hep::ComponentCast::~ComponentCast() {
+dd4hep::Cast::~Cast() {
 }
 
-#if 0
-// Dynamic cast runtime.
-// src2dst has the following possible values
-//  >-1: src_type is a unique public non-virtual base of dst_type
-//       dst_ptr + src2dst == src_ptr
-//   -1: unspecified relationship
-//   -2: src_type is not a public base of dst_type
-//   -3: src_type is a multiple public non-virtual base of dst_type
-extern "C" void*
-__dynamic_cast(const void* __src_ptr,// Starting object.
-               const abi::__class_type_info* __src_type,// Static type of object.
-               const abi::__class_type_info* __dst_type,// Desired target type.
-               ptrdiff_t __src2dst);// How src and dst are related.
-#endif
-#if 0
-#ifndef __APPLE__
-static inline void* cast_wrap(const void* p,
-                              const abi::__class_type_info* src,
-                              const abi::__class_type_info* dst,
-                              ptrdiff_t src2dst)
-{
-  return abi::__dynamic_cast(p,src,dst,src2dst);
+/// Defautl destructor
+dd4hep::ComponentCast::~ComponentCast() {
 }
-#endif
-#endif
 
 /// Apply cast using typeinfo instead of dynamic_cast
-void* dd4hep::ComponentCast::apply_dynCast(const ComponentCast& to, const void* ptr) const
+void* dd4hep::Cast::apply_dynCast(const Cast& to, const void* ptr) const
 {
   if (&to == this) {
     return (void*) ptr;
@@ -494,7 +481,7 @@ void* dd4hep::ComponentCast::apply_dynCast(const ComponentCast& to, const void*
 }
 
 /// Apply cast using typeinfo instead of dynamic_cast
-void* dd4hep::ComponentCast::apply_upCast(const ComponentCast& to, const void* ptr) const
+void* dd4hep::Cast::apply_upCast(const Cast& to, const void* ptr) const
 {
   if (&to == this) {
     return (void*) ptr;
@@ -503,7 +490,7 @@ void* dd4hep::ComponentCast::apply_upCast(const ComponentCast& to, const void* p
 }
   
 /// Apply cast using typeinfo instead of dynamic_cast
-void* dd4hep::ComponentCast::apply_downCast(const ComponentCast& to, const void* ptr) const
+void* dd4hep::Cast::apply_downCast(const Cast& to, const void* ptr) const
 {
   if (&to == this) {
     return (void*) ptr;
diff --git a/examples/Conditions/src/NonDefaultCtorCond.cpp b/examples/Conditions/src/NonDefaultCtorCond.cpp
index 755d7ae06..aeec9332d 100644
--- a/examples/Conditions/src/NonDefaultCtorCond.cpp
+++ b/examples/Conditions/src/NonDefaultCtorCond.cpp
@@ -28,5 +28,5 @@ void NonDefaultCtorCond::set(int val)  {
   d = val;
 }
 
-#include "DD4hep/detail/Grammar_unparsed.h"
+#include "DD4hep/GrammarUnparsed.h"
 static auto s_registry = dd4hep::GrammarRegistry::pre_note<NonDefaultCtorCond>();
-- 
GitLab