CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Friends
edm::ParameterSetEntry Class Reference

#include <ParameterSetEntry.h>

Public Member Functions

std::string dump (unsigned int indent=0) const
 
void fillPSet () const
 reconstitutes the PSet from the registry More...
 
ParameterSetID id () const
 
bool isTracked () const
 
ParameterSetEntryoperator= (ParameterSetEntry &&)=default
 
ParameterSetEntryoperator= (ParameterSetEntry const &)=default
 
 ParameterSetEntry ()
 
 ParameterSetEntry (ParameterSet const &pset, bool isTracked)
 
 ParameterSetEntry (ParameterSetEntry &&)=default
 
 ParameterSetEntry (ParameterSetEntry const &)=default
 
 ParameterSetEntry (ParameterSetID const &id, bool isTracked)
 
 ParameterSetEntry (std::string const &rep)
 
ParameterSet const & pset () const
 returns the PSet More...
 
ParameterSetpsetForUpdate ()
 
void setIsTracked (bool v)
 
void toDigest (cms::Digest &digest) const
 
std::string toString () const
 
void toString (std::string &result) const
 
void updateID ()
 
 ~ParameterSetEntry ()=default
 

Private Attributes

bool isTracked_
 
ParameterSetID theID_
 
atomic_value_ptr< ParameterSetthePSet_
 

Friends

std::ostream & operator<< (std::ostream &os, ParameterSetEntry const &psetEntry)
 

Detailed Description

Definition at line 23 of file ParameterSetEntry.h.

Constructor & Destructor Documentation

◆ ParameterSetEntry() [1/6]

edm::ParameterSetEntry::ParameterSetEntry ( )

Definition at line 11 of file ParameterSetEntry.cc.

11 : isTracked_(false), thePSet_(nullptr), theID_() {}

◆ ParameterSetEntry() [2/6]

edm::ParameterSetEntry::ParameterSetEntry ( ParameterSet const &  pset,
bool  isTracked 
)

Definition at line 13 of file ParameterSetEntry.cc.

15  if (pset.isRegistered()) {
16  theID_ = pset.id();
17  }
18  }

References edm::ParameterSet::id(), edm::ParameterSet::isRegistered(), pset(), and theID_.

◆ ParameterSetEntry() [3/6]

edm::ParameterSetEntry::ParameterSetEntry ( ParameterSetID const &  id,
bool  isTracked 
)

Definition at line 20 of file ParameterSetEntry.cc.

21  : isTracked_(isTracked), thePSet_(), theID_(id) {}

◆ ParameterSetEntry() [4/6]

edm::ParameterSetEntry::ParameterSetEntry ( std::string const &  rep)
explicit

Definition at line 23 of file ParameterSetEntry.cc.

23  : 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  }

References cms::cuda::assert(), cuy::rep, AlCaHLTBitMon_QueryRunRegistry::string, edm::Hash< I >::swap(), and theID_.

◆ ~ParameterSetEntry()

edm::ParameterSetEntry::~ParameterSetEntry ( )
default

◆ ParameterSetEntry() [5/6]

edm::ParameterSetEntry::ParameterSetEntry ( ParameterSetEntry const &  )
default

◆ ParameterSetEntry() [6/6]

edm::ParameterSetEntry::ParameterSetEntry ( ParameterSetEntry &&  )
default

Member Function Documentation

◆ dump()

std::string edm::ParameterSetEntry::dump ( unsigned int  indent = 0) const

Definition at line 85 of file ParameterSetEntry.cc.

85  {
86  std::ostringstream os;
87  const char* trackiness = (isTracked() ? "tracked" : "untracked");
88  os << "PSet " << trackiness << " = (" << pset().dump(indent) << ")";
89  return os.str();
90  }

References edm::ParameterSet::dump(), util.rrClient::indent, isTracked(), and pset().

Referenced by edm::ParameterSet::dump(), and edm::operator<<().

◆ fillPSet()

void edm::ParameterSetEntry::fillPSet ( ) const

reconstitutes the PSet from the registry

Definition at line 69 of file ParameterSetEntry.cc.

69  {
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  }

References edm::getParameterSet(), theID_, thePSet_, and createJobs::tmp.

Referenced by pset(), and psetForUpdate().

◆ id()

ParameterSetID edm::ParameterSetEntry::id ( void  ) const
inline

Definition at line 44 of file ParameterSetEntry.h.

44 { return theID_; }

References theID_.

◆ isTracked()

bool edm::ParameterSetEntry::isTracked ( ) const
inline

◆ operator=() [1/2]

ParameterSetEntry& edm::ParameterSetEntry::operator= ( ParameterSetEntry &&  )
default

◆ operator=() [2/2]

ParameterSetEntry& edm::ParameterSetEntry::operator= ( ParameterSetEntry const &  )
default

◆ pset()

ParameterSet const & edm::ParameterSetEntry::pset ( ) const

returns the PSet

Definition at line 59 of file ParameterSetEntry.cc.

59  {
60  fillPSet();
61  return *thePSet_;
62  }

References fillPSet(), and thePSet_.

Referenced by dump(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getUntrackedParameterSet(), ParameterSetEntry(), prettyPrint(), and updateID().

◆ psetForUpdate()

ParameterSet & edm::ParameterSetEntry::psetForUpdate ( )

Definition at line 64 of file ParameterSetEntry.cc.

64  {
65  fillPSet();
66  return *thePSet_;
67  }

References fillPSet(), and thePSet_.

◆ setIsTracked()

void edm::ParameterSetEntry::setIsTracked ( bool  v)
inline

Definition at line 42 of file ParameterSetEntry.h.

42 { isTracked_ = v; }

References isTracked_, and findQualityFiles::v.

◆ toDigest()

void edm::ParameterSetEntry::toDigest ( cms::Digest digest) const

Definition at line 42 of file ParameterSetEntry.cc.

42  {
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  }

References cms::Digest::append(), Exception, isTracked(), edm::Hash< I >::isValid(), edm::errors::LogicError, theID_, and edm::Hash< I >::toDigest().

◆ toString() [1/2]

std::string edm::ParameterSetEntry::toString ( ) const

Definition at line 53 of file ParameterSetEntry.cc.

53  {
56  return result;
57  }

References mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::ParameterSet::getParameterAsString().

◆ toString() [2/2]

void edm::ParameterSetEntry::toString ( std::string &  result) const

Definition at line 31 of file ParameterSetEntry.cc.

31  {
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  }

References Exception, isTracked(), edm::Hash< I >::isValid(), edm::errors::LogicError, mps_fire::result, theID_, and edm::Hash< I >::toString().

◆ updateID()

void edm::ParameterSetEntry::updateID ( )

Definition at line 80 of file ParameterSetEntry.cc.

80  {
81  assert(pset().isRegistered());
82  theID_ = pset().id();
83  }

References cms::cuda::assert(), edm::ParameterSet::id(), pset(), and theID_.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
ParameterSetEntry const &  psetEntry 
)
friend

Definition at line 92 of file ParameterSetEntry.cc.

92  {
93  os << psetEntry.dump();
94  return os;
95  }

Member Data Documentation

◆ isTracked_

bool edm::ParameterSetEntry::isTracked_
private

Definition at line 58 of file ParameterSetEntry.h.

Referenced by isTracked(), and setIsTracked().

◆ theID_

ParameterSetID edm::ParameterSetEntry::theID_
private

Definition at line 63 of file ParameterSetEntry.h.

Referenced by fillPSet(), id(), ParameterSetEntry(), toDigest(), toString(), and updateID().

◆ thePSet_

atomic_value_ptr<ParameterSet> edm::ParameterSetEntry::thePSet_
mutableprivate

Definition at line 61 of file ParameterSetEntry.h.

Referenced by fillPSet(), pset(), and psetForUpdate().

edm::ParameterSetID
Hash< ParameterSetType > ParameterSetID
Definition: ParameterSetID.h:21
cms::Digest::append
void append(std::string const &s)
Definition: Digest.cc:161
edm::ParameterSetEntry::isTracked_
bool isTracked_
Definition: ParameterSetEntry.h:58
edm::Hash::swap
void swap(Hash< I > &other)
Definition: Hash.h:181
edm::errors::LogicError
Definition: EDMException.h:37
edm::ParameterSetEntry::fillPSet
void fillPSet() const
reconstitutes the PSet from the registry
Definition: ParameterSetEntry.cc:69
cms::cuda::assert
assert(be >=bs)
edm::ParameterSet::id
ParameterSetID id() const
Definition: ParameterSet.cc:189
findQualityFiles.v
v
Definition: findQualityFiles.py:179
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::ParameterSetEntry::theID_
ParameterSetID theID_
Definition: ParameterSetEntry.h:63
edm::Hash::toDigest
void toDigest(cms::Digest &digest) const
Definition: Hash.h:176
edm::Hash::isValid
bool isValid() const
Definition: Hash.h:141
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ParameterSet
Definition: Functions.h:16
edm::Hash::toString
void toString(std::string &result) const
Definition: Hash.h:171
cuy.rep
rep
Definition: cuy.py:1190
edm::ParameterSetEntry::isTracked
bool isTracked() const
Definition: ParameterSetEntry.h:41
edm::ParameterSet::isRegistered
bool isRegistered() const
Definition: ParameterSet.h:71
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:862
edm::ParameterSetEntry::toString
std::string toString() const
Definition: ParameterSetEntry.cc:53
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
mps_fire.result
result
Definition: mps_fire.py:311