DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsProcessor.h
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 #ifndef DD4HEP_CONDITIONSPROCESSOR_H
14 #define DD4HEP_CONDITIONSPROCESSOR_H
15 
16 // Framework include files
17 #include <DD4hep/DetElement.h>
18 #include <DD4hep/Conditions.h>
19 #include <DD4hep/ConditionsMap.h>
20 
21 // C/C++ include files
22 #include <memory>
23 
25 namespace dd4hep {
26 
28  namespace cond {
29 
30 
32 
42  template <typename T> class ConditionsProcessor : public Condition::Processor {
45  public:
47  ConditionsProcessor() = delete;
51  ConditionsProcessor(T&& p) = delete;
57  virtual ~ConditionsProcessor() = default;
61  virtual int process(Condition condition) const override {
62  return (processor)(condition);
63  }
64  };
66  template <typename T> inline
69 
71 
82  template <typename T> class ConditionsProcessorWrapper : public Condition::Processor {
83  std::unique_ptr<T> processor;
84  public:
92  virtual ~ConditionsProcessorWrapper() = default;
96  virtual int process(Condition c) const override {
97  return (*(processor.get()))(c);
98  }
99  };
101  template <typename T> inline ConditionsProcessorWrapper<T>* createProcessorWrapper(T* obj) {
102  return new ConditionsProcessorWrapper<T>(obj);
103  }
105  template <typename T> inline ConditionsProcessorWrapper<T> processorWrapper(T* obj) {
106  return ConditionsProcessorWrapper<T>(obj);
107  }
108 
110 
118  template <typename T> class ConditionsCollector {
119  public:
124  public:
128  ConditionsCollector(ConditionsMap& m, T&& p) = delete;
134  ~ConditionsCollector() = default;
138 
146  virtual int operator()(DetElement de, int level=0) const final;
147  };
149  template <typename T> inline
150  ConditionsCollector<typename std::remove_reference<T>::type> conditionsCollector(ConditionsMap& m, T&& conditions)
152 
153 
154  } /* End namespace cond */
155 } /* End namespace dd4hep */
156 #endif // DD4HEP_CONDITIONSPROCESSOR_H
dd4hep::cond::ConditionsCollector::~ConditionsCollector
~ConditionsCollector()=default
Default destructor.
dd4hep::cond::ConditionsProcessorWrapper
Generic condition processor facade for the Conditons::Processor object.
Definition: ConditionsProcessor.h:82
dd4hep::cond::ConditionsProcessorWrapper::ConditionsProcessorWrapper
ConditionsProcessorWrapper(const ConditionsProcessorWrapper &copy)=delete
Copy constructor.
dd4hep::cond::ConditionsProcessorWrapper::operator=
ConditionsProcessorWrapper & operator=(const ConditionsProcessorWrapper &copy)=delete
Assignment operator.
cond
AlignmentCondition::Object * cond
Definition: AlignmentsCalculator.cpp:68
dd4hep::cond::conditionsCollector
ConditionsCollector< typename std::remove_reference< T >::type > conditionsCollector(ConditionsMap &m, T &&conditions)
Creator utility function for ConditionsCollector objects.
Definition: ConditionsProcessor.h:150
dd4hep::cond::ConditionsProcessor::process
virtual int process(Condition condition) const override
Processing callback.
Definition: ConditionsProcessor.h:61
dd4hep::cond::ConditionsProcessor::ConditionsProcessor
ConditionsProcessor(const ConditionsProcessor &copy)=default
Copy constructor.
dd4hep::cond::ConditionsProcessorWrapper::processor
std::unique_ptr< T > processor
Definition: ConditionsProcessor.h:83
dd4hep::cond::ConditionsCollector::conditions
T & conditions
Collection container.
Definition: ConditionsProcessor.h:123
dd4hep::cond::ConditionsProcessorWrapper::ConditionsProcessorWrapper
ConditionsProcessorWrapper()=default
Default constructor.
dd4hep::cond::ConditionsCollector::ConditionsCollector
ConditionsCollector(ConditionsMap &m, T &d)
Default constructor.
Definition: ConditionsProcessor.h:126
dd4hep::cond::ConditionsCollector::ConditionsCollector
ConditionsCollector(ConditionsCollector &&copy)=default
R-value copy from a temporary.
dd4hep::Condition
Main condition object handle.
Definition: Conditions.h:51
dd4hep::cond::ConditionsCollector::ConditionsCollector
ConditionsCollector(ConditionsMap &m, T &&p)=delete
Default move constructor is disabled.
dd4hep::cond::ConditionsCollector::ConditionsCollector
ConditionsCollector(const ConditionsCollector &copy)=default
Copy constructor.
dd4hep::cond::ConditionsProcessor::operator=
ConditionsProcessor & operator=(const ConditionsProcessor &copy)=default
Assignment operator.
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::cond::ConditionsProcessor
Generic condition processor facade for the Conditons::Processor object.
Definition: ConditionsProcessor.h:42
dd4hep::cond::ConditionsCollector::operator=
ConditionsCollector & operator=(const ConditionsCollector &copy)=default
Assignment operator.
dd4hep::cond::ConditionsProcessorWrapper::ConditionsProcessorWrapper
ConditionsProcessorWrapper(T *p)
Initializing constructor.
Definition: ConditionsProcessor.h:88
dd4hep::cond::ConditionsCollector::mapping
ConditionsMap & mapping
Reference to the user pool.
Definition: ConditionsProcessor.h:121
dd4hep::cond::ConditionsProcessorWrapper::~ConditionsProcessorWrapper
virtual ~ConditionsProcessorWrapper()=default
Default destructor.
dd4hep::cond::processorWrapper
ConditionsProcessorWrapper< T > processorWrapper(T *obj)
Creator utility function for ConditionsProcessorWrapper objects.
Definition: ConditionsProcessor.h:105
Conditions.h
dd4hep::cond::ConditionsCollector::operator()
virtual int operator()(DetElement de, int level=0) const final
Callback to output conditions information.
Definition: ConditionsProcessor.cpp:25
ConditionsMap.h
dd4hep::cond::ConditionsProcessor::ConditionsProcessor
ConditionsProcessor(T &&p)=delete
This move constructor is disabled to void temporary references.
dd4hep::cond::ConditionsCollector
Generic condition collector keyed by detector elements.
Definition: ConditionsProcessor.h:118
std
Definition: Plugins.h:30
DetElement.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::cond::ConditionsProcessor::processor
T & processor
Reference to the actual processor.
Definition: ConditionsProcessor.h:44
dd4hep::cond::ConditionsProcessor::ConditionsProcessor
ConditionsProcessor()=delete
Default constructor.
dd4hep::cond::createProcessorWrapper
ConditionsProcessorWrapper< T > * createProcessorWrapper(T *obj)
Creator utility function for ConditionsProcessorWrapper objects.
Definition: ConditionsProcessor.h:101
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::cond::ConditionsProcessorWrapper::process
virtual int process(Condition c) const override
Processing callback.
Definition: ConditionsProcessor.h:96
dd4hep::cond::conditionsProcessor
ConditionsProcessor< typename std::remove_reference< T >::type > conditionsProcessor(T &&obj)
Creator utility function for ConditionsProcessor objects.
Definition: ConditionsProcessor.h:67
dd4hep::cond::ConditionsProcessor::~ConditionsProcessor
virtual ~ConditionsProcessor()=default
Default destructor.
dd4hep::Condition::Processor
Abstract base for processing callbacks to conditions objects.
Definition: Conditions.h:112
dd4hep::cond::ConditionsProcessor::ConditionsProcessor
ConditionsProcessor(T &p)
Initializing constructor.
Definition: ConditionsProcessor.h:49
dd4hep::ConditionsMap
ConditionsMap class.
Definition: ConditionsMap.h:59
dd4hep::cond::ConditionsProcessor::ConditionsProcessor
ConditionsProcessor(ConditionsProcessor &&copy)=default
R-value copy from a temporary copy (Since processor is reference)