CMS 3D CMS Logo

ParameterSetEntry.cc
Go to the documentation of this file.
5 
6 #include <cassert>
7 #include <sstream>
8 #include <iostream>
9 namespace edm {
10 
11  ParameterSetEntry::ParameterSetEntry() : isTracked_(false), thePSet_(nullptr), theID_() {}
12 
14  : isTracked_(isTracked), thePSet_(new ParameterSet(pset)), theID_() {
15  if (pset.isRegistered()) {
16  theID_ = pset.id();
17  }
18  }
19 
21  : isTracked_(isTracked), thePSet_(), theID_(id) {}
22 
23  ParameterSetEntry::ParameterSetEntry(std::string const& rep) : isTracked_(rep[0] == '+'), thePSet_(), theID_() {
24  assert(rep[0] == '+' || rep[0] == '-');
25  assert(rep[2] == '(');
26  assert(rep[rep.size() - 1] == ')');
27  ParameterSetID newID(std::string(rep.begin() + 3, rep.end() - 1));
28  theID_.swap(newID);
29  }
30 
32  result += isTracked() ? "+Q(" : "-Q(";
33  if (!theID_.isValid()) {
34  throw edm::Exception(edm::errors::LogicError) << "ParameterSet::toString() called prematurely\n"
35  << "before ParameterSet::registerIt() has been called\n"
36  << "for all nested parameter sets\n";
37  }
39  result += ')';
40  }
41 
43  digest.append(isTracked() ? "+Q(" : "-Q(", 3);
44  if (!theID_.isValid()) {
45  throw edm::Exception(edm::errors::LogicError) << "ParameterSet::toString() called prematurely\n"
46  << "before ParameterSet::registerIt() has been called\n"
47  << "for all nested parameter sets\n";
48  }
49  theID_.toDigest(digest);
50  digest.append(")", 1);
51  }
52 
56  return result;
57  }
58 
60  fillPSet();
61  return *thePSet_;
62  }
63 
65  fillPSet();
66  return *thePSet_;
67  }
68 
70  if (nullptr == thePSet_.load()) {
71  auto tmp = std::make_unique<ParameterSet>(getParameterSet(theID_));
72  ParameterSet* expected = nullptr;
73  if (thePSet_.compare_exchange_strong(expected, tmp.get())) {
74  // thePSet_ was equal to nullptr and now is equal to tmp.get()
75  tmp.release();
76  }
77  }
78  }
79 
81  assert(pset().isRegistered());
82  theID_ = pset().id();
83  }
84 
86  std::ostringstream os;
87  const char* trackiness = (isTracked() ? "tracked" : "untracked");
88  os << "PSet " << trackiness << " = (" << pset().dump(indent) << ")";
89  return os.str();
90  }
91 
92  std::ostream& operator<<(std::ostream& os, ParameterSetEntry const& psetEntry) {
93  os << psetEntry.dump();
94  return os;
95  }
96 } // namespace edm
cms::Digest::append
void append(std::string const &s)
Definition: Digest.cc:161
funct::false
false
Definition: Factorize.h:29
edm::Hash::swap
void swap(Hash< I > &other)
Definition: Hash.h:181
edm::errors::LogicError
Definition: EDMException.h:37
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetEntry::fillPSet
void fillPSet() const
reconstitutes the PSet from the registry
Definition: ParameterSetEntry.cc:69
cms::cuda::assert
assert(be >=bs)
edm::ParameterSetEntry::psetForUpdate
ParameterSet & psetForUpdate()
Definition: ParameterSetEntry.cc:64
edm::ParameterSet::id
ParameterSetID id() const
Definition: ParameterSet.cc:189
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::ParameterSetEntry::ParameterSetEntry
ParameterSetEntry()
Definition: ParameterSetEntry.cc:11
edm::ParameterSetEntry::theID_
ParameterSetID theID_
Definition: ParameterSetEntry.h:63
edm::Hash::toDigest
void toDigest(cms::Digest &digest) const
Definition: Hash.h:176
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
EDMException.h
edm::Hash::isValid
bool isValid() const
Definition: Hash.h:141
cms::Digest
Definition: Digest.h:46
edm::ParameterSet::dump
std::string dump(unsigned int indent=0) const
Definition: ParameterSet.cc:832
edm::ParameterSetEntry::thePSet_
atomic_value_ptr< ParameterSet > thePSet_
Definition: ParameterSetEntry.h:61
edm::Hash< ParameterSetType >
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Hash::toString
void toString(std::string &result) const
Definition: Hash.h:171
cuy.rep
rep
Definition: cuy.py:1189
edm::ParameterSetEntry::isTracked
bool isTracked() const
Definition: ParameterSetEntry.h:41
edm::ParameterSet::isRegistered
bool isRegistered() const
Definition: ParameterSet.h:71
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Digest.h
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:862
edm::ParameterSetEntry::toString
std::string toString() const
Definition: ParameterSetEntry.cc:53
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
edm::ParameterSetEntry::updateID
void updateID()
Definition: ParameterSetEntry.cc:80
Exception
Definition: hltDiff.cc:245
edm::ParameterSetEntry::pset
ParameterSet const & pset() const
returns the PSet
Definition: ParameterSetEntry.cc:59
util.rrClient.indent
indent
Definition: rrClient.py:41
edm::ParameterSetEntry
Definition: ParameterSetEntry.h:23
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
edm::ParameterSetEntry::dump
std::string dump(unsigned int indent=0) const
Definition: ParameterSetEntry.cc:85
edm::ParameterSetEntry::toDigest
void toDigest(cms::Digest &digest) const
Definition: ParameterSetEntry.cc:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ParameterSetEntry.h