CMS 3D CMS Logo

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

#include <EventSetupImpl.h>

Public Member Functions

 EventSetupImpl (EventSetupImpl const &)=delete
 
void fillAvailableRecordKeys (std::vector< eventsetup::EventSetupRecordKey > &oToFill) const
 clears the oToFill vector and then fills it with the keys for all available records More...
 
std::optional< eventsetup::EventSetupRecordGenericfind (const eventsetup::EventSetupRecordKey &, unsigned int iTransitionID, ESProxyIndex const *getTokenIndices) const
 
eventsetup::EventSetupRecordImpl const * findImpl (const eventsetup::EventSetupRecordKey &) const
 
EventSetupImploperator= (EventSetupImpl const &)=delete
 
bool recordIsProvidedByAModule (eventsetup::EventSetupRecordKey const &) const
 
 ~EventSetupImpl ()
 

Protected Member Functions

void add (const eventsetup::EventSetupRecordImpl &iRecord)
 
void clear ()
 

Private Member Functions

ActivityRegistry const * activityRegistry () const
 
 EventSetupImpl (ActivityRegistry const *)
 
void insert (const eventsetup::EventSetupRecordKey &, const eventsetup::EventSetupRecordImpl *)
 
void setKeyIters (std::vector< eventsetup::EventSetupRecordKey >::const_iterator const &keysBegin, std::vector< eventsetup::EventSetupRecordKey >::const_iterator const &keysEnd)
 

Private Attributes

ActivityRegistry const * activityRegistry_
 
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysBegin_
 
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysEnd_
 
std::vector< eventsetup::EventSetupRecordImpl const * > recordImpls_
 

Friends

class eventsetup::EventSetupProvider
 Only EventSetupProvider allowed to create a EventSetup. More...
 
class eventsetup::EventSetupRecordImpl
 

Detailed Description

Definition at line 42 of file EventSetupImpl.h.

Constructor & Destructor Documentation

EventSetupImpl::~EventSetupImpl ( )

Definition at line 28 of file EventSetupImpl.cc.

28 {}
edm::EventSetupImpl::EventSetupImpl ( EventSetupImpl const &  )
delete
EventSetupImpl::EventSetupImpl ( ActivityRegistry const *  activityRegistry)
private

Definition at line 26 of file EventSetupImpl.cc.

ActivityRegistry const * activityRegistry() const
ActivityRegistry const * activityRegistry_

Member Function Documentation

ActivityRegistry const* edm::EventSetupImpl::activityRegistry ( ) const
inlineprivate

Definition at line 77 of file EventSetupImpl.h.

References activityRegistry_, and edm::eventsetup::heterocontainer::insert().

77 { return activityRegistry_; }
ActivityRegistry const * activityRegistry_
void EventSetupImpl::add ( const eventsetup::EventSetupRecordImpl iRecord)
protected

Definition at line 47 of file EventSetupImpl.cc.

References insert(), and edm::eventsetup::EventSetupRecordImpl::key().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

47 { insert(iRecord.key(), &iRecord); }
void insert(const eventsetup::EventSetupRecordKey &, const eventsetup::EventSetupRecordImpl *)
void EventSetupImpl::clear ( void  )
protected
void EventSetupImpl::fillAvailableRecordKeys ( std::vector< eventsetup::EventSetupRecordKey > &  oToFill) const

clears the oToFill vector and then fills it with the keys for all available records

Definition at line 72 of file EventSetupImpl.cc.

References recordImpls_.

72  {
73  oToFill.clear();
74  oToFill.reserve(recordImpls_.size());
75 
76  for (auto const& recordImpl : recordImpls_) {
77  if (recordImpl != nullptr) {
78  oToFill.push_back(recordImpl->key());
79  }
80  }
81  }
std::vector< eventsetup::EventSetupRecordImpl const * > recordImpls_
std::optional< eventsetup::EventSetupRecordGeneric > EventSetupImpl::find ( const eventsetup::EventSetupRecordKey iKey,
unsigned int  iTransitionID,
ESProxyIndex const *  getTokenIndices 
) const

Definition at line 49 of file EventSetupImpl.cc.

References SoftLeptonByDistance_cfi::distance, keysBegin_, keysEnd_, and recordImpls_.

51  {
52  auto lb = std::lower_bound(keysBegin_, keysEnd_, iKey);
53  if (lb == keysEnd_ || iKey != *lb) {
54  return std::nullopt;
55  }
56  auto index = std::distance(keysBegin_, lb);
57  if (recordImpls_[index] == nullptr) {
58  return std::nullopt;
59  }
60  return eventsetup::EventSetupRecordGeneric(recordImpls_[index], iTransitionID, getTokenIndices);
61  }
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysBegin_
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysEnd_
std::vector< eventsetup::EventSetupRecordImpl const * > recordImpls_
eventsetup::EventSetupRecordImpl const * EventSetupImpl::findImpl ( const eventsetup::EventSetupRecordKey iKey) const

Definition at line 63 of file EventSetupImpl.cc.

References SoftLeptonByDistance_cfi::distance, keysBegin_, keysEnd_, and recordImpls_.

63  {
64  auto lb = std::lower_bound(keysBegin_, keysEnd_, iKey);
65  if (lb == keysEnd_ || iKey != *lb) {
66  return nullptr;
67  }
68  auto index = std::distance(keysBegin_, lb);
69  return recordImpls_[index];
70  }
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysBegin_
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysEnd_
std::vector< eventsetup::EventSetupRecordImpl const * > recordImpls_
void EventSetupImpl::insert ( const eventsetup::EventSetupRecordKey iKey,
const eventsetup::EventSetupRecordImpl iRecord 
)
private

Definition at line 30 of file EventSetupImpl.cc.

References SoftLeptonByDistance_cfi::distance, Exception, keysBegin_, keysEnd_, and recordImpls_.

Referenced by add(), edm::eventsetup::EventSetupProvider::addRecord(), edm::eventsetup::EventSetupProvider::finishConfiguration(), and edm::eventsetup::EventSetupProvider::insert().

31  {
32  auto lb = std::lower_bound(keysBegin_, keysEnd_, iKey);
33  if (lb == keysEnd_ || iKey != *lb) {
34  throw cms::Exception("LogicError") << "EventSetupImpl::insert Could not find key\n"
35  << "Should be impossible. Please contact Framework developer.\n";
36  }
37  auto index = std::distance(keysBegin_, lb);
38  recordImpls_[index] = iRecord;
39  }
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysBegin_
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysEnd_
std::vector< eventsetup::EventSetupRecordImpl const * > recordImpls_
EventSetupImpl& edm::EventSetupImpl::operator= ( EventSetupImpl const &  )
delete
bool EventSetupImpl::recordIsProvidedByAModule ( eventsetup::EventSetupRecordKey const &  iKey) const

returns true if the Record is provided by a Source or a Producer a value of true does not mean this EventSetup object holds such a record

Definition at line 83 of file EventSetupImpl.cc.

References keysBegin_, and keysEnd_.

Referenced by edm::eventsetup::recordDoesExist().

83  {
84  auto lb = std::lower_bound(keysBegin_, keysEnd_, iKey);
85  return lb != keysEnd_ && iKey == *lb;
86  }
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysBegin_
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysEnd_
void EventSetupImpl::setKeyIters ( std::vector< eventsetup::EventSetupRecordKey >::const_iterator const &  keysBegin,
std::vector< eventsetup::EventSetupRecordKey >::const_iterator const &  keysEnd 
)
private

Definition at line 88 of file EventSetupImpl.cc.

References keysBegin_, keysEnd_, and recordImpls_.

89  {
90  keysBegin_ = keysBegin;
91  keysEnd_ = keysEnd;
92  recordImpls_.resize(keysEnd_ - keysBegin_, nullptr);
93  }
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysBegin_
std::vector< eventsetup::EventSetupRecordKey >::const_iterator keysEnd_
std::vector< eventsetup::EventSetupRecordImpl const * > recordImpls_

Friends And Related Function Documentation

friend class eventsetup::EventSetupProvider
friend

Only EventSetupProvider allowed to create a EventSetup.

Definition at line 44 of file EventSetupImpl.h.

friend class eventsetup::EventSetupRecordImpl
friend

Definition at line 67 of file EventSetupImpl.h.

Member Data Documentation

ActivityRegistry const* edm::EventSetupImpl::activityRegistry_
private

Definition at line 89 of file EventSetupImpl.h.

std::vector<eventsetup::EventSetupRecordKey>::const_iterator edm::EventSetupImpl::keysBegin_
private

Definition at line 86 of file EventSetupImpl.h.

Referenced by find(), findImpl(), insert(), recordIsProvidedByAModule(), and setKeyIters().

std::vector<eventsetup::EventSetupRecordKey>::const_iterator edm::EventSetupImpl::keysEnd_
private

Definition at line 87 of file EventSetupImpl.h.

Referenced by find(), findImpl(), insert(), recordIsProvidedByAModule(), and setKeyIters().

std::vector<eventsetup::EventSetupRecordImpl const*> edm::EventSetupImpl::recordImpls_
private

Definition at line 88 of file EventSetupImpl.h.

Referenced by clear(), fillAvailableRecordKeys(), find(), findImpl(), insert(), and setKeyIters().