File indexing completed on 2025-01-18 09:13:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/IOV.h>
0016 #include <DD4hep/InstanceCount.h>
0017 #include <DD4hep/detail/Handle.inl>
0018 #include <DD4hep/detail/ConditionsInterna.h>
0019
0020 using namespace dd4hep;
0021
0022 #if defined(DD4HEP_CONDITIONS_HAVE_NAME)
0023 DD4HEP_INSTANTIATE_HANDLE_NAMED(detail::ConditionObject);
0024 #else
0025 DD4HEP_INSTANTIATE_HANDLE_UNNAMED(detail::ConditionObject);
0026 #endif
0027
0028 namespace {
0029
0030 union _P {
0031 const char* character;
0032 const void* p_void;
0033 void** pp_void;
0034 const detail::ConditionObject* o;
0035 _P(const void* val) { p_void = val; }
0036 };
0037 }
0038
0039
0040 detail::ConditionObject::ConditionObject()
0041 {
0042 InstanceCount::increment(this);
0043 }
0044
0045
0046 #if defined(DD4HEP_CONDITIONS_HAVE_NAME)
0047 detail::ConditionObject::ConditionObject(const std::string& nam,const std::string& tit)
0048 : NamedObject(nam, tit), data()
0049 #else
0050 detail::ConditionObject::ConditionObject(const std::string& ,const std::string& )
0051 : data()
0052 #endif
0053 {
0054 InstanceCount::increment(this);
0055 }
0056
0057
0058 detail::ConditionObject::~ConditionObject() {
0059 InstanceCount::decrement(this);
0060 }
0061
0062
0063 void detail::ConditionObject::release() {
0064 if ( --refCount <= 0 ) delete this;
0065 }
0066
0067
0068 size_t detail::ConditionObject::offset() {
0069 static _P p((void*)0x1000);
0070 static std::size_t off = _P(&p.o->data.grammar).character - p.character + sizeof(OpaqueData::grammar);
0071 return off;
0072 }
0073
0074
0075 void* detail::ConditionObject::payload() const {
0076 return *(_P(_P(this).character+offset()).pp_void);
0077 }
0078
0079
0080 detail::ConditionObject& detail::ConditionObject::move(ConditionObject& ) {
0081 return *this;
0082 }
0083
0084
0085 const dd4hep::IOV* detail::ConditionObject::iovData() const {
0086 if ( iov ) return iov;
0087 invalidHandleError<IOV>();
0088 return 0;
0089 }
0090
0091
0092 const dd4hep::IOVType* detail::ConditionObject::iovType() const {
0093 if ( iov && iov->iovType ) return iov->iovType;
0094 invalidHandleError<IOVType>();
0095 return 0;
0096 }
0097
0098
0099 #include <DD4hep/GrammarUnparsed.h>
0100 static auto s_registry = GrammarRegistry::pre_note<std::vector<Condition> >(1);