Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
FWCore
ParameterSet
src
ParameterSetEntry.cc
Go to the documentation of this file.
1
#include "
FWCore/ParameterSet/interface/ParameterSetEntry.h
"
2
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
3
#include "
FWCore/Utilities/interface/EDMException.h
"
4
#include "
FWCore/Utilities/interface/Digest.h
"
5
6
#include <cassert>
7
#include <sstream>
8
#include <iostream>
9
namespace
edm {
10
11
ParameterSetEntry::ParameterSetEntry
()
12
: isTracked_(
false
),
13
thePSet_(0),
14
theID_()
15
{
16
}
17
18
ParameterSetEntry::ParameterSetEntry
(
ParameterSet
const
& pset,
bool
isTracked)
19
: isTracked_(isTracked),
20
thePSet_(new
ParameterSet
(pset)),
21
theID_()
22
{
23
if
(pset.
isRegistered
()) {
24
theID_
= pset.
id
();
25
}
26
}
27
28
ParameterSetEntry::ParameterSetEntry
(
ParameterSetID
const
&
id
,
bool
isTracked)
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
47
ParameterSetEntry::~ParameterSetEntry
() {}
48
49
void
50
ParameterSetEntry::toString
(std::string&
result
)
const
{
51
result +=
isTracked
() ?
"+Q("
:
"-Q("
;
52
if
(!
theID_
.
isValid
()) {
53
throw
edm::Exception
(
edm::errors::LogicError
)
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
63
ParameterSetEntry::toDigest
(
cms::Digest
&digest)
const
{
64
digest.
append
(
isTracked
() ?
"+Q("
:
"-Q("
, 3);
65
if
(!
theID_
.
isValid
()) {
66
throw
edm::Exception
(
edm::errors::LogicError
)
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
76
ParameterSetEntry::toString
()
const
{
77
std::string
result
;
78
toString
(result);
79
return
result
;
80
}
81
82
ParameterSet
const
&
ParameterSetEntry::pset
()
const
{
83
if
(!
thePSet_
) {
84
// get it from the registry, and save it here
85
thePSet_
=
value_ptr<ParameterSet>
(
new
ParameterSet
(
getParameterSet
(
theID_
)));
86
}
87
return
*
thePSet_
;
88
}
89
90
ParameterSet
&
ParameterSetEntry::pset
() {
91
if
(!
thePSet_
) {
92
// get it from the registry, and save it here
93
thePSet_
=
value_ptr<ParameterSet>
(
new
ParameterSet
(
getParameterSet
(
theID_
)));
94
}
95
return
*
thePSet_
;
96
}
97
98
void
ParameterSetEntry::updateID
()
const
{
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
edm::ParameterSetEntry::~ParameterSetEntry
~ParameterSetEntry()
Definition:
ParameterSetEntry.cc:47
ParameterSetEntry.h
edm::Hash< ParameterSetType >
edm::ParameterSet::id
ParameterSetID id() const
Definition:
ParameterSet.cc:197
funct::false
false
Definition:
Factorize.h:34
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition:
ParameterSet.cc:933
edm::ParameterSetEntry::thePSet_
value_ptr< ParameterSet > thePSet_
Definition:
ParameterSetEntry.h:55
edm::Hash::swap
void swap(Hash< I > &other)
Definition:
Hash.h:202
ParameterSet.h
edm::ParameterSetEntry::pset
ParameterSet const & pset() const
Definition:
ParameterSetEntry.cc:82
EDMException.h
edm::ParameterSetEntry::toDigest
void toDigest(cms::Digest &digest) const
Definition:
ParameterSetEntry.cc:63
edm::ParameterSetEntry::updateID
void updateID() const
Definition:
ParameterSetEntry.cc:98
Digest.h
edm::ParameterSetEntry::isTracked
bool isTracked() const
Definition:
ParameterSetEntry.h:36
query.result
tuple result
Definition:
query.py:137
edm::ParameterSetEntry::ParameterSetEntry
ParameterSetEntry()
Definition:
ParameterSetEntry.cc:11
edm::ParameterSet::isRegistered
bool isRegistered() const
Definition:
ParameterSet.h:66
edm::hlt::Exception
error
Definition:
HLTenums.h:24
cms::Digest
Definition:
Digest.h:54
edm::ParameterSetEntry
Definition:
ParameterSetEntry.h:21
edm::ParameterSetEntry::toString
std::string toString() const
Definition:
ParameterSetEntry.cc:76
edm::Hash::toDigest
void toDigest(cms::Digest &digest) const
Definition:
Hash.h:195
edm::Hash::toString
void toString(std::string &result) const
Definition:
Hash.h:188
edm::Hash::isValid
bool isValid() const
Definition:
Hash.h:146
edm::ParameterSetEntry::theID_
ParameterSetID theID_
Definition:
ParameterSetEntry.h:58
edm::ParameterSet
Definition:
ParameterSet.h:35
edm::value_ptr
Definition:
value_ptr.h:62
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition:
HLTGlobalStatus.h:117
edm::errors::LogicError
Definition:
EDMException.h:41
cms::Digest::append
void append(std::string const &s)
Definition:
Digest.cc:182
Generated for CMSSW Reference Manual by
1.8.5