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.
4 #include <cassert>
5 #include <sstream>
6 #include <iostream>
7 namespace edm {
8 
10  : isTracked_(false),
11  thePSet_(0),
12  theID_()
13  {
14  }
15 
17  : isTracked_(isTracked),
18  thePSet_(new ParameterSet(pset)),
19  theID_()
20  {
21  if (pset.isRegistered()) {
22  theID_ = pset.id();
23  }
24  }
25 
27  : isTracked_(isTracked),
28  thePSet_(),
29  theID_(id)
30  {
31  }
32 
33  ParameterSetEntry::ParameterSetEntry(std::string const& rep)
34  : isTracked_(rep[0] == '+'),
35  thePSet_(),
36  theID_()
37  {
38  assert(rep[0] == '+' || rep[0] == '-');
39  assert(rep[2] == '(');
40  assert(rep[rep.size()-1] == ')');
41  ParameterSetID newID(std::string(rep.begin()+3, rep.end()-1) );
42  theID_.swap(newID);
43  }
44 
46 
47  void
48  ParameterSetEntry::toString(std::string& result) const {
49  result += isTracked() ? "+Q(" : "-Q(";
50  if (!theID_.isValid()) {
52  << "ParameterSet::toString() called prematurely\n"
53  << "before ParameterSet::registerIt() has been called\n"
54  << "for all nested parameter sets\n";
55  }
56  theID_.toString(result);
57  result += ')';
58  }
59 
60  std::string
62  std::string result;
63  toString(result);
64  return result;
65  }
66 
68  if(!thePSet_) {
69  // get it from the registry, and save it here
71  }
72  return *thePSet_;
73  }
74 
76  if(!thePSet_) {
77  // get it from the registry, and save it here
79  }
80  return *thePSet_;
81  }
82 
84  assert(pset().isRegistered());
85  theID_ = pset().id();
86  }
87 
88  std::ostream & operator<<(std::ostream & os, ParameterSetEntry const& psetEntry) {
89  const char* trackiness = (psetEntry.isTracked()?"tracked":"untracked");
90  os << "PSet "<<trackiness<<" = ("<< psetEntry.pset() << ")";
91  return os;
92  }
93 }
94 
95 
ParameterSetID id() const
ParameterSet const & getParameterSet(ParameterSetID const &id)
value_ptr< ParameterSet > thePSet_
void swap(Hash< I > &other)
Definition: Hash.h:185
ParameterSet const & pset() const
tuple result
Definition: query.py:137
tuple pset
Definition: CrabTask.py:85
bool isRegistered() const
Definition: ParameterSet.h:60
std::string toString() const
void toString(std::string &result) const
Definition: Hash.h:178
bool isValid() const
Definition: Hash.h:136
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.