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 const &)=default
 
ParameterSetEntryoperator= (ParameterSetEntry &&)=default
 
 ParameterSetEntry ()
 
 ParameterSetEntry (ParameterSet const &pset, bool isTracked)
 
 ParameterSetEntry (ParameterSetID const &id, bool isTracked)
 
 ParameterSetEntry (std::string const &rep)
 
 ParameterSetEntry (ParameterSetEntry const &)=default
 
 ParameterSetEntry (ParameterSetEntry &&)=default
 
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_() {}
atomic_value_ptr< ParameterSet > thePSet_

◆ ParameterSetEntry() [2/6]

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

Definition at line 13 of file ParameterSetEntry.cc.

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

15  if (pset.isRegistered()) {
16  theID_ = pset.id();
17  }
18  }
ParameterSet const & pset() const
returns the PSet
ParameterSetID id() const
atomic_value_ptr< ParameterSet > thePSet_
bool isRegistered() const
Definition: ParameterSet.h:71

◆ 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) {}
atomic_value_ptr< ParameterSet > thePSet_

◆ ParameterSetEntry() [4/6]

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

Definition at line 23 of file ParameterSetEntry.cc.

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

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  }
void swap(Hash< I > &other)
Definition: Hash.h:181
assert(be >=bs)
rep
Definition: cuy.py:1189
Hash< ParameterSetType > ParameterSetID
atomic_value_ptr< ParameterSet > thePSet_

◆ ~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.

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

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

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

◆ fillPSet()

void edm::ParameterSetEntry::fillPSet ( ) const

reconstitutes the PSet from the registry

Definition at line 69 of file ParameterSetEntry.cc.

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

Referenced by pset(), and psetForUpdate().

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  }
atomic_value_ptr< ParameterSet > thePSet_
ParameterSet const & getParameterSet(ParameterSetID const &id)
tmp
align.sh
Definition: createJobs.py:716

◆ id()

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

Definition at line 44 of file ParameterSetEntry.h.

References theID_.

44 { return theID_; }

◆ isTracked()

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ pset()

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

returns the PSet

Definition at line 59 of file ParameterSetEntry.cc.

References fillPSet(), and thePSet_.

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

59  {
60  fillPSet();
61  return *thePSet_;
62  }
void fillPSet() const
reconstitutes the PSet from the registry
atomic_value_ptr< ParameterSet > thePSet_

◆ psetForUpdate()

ParameterSet & edm::ParameterSetEntry::psetForUpdate ( )

Definition at line 64 of file ParameterSetEntry.cc.

References fillPSet(), and thePSet_.

64  {
65  fillPSet();
66  return *thePSet_;
67  }
void fillPSet() const
reconstitutes the PSet from the registry
atomic_value_ptr< ParameterSet > thePSet_

◆ setIsTracked()

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

◆ toDigest()

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

Definition at line 42 of file ParameterSetEntry.cc.

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

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  }
bool isValid() const
Definition: Hash.h:141
void toDigest(cms::Digest &digest) const
Definition: Hash.h:176
void append(std::string const &s)
Definition: Digest.cc:161

◆ toString() [1/2]

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

◆ toString() [2/2]

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

Definition at line 31 of file ParameterSetEntry.cc.

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

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  }
bool isValid() const
Definition: Hash.h:141
void toString(std::string &result) const
Definition: Hash.h:171

◆ updateID()

void edm::ParameterSetEntry::updateID ( )

Definition at line 80 of file ParameterSetEntry.cc.

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

80  {
81  assert(pset().isRegistered());
82  theID_ = pset().id();
83  }
ParameterSet const & pset() const
returns the PSet
assert(be >=bs)
ParameterSetID id() const

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().