|
||||
File indexing completed on 2025-01-18 10:06:01
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 // C/C++ include files 0026 #include <map> 0027 #include <iostream> 0028 0029 // Framework include files 0030 0031 0032 /// Namespace for the AIDA detector description toolkit 0033 namespace dd4hep { 0034 0035 /// Forward declaration 0036 class Detector; 0037 0038 /// Namespace for the AIDA detector description toolkit supporting XML utilities 0039 namespace DD4HEP_CONVERSION_NS { 0040 class Handle_t; 0041 } 0042 0043 /// Basic conversion objects for handling dd4hep XML files. 0044 /** 0045 * \author M.Frank 0046 * \version 1.0 0047 * \ingroup DD4HEP_XML 0048 */ 0049 template <typename T, typename ARG=DD4HEP_CONVERSION_NS::Handle_t> struct Converter { 0050 public: 0051 typedef T to_type; 0052 typedef Converter<T,ARG> self_type; 0053 typedef void* user_param; 0054 public: 0055 /// Reference to the detector description object 0056 Detector& description; 0057 /// Reference to optional user defined parameter 0058 user_param param; 0059 /// Reference to second optional user defined parameter 0060 user_param optional; 0061 public: 0062 /// Initializing constructor of the functor 0063 Converter(Detector& l) : description(l), param(0), optional(0) { } 0064 /// Initializing constructor of the functor with initialization of the user parameter 0065 Converter(Detector& l, user_param p) : description(l), param(p), optional(0) { } 0066 /// Initializing constructor of the functor with initialization of the user parameter 0067 Converter(Detector& l, user_param p, user_param o) : description(l), param(p), optional(o) { } 0068 /// Callback operator to be specialized depending on the element type 0069 void operator()(ARG handle) const; 0070 /// Typed access to the 1rst. user parameter (unchecked) 0071 template <typename TYPE> TYPE* _param() const { return (TYPE*) param; } 0072 /// Typed object access to the 1rst. user parameter (unchecked) 0073 template <typename TYPE> TYPE& _object() const { return *(TYPE*) param; } 0074 /// Typed access to the 2nd. user parameter (unchecked) 0075 template <typename TYPE> TYPE* _option() const { return (TYPE*) optional; } 0076 }; 0077 } /* End namespace dd4hep */ 0078 0079 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |