CMS 3D CMS Logo

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

#include <VParameterSetEntry.h>

Public Member Functions

std::string dump (unsigned int indent=0) const
 
void fillVPSet () const
 reconstitutes the VPSet from the registry More...
 
bool isTracked () const
 
VParameterSetEntryoperator= (VParameterSetEntry const &)=default
 
VParameterSetEntryoperator= (VParameterSetEntry &&)=default
 
ParameterSetpsetInVector (int i)
 
void registerPsetsAndUpdateIDs ()
 
std::vector< ParameterSet >::size_type size () const
 
void toDigest (cms::Digest &digest) const
 
std::string toString () const
 
void toString (std::string &result) const
 
 VParameterSetEntry ()
 
 VParameterSetEntry (std::vector< ParameterSet > const &vpset, bool isTracked)
 
 VParameterSetEntry (std::string_view rep)
 
 VParameterSetEntry (VParameterSetEntry const &)=default
 
 VParameterSetEntry (VParameterSetEntry &&)=default
 
std::vector< ParameterSet > const & vpset () const
 returns the VPSet More...
 
std::vector< ParameterSet > & vpsetForUpdate ()
 
 ~VParameterSetEntry ()=default
 

Private Attributes

value_ptr< std::vector< ParameterSetID > > theIDs_
 
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_
 
bool tracked_
 

Friends

std::ostream & operator<< (std::ostream &os, VParameterSetEntry const &vpsetEntry)
 

Detailed Description

Definition at line 24 of file VParameterSetEntry.h.

Constructor & Destructor Documentation

◆ VParameterSetEntry() [1/5]

edm::VParameterSetEntry::VParameterSetEntry ( )

Definition at line 12 of file VParameterSetEntry.cc.

12 : tracked_(false), theVPSet_(), theIDs_() {}
value_ptr< std::vector< ParameterSetID > > theIDs_
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_

◆ VParameterSetEntry() [2/5]

edm::VParameterSetEntry::VParameterSetEntry ( std::vector< ParameterSet > const &  vpset,
bool  isTracked 
)

Definition at line 14 of file VParameterSetEntry.cc.

15  : tracked_(isTracked), theVPSet_(new std::vector<ParameterSet>(vpset)), theIDs_() {}
std::vector< ParameterSet > const & vpset() const
returns the VPSet
value_ptr< std::vector< ParameterSetID > > theIDs_
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_

◆ VParameterSetEntry() [3/5]

edm::VParameterSetEntry::VParameterSetEntry ( std::string_view  rep)

Definition at line 17 of file VParameterSetEntry.cc.

References cms::cuda::assert(), cuy::rep, edm::split(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and theIDs_.

18  : tracked_(rep[0] == '+'), theVPSet_(), theIDs_(new std::vector<ParameterSetID>) {
19  assert(rep[0] == '+' || rep[0] == '-');
20  std::vector<std::string_view> temp;
21  // need a substring that starts at the '{'
22  std::string_view bracketedRepr = rep.substr(2);
23  split(std::back_inserter(temp), bracketedRepr, '{', ',', '}');
24  theIDs_->reserve(temp.size());
25  for (auto const& id : temp) {
26  theIDs_->emplace_back(std::string(id));
27  }
28  }
assert(be >=bs)
value_ptr< std::vector< ParameterSetID > > theIDs_
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_
rep
Definition: cuy.py:1189
bool split(OutIter result, std::string_view string_to_split, char first, char sep, char last)
Definition: split.h:70

◆ ~VParameterSetEntry()

edm::VParameterSetEntry::~VParameterSetEntry ( )
default

◆ VParameterSetEntry() [4/5]

edm::VParameterSetEntry::VParameterSetEntry ( VParameterSetEntry const &  )
default

◆ VParameterSetEntry() [5/5]

edm::VParameterSetEntry::VParameterSetEntry ( VParameterSetEntry &&  )
default

Member Function Documentation

◆ dump()

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

Definition at line 117 of file VParameterSetEntry.cc.

References MillePedeFileConverter_cfg::e, mps_fire::i, validateAlignments::indent, printContent_cfi::indentation, isTracked(), l1tGTMenu_BTagSeeds_cff::os, command_line::start, AlCaHLTBitMon_QueryRunRegistry::string, and vpset().

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

117  {
119  std::ostringstream os;
120  std::vector<ParameterSet> const& vps = vpset();
121  os << "VPSet " << (isTracked() ? "tracked" : "untracked") << " = ({" << std::endl;
123  std::string const between(",\n");
124  for (std::vector<ParameterSet>::const_iterator i = vps.begin(), e = vps.end(); i != e; ++i) {
125  os << start << indentation << i->dump(indent);
126  start = between;
127  }
128  if (!vps.empty()) {
129  os << std::endl;
130  }
131  os << indentation << "})";
132  return os.str();
133  }
Definition: start.py:1
std::vector< ParameterSet > const & vpset() const
returns the VPSet

◆ fillVPSet()

void edm::VParameterSetEntry::fillVPSet ( ) const

reconstitutes the VPSet from the registry

Definition at line 77 of file VParameterSetEntry.cc.

References edm::getParameterSet(), theIDs_, theVPSet_, and createJobs::tmp.

Referenced by registerPsetsAndUpdateIDs(), vpset(), and vpsetForUpdate().

77  {
78  if (nullptr == theVPSet_.load()) {
79  auto tmp = std::make_unique<std::vector<ParameterSet>>();
80  tmp->reserve(theIDs_->size());
81  for (auto const& theID : *theIDs_) {
82  tmp->push_back(getParameterSet(theID));
83  }
84  VParameterSet* expected = nullptr;
85  if (theVPSet_.compare_exchange_strong(expected, tmp.get())) {
86  // theVPSet_ was equal to nullptr and now is equal to tmp.get()
87  tmp.release();
88  }
89  }
90  }
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:35
value_ptr< std::vector< ParameterSetID > > theIDs_
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_
ParameterSet const & getParameterSet(ParameterSetID const &id)
tmp
align.sh
Definition: createJobs.py:716

◆ isTracked()

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ psetInVector()

ParameterSet & edm::VParameterSetEntry::psetInVector ( int  i)

◆ registerPsetsAndUpdateIDs()

void edm::VParameterSetEntry::registerPsetsAndUpdateIDs ( )

Definition at line 105 of file VParameterSetEntry.cc.

References MillePedeFileConverter_cfg::e, fillVPSet(), mps_fire::i, theIDs_, and theVPSet_.

105  {
106  fillVPSet();
107  theIDs_ = value_ptr<std::vector<ParameterSetID>>(new std::vector<ParameterSetID>);
108  theIDs_->resize(theVPSet_->size());
109  for (std::vector<ParameterSet>::iterator i = theVPSet_->begin(), e = theVPSet_->end(); i != e; ++i) {
110  if (!i->isRegistered()) {
111  i->registerIt();
112  }
113  theIDs_->at(i - theVPSet_->begin()) = i->id();
114  }
115  }
value_ptr< std::vector< ParameterSetID > > theIDs_
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_
void fillVPSet() const
reconstitutes the VPSet from the registry

◆ size()

std::vector< ParameterSet >::size_type edm::VParameterSetEntry::size ( void  ) const

◆ toDigest()

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

Definition at line 44 of file VParameterSetEntry.cc.

References cms::Digest::append(), cms::cuda::assert(), MillePedeFileConverter_cfg::e, mps_fire::i, theIDs_, and tracked_.

44  {
45  assert(theIDs_);
46  digest.append(tracked_ ? "+q{" : "-q{", 3);
47  bool started = false;
48  for (std::vector<ParameterSetID>::const_iterator i = theIDs_->begin(), e = theIDs_->end(); i != e; ++i) {
49  if (started)
50  digest.append(",", 1);
51  i->toDigest(digest);
52  started = true;
53  }
54  digest.append("}", 1);
55  }
assert(be >=bs)
value_ptr< std::vector< ParameterSetID > > theIDs_
void append(std::string const &s)
Definition: Digest.cc:161

◆ toString() [1/2]

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

◆ toString() [2/2]

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

Definition at line 30 of file VParameterSetEntry.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, mps_fire::i, mps_fire::result, command_line::start, AlCaHLTBitMon_QueryRunRegistry::string, theIDs_, and tracked_.

30  {
31  assert(theIDs_);
32  result += tracked_ ? "+q" : "-q";
33  result += '{';
35  std::string const between(",");
36  for (std::vector<ParameterSetID>::const_iterator i = theIDs_->begin(), e = theIDs_->end(); i != e; ++i) {
37  result += start;
38  i->toString(result);
39  start = between;
40  }
41  result += '}';
42  }
Definition: start.py:1
assert(be >=bs)
value_ptr< std::vector< ParameterSetID > > theIDs_

◆ vpset()

std::vector< ParameterSet > const & edm::VParameterSetEntry::vpset ( ) const

returns the VPSet

Definition at line 63 of file VParameterSetEntry.cc.

References fillVPSet(), and theVPSet_.

Referenced by dump(), edm::ParameterSet::getParameterSetVector(), edm::ParameterSet::getUntrackedParameterSetVector(), prettyPrint(), and size().

63  {
64  fillVPSet();
65  return *theVPSet_;
66  }
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_
void fillVPSet() const
reconstitutes the VPSet from the registry

◆ vpsetForUpdate()

std::vector< ParameterSet > & edm::VParameterSetEntry::vpsetForUpdate ( )

Definition at line 72 of file VParameterSetEntry.cc.

References fillVPSet(), and theVPSet_.

72  {
73  fillVPSet();
74  return *theVPSet_;
75  }
atomic_value_ptr< std::vector< ParameterSet > > theVPSet_
void fillVPSet() const
reconstitutes the VPSet from the registry

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
VParameterSetEntry const &  vpsetEntry 
)
friend

Definition at line 135 of file VParameterSetEntry.cc.

135  {
136  os << vpsetEntry.dump();
137  return os;
138  }

Member Data Documentation

◆ theIDs_

value_ptr<std::vector<ParameterSetID> > edm::VParameterSetEntry::theIDs_
private

◆ theVPSet_

atomic_value_ptr<std::vector<ParameterSet> > edm::VParameterSetEntry::theVPSet_
mutableprivate

◆ tracked_

bool edm::VParameterSetEntry::tracked_
private

Definition at line 58 of file VParameterSetEntry.h.

Referenced by isTracked(), toDigest(), and toString().