Warning, /include/Parsers/detail/ChildValue.inl is written in an unsupported language. File is not indexed.
0001 //==========================================================================
0002 // AIDA Detector description implementation
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author : M.Frank
0011 //
0012 //==========================================================================
0013
0014
0015 /**
0016 * Note: Do NEVER include this file directly!
0017 *
0018 * Use the specific include files in the XML or JSON directory!
0019 * Also NO header guards!
0020 */
0021
0022
0023 #define XML_CHILDVALUE_childValue(name,type) \
0024 m_element.child(_dd4hep_Unicode_Item(name)).attr<type>(_dd4hep_Unicode_Item(value))
0025
0026 #define XML_CHILDVALUE_childValueDefault(name,type,def) \
0027 Handle_t __h = m_element.child(_dd4hep_Unicode_Item(name),false); \
0028 if ( __h.ptr() && __h.hasAttr(_dd4hep_Unicode_Item(value)) ) return __h.attr < type > (_dd4hep_Unicode_Item(value)); \
0029 return def;
0030
0031 #define XML_CHILDVALUE_ACCESSOR(type,name) \
0032 type ChildValue::name() const { return XML_CHILDVALUE_childValue(name,type); }
0033
0034 #define XML_CHILDVALUE_ACCESSOR_DEFAULT(name,type,dressing) \
0035 type ChildValue::name(type default_val) const { \
0036 Handle_t __h = m_element.child(_dd4hep_Unicode_Item(name),false); \
0037 if ( __h.ptr() ) { \
0038 const XmlChar* val = __h.attr_value_nothrow(_dd4hep_Unicode_Item(value)); \
0039 return val ? dressing(val) : default_val; } \
0040 return default_val; }
0041
0042 #define XML_CHILDVALUE_ACCESSOR_DOUBLE(name) XML_CHILDVALUE_ACCESSOR_DEFAULT(name,double,_toDouble)
0043 #define XML_CHILDVALUE_ACCESSOR_INT(name) XML_CHILDVALUE_ACCESSOR_DEFAULT(name,int,_toInt)
0044 #define XML_CHILDVALUE_ACCESSOR_BOOL(name) XML_CHILDVALUE_ACCESSOR_DEFAULT(name,bool,_toBool)