DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConditionDerived.cpp
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework includes
16 #include "DD4hep/Printout.h"
17 #include "DD4hep/InstanceCount.h"
19 
20 // C/C++ include files
21 
22 using namespace DD4hep;
23 using namespace DD4hep::Conditions;
24 
27 }
28 
31 }
32 
35  const Dependencies deps,
36  ConditionUpdateCall* call)
37  : m_refCount(0), target(tar), dependencies(deps), callback(call)
38 {
40  if ( callback ) callback->addRef();
41 }
42 
45  ConditionUpdateCall* call)
46  : m_refCount(0), target(tar), callback(call)
47 {
49  if ( callback ) callback->addRef();
50 }
51 
54  : m_refCount(0), target(0), callback(0)
55 {
57 }
58 
61  : m_refCount(0), target(c.target), dependencies(c.dependencies), callback(c.callback)
62 {
64  if ( callback ) callback->addRef();
65  except("Dependency",
66  "++ Condition: %s. Dependencies may not be assigned or copied!",
67  target.name.c_str());
68 }
69 
74 }
75 
78  except("Dependency",
79  "++ Condition: %s. Dependencies may not be assigned or copied!",
80  target.name.c_str());
81  return *this;
82 }
83 
86  : m_dependency(new ConditionDependency(target,call))
87 {
88 }
89 
92  : m_dependency(new ConditionDependency(target,call))
93 {
94  m_dependency->detector = de;
95 }
96 
100 }
101 
104  if ( m_dependency ) {
105  m_dependency->dependencies.push_back(source);
106  return;
107  }
108  except("Dependency","++ Invalid object. No further source may be added!");
109 }
110 
113  if ( m_dependency ) {
115  m_dependency = 0;
116  return tmp;
117  }
118  except("Dependency","++ Invalid object. Cannot access built objects!");
119  return m_dependency; // Not necessary, but need to satisfy compiler
120 }
121 
ConditionDependency & operator=(const ConditionDependency &c)
Assignment operator.
static void decrement(T *)
Decrement count according to type information.
int except(const std::string &src, const std::string &fmt,...)
Calls the display action with ERROR and throws an std::runtime_error exception.
Definition: Printout.cpp:217
Condition dependency definition.
Key definition to optimize ans simplyfy the access to conditions entities.
Definition: Conditions.h:273
void releasePtr(T &p)
Helper to delete objects from heap and reset the pointer. Saves many many lines of code...
Definition: Primitives.h:316
ConditionUpdateCall * callback
Reference to the update callback. No auto pointer. callback may be shared.
ConditionDependency * release()
Release the created dependency and take ownership.
void add(const ConditionKey &source)
Add a new dependency.
DetElement detector
Reference to the target's detector element.
Dependencies dependencies
Dependency keys this condition depends on.
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
std::string name
String representation of the key object.
Definition: Conditions.h:279
ConditionUpdateCall * addRef()
Add use count to the object.
std::vector< ConditionKey > Dependencies
Defintion of the depencency container.
Handle class describing a detector element.
Definition: Detector.h:172
virtual ~ConditionDependency()
Default destructor.
virtual ~ConditionResolver()
Standard destructor.
virtual ~ConditionUpdateCall()
Standard destructor.
ConditionKey target
Key to the condition to be updated.
DependencyBuilder(const ConditionKey &target, ConditionUpdateCall *call)
Initializing constructor.
virtual ~DependencyBuilder()
Default destructor.
ConditionDependency * m_dependency
The created dependency.