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 <cassert>
5
#include <sstream>
6
#include <iostream>
7
namespace
edm {
8
9
ParameterSetEntry::ParameterSetEntry
()
10
: isTracked_(
false
),
11
thePSet_(0),
12
theID_()
13
{
14
}
15
16
ParameterSetEntry::ParameterSetEntry
(
ParameterSet
const
&
pset
,
bool
isTracked)
17
: isTracked_(isTracked),
18
thePSet_(new
ParameterSet
(pset)),
19
theID_()
20
{
21
if
(pset.
isRegistered
()) {
22
theID_
= pset.
id
();
23
}
24
}
25
26
ParameterSetEntry::ParameterSetEntry
(
ParameterSetID
const
&
id
,
bool
isTracked)
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
45
ParameterSetEntry::~ParameterSetEntry
() {}
46
47
void
48
ParameterSetEntry::toString
(std::string&
result
)
const
{
49
result +=
isTracked
() ?
"+Q("
:
"-Q("
;
50
if
(!
theID_
.
isValid
()) {
51
throw
edm::Exception
(
edm::errors::LogicError
)
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
61
ParameterSetEntry::toString
()
const
{
62
std::string
result
;
63
toString
(result);
64
return
result
;
65
}
66
67
ParameterSet
const
&
ParameterSetEntry::pset
()
const
{
68
if
(!
thePSet_
) {
69
// get it from the registry, and save it here
70
thePSet_
=
value_ptr<ParameterSet>
(
new
ParameterSet
(
getParameterSet
(
theID_
)));
71
}
72
return
*
thePSet_
;
73
}
74
75
ParameterSet
&
ParameterSetEntry::pset
() {
76
if
(!
thePSet_
) {
77
// get it from the registry, and save it here
78
thePSet_
=
value_ptr<ParameterSet>
(
new
ParameterSet
(
getParameterSet
(
theID_
)));
79
}
80
return
*
thePSet_
;
81
}
82
83
void
ParameterSetEntry::updateID
()
const
{
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
edm::ParameterSetEntry::~ParameterSetEntry
~ParameterSetEntry()
Definition:
ParameterSetEntry.cc:45
ParameterSetEntry.h
edm::Hash< ParameterSetType >
edm::ParameterSet::id
ParameterSetID id() const
Definition:
ParameterSet.cc:148
funct::false
false
Definition:
Factorize.h:34
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition:
ParameterSet.cc:847
edm::ParameterSetEntry::thePSet_
value_ptr< ParameterSet > thePSet_
Definition:
ParameterSetEntry.h:50
edm::Hash::swap
void swap(Hash< I > &other)
Definition:
Hash.h:185
ParameterSet.h
edm::ParameterSetEntry::pset
ParameterSet const & pset() const
Definition:
ParameterSetEntry.cc:67
EDMException.h
edm::ParameterSetEntry::updateID
void updateID() const
Definition:
ParameterSetEntry.cc:83
edm::ParameterSetEntry::isTracked
bool isTracked() const
Definition:
ParameterSetEntry.h:32
query.result
tuple result
Definition:
query.py:137
edm::ParameterSetEntry::ParameterSetEntry
ParameterSetEntry()
Definition:
ParameterSetEntry.cc:9
CrabTask.pset
tuple pset
Definition:
CrabTask.py:85
edm::ParameterSet::isRegistered
bool isRegistered() const
Definition:
ParameterSet.h:60
edm::hlt::Exception
error
Definition:
HLTenums.h:24
edm::ParameterSetEntry
Definition:
ParameterSetEntry.h:18
edm::ParameterSetEntry::toString
std::string toString() const
Definition:
ParameterSetEntry.cc:61
edm::Hash::toString
void toString(std::string &result) const
Definition:
Hash.h:178
edm::Hash::isValid
bool isValid() const
Definition:
Hash.h:136
edm::ParameterSetEntry::theID_
ParameterSetID theID_
Definition:
ParameterSetEntry.h:53
edm::ParameterSet
Definition:
ParameterSet.h:31
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:47
Generated for CMSSW Reference Manual by
1.8.5