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 22 of file ParameterSetEntry.h.

Constructor & Destructor Documentation

edm::ParameterSetEntry::ParameterSetEntry ( )

Definition at line 11 of file ParameterSetEntry.cc.

12  : isTracked_(false),
13  thePSet_(nullptr),
14  theID_()
15  {
16  }
atomic_value_ptr< ParameterSet > thePSet_
edm::ParameterSetEntry::ParameterSetEntry ( ParameterSet const &  pset,
bool  isTracked 
)

Definition at line 18 of file ParameterSetEntry.cc.

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

21  theID_()
22  {
23  if (pset.isRegistered()) {
24  theID_ = pset.id();
25  }
26  }
ParameterSetID id() const
ParameterSet const & pset() const
returns the PSet
bool isRegistered() const
Definition: ParameterSet.h:64
atomic_value_ptr< ParameterSet > thePSet_
edm::ParameterSetEntry::ParameterSetEntry ( ParameterSetID const &  id,
bool  isTracked 
)

Definition at line 28 of file ParameterSetEntry.cc.

30  thePSet_(),
31  theID_(id)
32  {
33  }
atomic_value_ptr< ParameterSet > thePSet_
edm::ParameterSetEntry::ParameterSetEntry ( std::string const &  rep)
explicit

Definition at line 35 of file ParameterSetEntry.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, edm::Hash< I >::swap(), and theID_.

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  }
void swap(Hash< I > &other)
Definition: Hash.h:210
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 106 of file ParameterSetEntry.cc.

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

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

106  {
107  std::ostringstream os;
108  const char* trackiness = (isTracked()?"tracked":"untracked");
109  os << "PSet "<<trackiness<<" = (" << pset().dump(indent) << ")";
110  return os.str();
111  }
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 90 of file ParameterSetEntry.cc.

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

Referenced by pset(), and psetForUpdate().

90  {
91  if(nullptr == thePSet_.load()) {
92  auto tmp = std::make_unique<ParameterSet>(getParameterSet(theID_));
93  ParameterSet* expected = nullptr;
94  if(thePSet_.compare_exchange_strong(expected, tmp.get())) {
95  // thePSet_ was equal to nullptr and now is equal to tmp.get()
96  tmp.release();
97  }
98  }
99  }
ParameterSet const & getParameterSet(ParameterSetID const &id)
atomic_value_ptr< ParameterSet > thePSet_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
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 80 of file ParameterSetEntry.cc.

References fillPSet(), and thePSet_.

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

80  {
81  fillPSet();
82  return *thePSet_;
83  }
void fillPSet() const
reconstitutes the PSet from the registry
atomic_value_ptr< ParameterSet > thePSet_
ParameterSet & edm::ParameterSetEntry::psetForUpdate ( )

Definition at line 85 of file ParameterSetEntry.cc.

References fillPSet(), and thePSet_.

Referenced by FWPSetTableManager::handlePSetEntry().

85  {
86  fillPSet();
87  return *thePSet_;
88  }
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 61 of file ParameterSetEntry.cc.

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

61  {
62  digest.append(isTracked() ? "+Q(" : "-Q(", 3);
63  if (!theID_.isValid()) {
65  << "ParameterSet::toString() called prematurely\n"
66  << "before ParameterSet::registerIt() has been called\n"
67  << "for all nested parameter sets\n";
68  }
69  theID_.toDigest(digest);
70  digest.append(")", 1);
71  }
void toDigest(cms::Digest &digest) const
Definition: Hash.h:203
bool isValid() const
Definition: Hash.h:154
void append(std::string const &s)
Definition: Digest.cc:182
std::string edm::ParameterSetEntry::toString ( ) const
void edm::ParameterSetEntry::toString ( std::string &  result) const

Definition at line 48 of file ParameterSetEntry.cc.

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

48  {
49  result += isTracked() ? "+Q(" : "-Q(";
50  if (!theID_.isValid()) {
52  << "ParameterSet::toString() called prematurely\n"
53  << "before ParameterSet::registerIt() has been called\n"
54  << "for all nested parameter sets\n";
55  }
57  result += ')';
58  }
void toString(std::string &result) const
Definition: Hash.h:196
bool isValid() const
Definition: Hash.h:154
void edm::ParameterSetEntry::updateID ( )

Definition at line 101 of file ParameterSetEntry.cc.

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

101  {
102  assert(pset().isRegistered());
103  theID_ = pset().id();
104  }
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 113 of file ParameterSetEntry.cc.

113  {
114  os << psetEntry.dump();
115  return os;
116  }

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