DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsData.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/Printout.h>
16 #include <DD4hep/InstanceCount.h>
17 #include <DD4hep/ConditionsData.h>
18 
19 using namespace dd4hep::cond;
20 
22 std::ostream& operator << (std::ostream& s, const AbstractMap& data) {
23  struct _Print {
24  void operator()(const AbstractMap::Params::value_type& obj) const {
25  if ( obj.second.typeInfo() == typeid(AbstractMap) ) {
26  const AbstractMap& d= obj.second.get<AbstractMap>();
27  dd4hep::printout(dd4hep::INFO,"Condition","++ %-16s [%d] %-8s -> %s",
28  obj.first.c_str(), d.classID,
29  obj.second.dataType().c_str(),
30  obj.second.str().c_str());
31  }
32  else {
33  dd4hep::printout(dd4hep::INFO,"Condition","++ %-16s %-8s -> %s",
34  obj.first.c_str(),
35  obj.second.dataType().c_str(),
36  obj.second.str().c_str());
37  }
38  }
39  };
40  if ( !data.params.empty() ) {
41  for_each(data.params.begin(), data.params.end(), _Print());
42  }
43  return s;
44 }
45 
48 }
49 
51 AbstractMap::AbstractMap() : clientData(0), classID(0) {
53 }
54 
57  : clientData(c.clientData), params(c.params), classID(c.classID)
58 {
60 }
61 
64  if ( clientData ) clientData->release();
65  clientData = 0;
67 }
68 
71  if ( this != &c ) {
73  params = c.params;
74  classID = c.classID;
75  }
76  return *this;
77 }
78 
79 #include <DD4hep/GrammarUnparsed.h>
80 static auto s_registry = dd4hep::GrammarRegistry::pre_note<AbstractMap>(1);
dd4hep::cond::AbstractMap::AbstractMap
AbstractMap()
Default constructor.
Definition: ConditionsData.cpp:51
dd4hep::cond::AbstractMap::classID
int classID
Definition: ConditionsData.h:59
ConditionsData.h
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
dd4hep::operator<<
std::ostream & operator<<(std::ostream &os, const DetType &t)
Definition: DetType.h:99
dd4hep::cond
Namespace for implementation details of the AIDA detector description toolkit.
Definition: ConditionsCleanup.h:23
dd4hep::cond::AbstractMap::~AbstractMap
virtual ~AbstractMap()
Default destructor.
Definition: ConditionsData.cpp:63
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition: InstanceCount.h:102
dd4hep::cond::ClientData::release
virtual void release()=0
dd4hep::cond::AbstractMap::clientData
ClientData * clientData
Definition: ConditionsData.h:57
dd4hep::cond::AbstractMap::get
const T & get(const std::string &item) const
Simplify access to mapped item of the parameter list (const access)
Definition: ConditionsData.h:113
GrammarUnparsed.h
dd4hep::cond::AbstractMap::operator=
AbstractMap & operator=(const AbstractMap &c)
Assignment operator.
Definition: ConditionsData.cpp:70
dd4hep::cond::ClientData::~ClientData
virtual ~ClientData()
Default destructor.
Definition: ConditionsData.cpp:47
InstanceCount.h
dd4hep::cond::AbstractMap::params
Params params
Definition: ConditionsData.h:58
Printout.h
dd4hep::cond::AbstractMap
Conditions data block. Internaly maps other objects to abstract data blocks.
Definition: ConditionsData.h:49