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

edm::ParameterSetEntry::ParameterSetEntry ( )

Definition at line 11 of file ParameterSetEntry.cc.

11 : isTracked_(false), thePSet_(nullptr), theID_() {}
atomic_value_ptr< ParameterSet > thePSet_
edm::ParameterSetEntry::ParameterSetEntry ( ParameterSet const &  pset,
bool  isTracked 
)

Definition at line 13 of file ParameterSetEntry.cc.

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

15  if (pset.isRegistered()) {
16  theID_ = pset.id();
17  }
18  }
ParameterSetID id() const
ParameterSet const & pset() const
returns the PSet
bool isRegistered() const
Definition: ParameterSet.h:60
atomic_value_ptr< ParameterSet > thePSet_
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_
edm::ParameterSetEntry::ParameterSetEntry ( std::string const &  rep)
explicit

Definition at line 23 of file ParameterSetEntry.cc.

References 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
rep
Definition: cuy.py:1190
Hash< ParameterSetType > ParameterSetID
atomic_value_ptr< ParameterSet > thePSet_
edm::ParameterSetEntry::~ParameterSetEntry ( )
default
edm::ParameterSetEntry::ParameterSetEntry ( ParameterSetEntry const &  )
default
edm::ParameterSetEntry::ParameterSetEntry ( ParameterSetEntry &&  )
default

Member Function Documentation

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

Definition at line 85 of file ParameterSetEntry.cc.

References edm::ParameterSet::dump(), 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  }
std::string dump(unsigned int indent=0) const
ParameterSet const & pset() const
returns the PSet
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  }
ParameterSet const & getParameterSet(ParameterSetID const &id)
atomic_value_ptr< ParameterSet > thePSet_
tmp
align.sh
Definition: createJobs.py:716
ParameterSetID edm::ParameterSetEntry::id ( void  ) const
inline
bool edm::ParameterSetEntry::isTracked ( ) const
inline
ParameterSetEntry& edm::ParameterSetEntry::operator= ( ParameterSetEntry const &  )
default
ParameterSetEntry& edm::ParameterSetEntry::operator= ( ParameterSetEntry &&  )
default
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(), prettyPrint(), and updateID().

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

Definition at line 64 of file ParameterSetEntry.cc.

References fillPSet(), and thePSet_.

Referenced by FWPSetTableManager::handlePSetEntry().

64  {
65  fillPSet();
66  return *thePSet_;
67  }
void fillPSet() const
reconstitutes the PSet from the registry
atomic_value_ptr< ParameterSet > thePSet_
void edm::ParameterSetEntry::setIsTracked ( bool  v)
inline
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  }
void toDigest(cms::Digest &digest) const
Definition: Hash.h:176
bool isValid() const
Definition: Hash.h:141
void append(std::string const &s)
Definition: Digest.cc:161
std::string edm::ParameterSetEntry::toString ( ) const
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, 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  }
void toString(std::string &result) const
Definition: Hash.h:171
bool isValid() const
Definition: Hash.h:141
void edm::ParameterSetEntry::updateID ( )

Definition at line 80 of file ParameterSetEntry.cc.

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

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

Friends And Related Function Documentation

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

bool edm::ParameterSetEntry::isTracked_
private

Definition at line 58 of file ParameterSetEntry.h.

ParameterSetID edm::ParameterSetEntry::theID_
private

Definition at line 63 of file ParameterSetEntry.h.

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

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

Definition at line 61 of file ParameterSetEntry.h.

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