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
ConditionsPool.h
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 #ifndef DDCOND_CONDITIONSPOOL_H
15 #define DDCOND_CONDITIONSPOOL_H
16 
17 // Framework include files
18 #include "DD4hep/Detector.h"
19 #include "DD4hep/Conditions.h"
21 
23 namespace DD4hep {
24 
26  namespace Conditions {
27 
28  // Forward declarations
29  class ConditionsPoolInsert;
30  class ConditionsManagerObject;
31 
33 
46  class ConditionsPool : public NamedObject {
47  protected:
50 
51  public:
54 
55  enum { AGE_NONE = 0,
56  AGE_ANY = 9999999,
57  AGE_EXPIRED = 12345678
58  };
60  const IOVType* iovType;
62  IOV* iov;
64  int age_value;
65 
66  protected:
67  friend class ConditionsPoolInsert;
68  friend class ConditionsPoolRemove;
70 
72  void onRegister(Condition condition);
74  void onRemove(Condition condition);
76  virtual void insert(Condition cond) = 0;
78  virtual void insert(RangeConditions& cond) = 0;
79 
80  public:
84  virtual ~ConditionsPool();
86  void print(const std::string& opt) const;
88  virtual void clear() = 0;
90  virtual Condition exists(Condition::key_type key) const = 0;
92  virtual void select(Condition::key_type key, RangeConditions& result) = 0;
94  virtual void select_all(RangeConditions& result) = 0;
96  virtual void select_all(ConditionsPool& selection_pool) = 0;
98  virtual void select_used(RangeConditions& result) = 0;
100  virtual size_t count() const = 0;
101  };
102 
104 
108  class UpdatePool : public ConditionsPool {
109 
110  public:
111  typedef std::vector<Condition> ConditionEntries;
113  typedef std::map<const IOV*, ConditionEntries> UpdateEntries;
114 
115  public:
119  virtual ~UpdatePool();
121  virtual void popEntries(UpdateEntries& entries) = 0;
123  virtual void select_range(Condition::key_type key,
124  const Condition::iov_type& req_validity,
125  RangeConditions& result) = 0;
126  };
127 
129 
133  class UserPool {
134  public:
141 
142  protected:
149 
150  public:
154  virtual ~UserPool();
156  const IOV& validity() const { return m_iov; }
158  const IOV* validityPtr() const { return &m_iov; }
160  virtual void print(const std::string& opt) const = 0;
162  virtual size_t count() const = 0;
164  virtual void clear() = 0;
166  virtual bool exists(key_type key) const = 0;
168  virtual bool exists(const ConditionKey& key) const = 0;
170  virtual Condition get(key_type key) const = 0;
172  virtual Condition get(const ConditionKey& key) const = 0;
174  virtual bool remove(key_type hash_key) = 0;
176  virtual bool remove(const ConditionKey& key) = 0;
178  virtual bool insert(Condition cond) = 0;
180  virtual long prepare(const IOV& required) = 0;
182  virtual long prepare(const IOV& required, const ConditionKeys& keys) = 0;
184  virtual long compute(const Dependencies& dependencies, void* user_param=0) = 0;
185  };
186 
187  } /* End namespace Conditions */
188 } /* End namespace DD4hep */
189 
190 #endif /* DDCOND_CONDITIONSPOOL_H */
IOV m_iov
The pool's interval of validity.
void print(const std::string &opt) const
Print pool basics.
virtual ~UpdatePool()
Default destructor.
virtual void select_all(RangeConditions &result)=0
Select all conditions contained.
ConditionsManager m_manager
Handle to conditions manager object.
virtual bool insert(Condition cond)=0
Register a new condition to this pool.
Interface for conditions pool optimized to host conditions updates.
virtual void popEntries(UpdateEntries &entries)=0
Adopt all entries sorted by IOV. Entries will be removed from the pool.
const IOV & validity() const
Access the interval of validity for this user pool.
virtual void insert(Condition cond)=0
Register a new condition to this pool.
ConditionsManager::Dependencies Dependencies
Forward definition of the dependency container.
std::map< const IOV *, ConditionEntries > UpdateEntries
Update container specification.
UpdatePool(ConditionsManager mgr)
Default constructor.
ConditionsPool(ConditionsManager mgr)
Default constructor.
virtual void print(const std::string &opt) const =0
Print pool content.
Main condition object handle.
Definition: Conditions.h:70
Condition::key_type key_type
Forward definition of the key type.
unsigned int key_type
Forward definition of the key type.
Definition: Conditions.h:75
void onRegister(Condition condition)
Listener invocation when a condition is registered to the cache.
virtual ~UserPool()
Default destructor.
Key definition to optimize ans simplyfy the access to conditions entities.
Definition: Conditions.h:273
Implementation of a named object.
Definition: NamedObject.h:31
Class describing the interval of validty.
Definition: IOV.h:59
Interface for conditions pool optimized to host conditions updates.
virtual long prepare(const IOV &required)=0
Prepare user pool for usage (load, fill etc.) according to required IOV.
std::vector< Condition > ConditionEntries
Manager class for condition handles.
virtual long compute(const Dependencies &dependencies, void *user_param=0)=0
Evaluate and register all derived conditions from the dependency list.
IOV * iov
The IOV of the conditions hosted.
Class describing the interval of validty type.
Definition: IOV.h:33
const IOV * validityPtr() const
Access the interval of validity for this user pool.
virtual void select_range(Condition::key_type key, const Condition::iov_type &req_validity, RangeConditions &result)=0
Select the conditions matching the key.
virtual void clear()=0
Full cleanup of all managed conditions.
Conditions internal namespace declaration.
virtual void select(Condition::key_type key, RangeConditions &result)=0
Select the conditions matching the DetElement and the conditions name.
ConditionsManager m_manager
Handle to conditions manager object.
Class implementing the conditions collection for a given IOV type.
std::set< ConditionKey > ConditionKeys
virtual ~ConditionsPool()
Default destructor. Note: pool must be cleared by the subclass!
virtual Condition exists(Condition::key_type key) const =0
Check if a condition exists in the pool.
ConditionsManager::ConditionKeys ConditionKeys
Forward definition of the condition keys container.
Helper to insert objects into a conditions pool.
Pool of conditions satisfying one IOV type (epoch, run, fill, etc)
ConditionsIOVPool * m_iovPool
IOV Pool as data source.
UserPool(ConditionsManager mgr, ConditionsIOVPool *pool)
Default constructor.
virtual void clear()=0
Full cleanup of all managed conditions.
std::vector< Condition > RangeConditions
Definition: Conditions.h:359
void onRemove(Condition condition)
Listener invocation when a condition is deregistered from the cache.
virtual size_t count() const =0
Total entry count.
virtual void select_used(RangeConditions &result)=0
Select the conditons, used also by the DetElement of the condition.
Condition::key_type key_type
Forward definition of the key type.
virtual size_t count() const =0
Total entry count.
virtual bool exists(key_type key) const =0
Check a condition for existence.
Helper to insert objects into a conditions pool.
const IOVType * iovType
IOV type of the conditions hosted by this pool.