CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParameterSetEntry.cc
Go to the documentation of this file.
5 
6 #include <cassert>
7 #include <sstream>
8 #include <iostream>
9 namespace edm {
10 
12  : isTracked_(false),
13  thePSet_(0),
14  theID_()
15  {
16  }
17 
19  : isTracked_(isTracked),
20  thePSet_(new ParameterSet(pset)),
21  theID_()
22  {
23  if (pset.isRegistered()) {
24  theID_ = pset.id();
25  }
26  }
27 
29  : isTracked_(isTracked),
30  thePSet_(),
31  theID_(id)
32  {
33  }
34 
35  ParameterSetEntry::ParameterSetEntry(std::string const& rep)
36  : isTracked_(rep[0] == '+'),
37  thePSet_(),
38  theID_()
39  {
40  assert(rep[0] == '+' || rep[0] == '-');
41  assert(rep[2] == '(');
42  assert(rep[rep.size()-1] == ')');
43  ParameterSetID newID(std::string(rep.begin()+3, rep.end()-1) );
44  theID_.swap(newID);
45  }
46 
48 
49  void
50  ParameterSetEntry::toString(std::string& result) const {
51  result += isTracked() ? "+Q(" : "-Q(";
52  if (!theID_.isValid()) {
54  << "ParameterSet::toString() called prematurely\n"
55  << "before ParameterSet::registerIt() has been called\n"
56  << "for all nested parameter sets\n";
57  }
58  theID_.toString(result);
59  result += ')';
60  }
61 
62  void
64  digest.append(isTracked() ? "+Q(" : "-Q(", 3);
65  if (!theID_.isValid()) {
67  << "ParameterSet::toString() called prematurely\n"
68  << "before ParameterSet::registerIt() has been called\n"
69  << "for all nested parameter sets\n";
70  }
71  theID_.toDigest(digest);
72  digest.append(")", 1);
73  }
74 
75  std::string
77  std::string result;
78  toString(result);
79  return result;
80  }
81 
83  if(!thePSet_) {
84  // get it from the registry, and save it here
86  }
87  return *thePSet_;
88  }
89 
91  if(!thePSet_) {
92  // get it from the registry, and save it here
94  }
95  return *thePSet_;
96  }
97 
99  assert(pset().isRegistered());
100  theID_ = pset().id();
101  }
102 
103  std::ostream & operator<<(std::ostream & os, ParameterSetEntry const& psetEntry) {
104  const char* trackiness = (psetEntry.isTracked()?"tracked":"untracked");
105  os << "PSet "<<trackiness<<" = ("<< psetEntry.pset() << ")";
106  return os;
107  }
108 }
109 
110 
ParameterSetID id() const
ParameterSet const & getParameterSet(ParameterSetID const &id)
value_ptr< ParameterSet > thePSet_
void swap(Hash< I > &other)
Definition: Hash.h:202
ParameterSet const & pset() const
void toDigest(cms::Digest &digest) const
tuple result
Definition: query.py:137
bool isRegistered() const
Definition: ParameterSet.h:66
std::string toString() const
void toDigest(cms::Digest &digest) const
Definition: Hash.h:195
void toString(std::string &result) const
Definition: Hash.h:188
bool isValid() const
Definition: Hash.h:146
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void append(std::string const &s)
Definition: Digest.cc:182