DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsInterna.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework includes
15 #include <DD4hep/IOV.h>
16 #include <DD4hep/InstanceCount.h>
17 #include <DD4hep/detail/Handle.inl>
19 
20 using namespace dd4hep;
21 
22 #if defined(DD4HEP_CONDITIONS_HAVE_NAME)
24 #else
26 #endif
27 
28 namespace {
30  union _P {
31  const char* character;
32  const void* p_void;
33  void** pp_void;
34  const detail::ConditionObject* o;
35  _P(const void* val) { p_void = val; }
36  };
37 }
38 
41 {
43 }
44 
46 #if defined(DD4HEP_CONDITIONS_HAVE_NAME)
47 detail::ConditionObject::ConditionObject(const std::string& nam,const std::string& tit)
48  : NamedObject(nam, tit), data()
49 #else
50 detail::ConditionObject::ConditionObject(const std::string& ,const std::string& )
51  : data()
52 #endif
53 {
55 }
56 
60 }
61 
64  if ( --refCount <= 0 ) delete this;
65 }
66 
69  static _P p((void*)0x1000);
70  static std::size_t off = _P(&p.o->data.grammar).character - p.character + sizeof(OpaqueData::grammar);
71  return off;
72 }
73 
76  return *(_P(_P(this).character+offset()).pp_void);
77 }
78 
81  return *this;
82 }
83 
86  if ( iov ) return iov;
87  invalidHandleError<IOV>();
88  return 0;
89 }
90 
93  if ( iov && iov->iovType ) return iov->iovType;
94  invalidHandleError<IOVType>();
95  return 0;
96 }
97 
98 
99 #include <DD4hep/GrammarUnparsed.h>
100 static auto s_registry = GrammarRegistry::pre_note<std::vector<Condition> >(1);
dd4hep::detail::ConditionObject::payload
void * payload() const
Access the bound data payload. Exception id object is unbound.
Definition: ConditionsInterna.cpp:75
DD4HEP_INSTANTIATE_HANDLE_UNNAMED
DD4HEP_INSTANTIATE_HANDLE_UNNAMED(detail::ConditionObject)
ConditionsInterna.h
IOV.h
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
dd4hep::IOVType
Class describing the interval of validty type.
Definition: IOV.h:37
dd4hep::detail::ConditionObject::~ConditionObject
virtual ~ConditionObject()
Standard Destructor.
Definition: ConditionsInterna.cpp:58
dd4hep::IOV
Class describing the interval of validty.
Definition: IOV.h:67
dd4hep::detail::ConditionObject::ConditionObject
ConditionObject()
Default constructor.
Definition: ConditionsInterna.cpp:40
dd4hep::detail::ConditionObject::iovType
const IOVType * iovType() const
Access safely the IOV-type.
Definition: ConditionsInterna.cpp:92
dd4hep::detail::ConditionObject::move
ConditionObject & move(ConditionObject &from)
Move data content: 'from' will be reset to NULL.
Definition: ConditionsInterna.cpp:80
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition: InstanceCount.h:102
dd4hep::detail::ConditionObject::release
void release()
Release object (Used by persistency mechanism)
Definition: ConditionsInterna.cpp:63
dd4hep::detail::ConditionObject::offset
static size_t offset()
Data offset from the opaque data block pointer to the condition.
Definition: ConditionsInterna.cpp:68
GrammarUnparsed.h
dd4hep::detail::ConditionObject::iovData
const IOV * iovData() const
Access safely the IOV.
Definition: ConditionsInterna.cpp:85
dd4hep::detail::ConditionObject
The data class behind a conditions handle.
Definition: ConditionsInterna.h:68
std
Definition: Plugins.h:30
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::NamedObject
Implementation of a named object.
Definition: NamedObject.h:30
dd4hep::OpaqueData::grammar
const BasicGrammar * grammar
Data type.
Definition: OpaqueData.h:53
InstanceCount.h
DD4HEP_INSTANTIATE_HANDLE_NAMED
DD4HEP_INSTANTIATE_HANDLE_NAMED(GlobalAlignmentData)