Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 09:02:37

0001 #ifndef PARSERS_DETAIL_CONVERSIONS_H
0002 #define PARSERS_DETAIL_CONVERSIONS_H
0003 
0004 //==========================================================================
0005 //  AIDA Detector description implementation 
0006 //--------------------------------------------------------------------------
0007 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0008 // All rights reserved.
0009 //
0010 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0011 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0012 //
0013 // Author     : M.Frank
0014 //
0015 //==========================================================================
0016 
0017 /** 
0018  *  Note: Do NEVER include this file directly!
0019  *
0020  *  Use the specific include files in the XML or JSON directory!
0021  *
0022  */
0023 
0024 
0025 
0026 /// Namespace for the AIDA detector description toolkit
0027 namespace dd4hep {
0028 
0029   /// Forward declaration
0030   class Detector;
0031   
0032   /// Namespace for the AIDA detector description toolkit supporting XML utilities
0033   namespace DD4HEP_CONVERSION_NS {
0034     class Handle_t;
0035   }
0036 
0037   /// Basic conversion objects for handling dd4hep XML files.
0038   /**
0039    *  \author   M.Frank
0040    *  \version  1.0
0041    *  \ingroup DD4HEP_XML
0042    */
0043   template <typename T, typename ARG=DD4HEP_CONVERSION_NS::Handle_t> struct Converter {
0044   public:
0045     typedef T                to_type;
0046     typedef Converter<T,ARG> self_type;
0047     typedef void*            user_param;
0048   public:
0049     /// Reference to the detector description object
0050     Detector& description;
0051     /// Reference to optional user defined parameter
0052     user_param param;
0053     /// Reference to second optional user defined parameter
0054     user_param optional;
0055   public:
0056     /// Initializing constructor of the functor
0057     Converter(Detector& l) : description(l), param(0), optional(0) { }
0058     /// Initializing constructor of the functor with initialization of the user parameter
0059     Converter(Detector& l, user_param p) : description(l), param(p), optional(0) { }
0060     /// Initializing constructor of the functor with initialization of the user parameter
0061     Converter(Detector& l, user_param p, user_param o) : description(l), param(p), optional(o)  { }
0062     /// Callback operator to be specialized depending on the element type
0063     void operator()(ARG handle) const;
0064     /// Typed access to the 1rst. user parameter (unchecked)
0065     template <typename TYPE> TYPE* _param() const  {    return (TYPE*) param;     }
0066     /// Typed object access to the 1rst. user parameter (unchecked)
0067     template <typename TYPE> TYPE& _object() const {    return *(TYPE*) param;    }
0068     /// Typed access to the 2nd. user parameter (unchecked)
0069     template <typename TYPE> TYPE* _option() const {    return (TYPE*) optional;  }
0070   };
0071 } /* End namespace dd4hep           */
0072 
0073 #endif