CMS 3D CMS Logo

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

#include "FWCore/Framework/interface/ESConsumesCollector.h"

Inheritance diagram for edm::ESConsumesCollector:
edm::ESConsumesCollectorT< RECORD >

Public Member Functions

ESConsumesCollectorAdaptor consumes ()
 
ESConsumesCollectorWithTagAdaptor consumes (ESInputTag tag)
 
template<typename Product , typename Record >
auto consumesFrom (ESInputTag const &tag)
 
template<typename Product , typename Record >
auto consumesFrom ()
 
 ESConsumesCollector ()=delete
 
 ESConsumesCollector (ESConsumesCollector const &)=delete
 
 ESConsumesCollector (ESConsumesCollector &&)=default
 
ESConsumesCollectoroperator= (ESConsumesCollector const &)=delete
 
ESConsumesCollectoroperator= (ESConsumesCollector &&)=default
 

Protected Member Functions

 ESConsumesCollector (ESConsumesInfo *const iConsumer, unsigned int iTransitionID)
 
template<typename Product , typename Record , typename Collector , typename PTag >
auto registerMayConsume (std::unique_ptr< Collector > iCollector, PTag const &productTag)
 

Private Attributes

edm::propagate_const< ESConsumesInfo * > m_consumer {nullptr}
 
unsigned int m_transitionID {0}
 

Detailed Description

Description: Helper class to gather consumes information for the EventSetup.

Usage: The constructor of an ESProducer module can get an instance of edm::ESConsumesCollector by calling consumesCollector() method. This instance can then be passed to helper classes in order to register the event-setup data the helper will request from an Event, LuminosityBlock or Run on behalf of the module.

Caveat: The ESConsumesCollector should be used during the time that modules are being constructed. It should not be saved and used later. It will not work if it is used to call the consumes function during beginJob, beginRun, beginLuminosity block, event processing or at any later time. As of now, an ESConsumesCollector is provided for only ESProducer subclasses–i.e. those that call setWhatProduced(this, ...).

Definition at line 64 of file ESConsumesCollector.h.

Constructor & Destructor Documentation

◆ ESConsumesCollector() [1/4]

edm::ESConsumesCollector::ESConsumesCollector ( )
delete

◆ ESConsumesCollector() [2/4]

edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesCollector const &  )
delete

◆ ESConsumesCollector() [3/4]

edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesCollector &&  )
default

◆ ESConsumesCollector() [4/4]

edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesInfo *const  iConsumer,
unsigned int  iTransitionID 
)
inlineexplicitprotected

Definition at line 101 of file ESConsumesCollector.h.

102  : m_consumer{iConsumer}, m_transitionID{iTransitionID} {}
edm::propagate_const< ESConsumesInfo * > m_consumer

Member Function Documentation

◆ consumes() [1/2]

ESConsumesCollectorAdaptor edm::ESConsumesCollector::consumes ( )
inline

Definition at line 205 of file ESConsumesCollector.h.

Referenced by registerMayConsume().

205 { return ESConsumesCollectorAdaptor(this); }

◆ consumes() [2/2]

ESConsumesCollectorWithTagAdaptor edm::ESConsumesCollector::consumes ( ESInputTag  tag)
inline

Definition at line 206 of file ESConsumesCollector.h.

References eostools::move(), and makeGlobalPositionRcd_cfg::tag.

206  {
207  return ESConsumesCollectorWithTagAdaptor(this, std::move(tag));
208  }
def move(src, dest)
Definition: eostools.py:511

◆ consumesFrom() [1/2]

template<typename Product , typename Record >
auto edm::ESConsumesCollector::consumesFrom ( ESInputTag const &  tag)
inline

Definition at line 74 of file ESConsumesCollector.h.

References m_consumer, m_transitionID, and makeGlobalPositionRcd_cfg::tag.

74  {
75  using namespace edm::eventsetup;
76  ESTokenIndex index{static_cast<ESTokenIndex::Value_t>(m_consumer->size())};
77  m_consumer->emplace_back(EventSetupRecordKey::makeKey<Record>(),
78  DataKey(DataKey::makeTypeTag<Product>(), tag.data().c_str()),
79  tag.module(),
80  nullptr);
81  //even though m_consumer may expand, the address for
82  // name().value() remains the same since it is 'moved'.
83  return ESGetToken<Product, Record>{m_transitionID, index, m_consumer->back().productKey_.name().value()};
84  }
edm::propagate_const< ESConsumesInfo * > m_consumer

◆ consumesFrom() [2/2]

template<typename Product , typename Record >
auto edm::ESConsumesCollector::consumesFrom ( )
inline

Definition at line 87 of file ESConsumesCollector.h.

References m_consumer, and m_transitionID.

87  {
88  using namespace edm::eventsetup;
89  ESTokenIndex index{static_cast<ESTokenIndex::Value_t>(m_consumer->size())};
90  m_consumer->emplace_back(
91  EventSetupRecordKey::makeKey<Record>(), DataKey(DataKey::makeTypeTag<Product>(), ""), "", nullptr);
92  //even though m_consumer may expand, the address for
93  // name().value() remains the same since it is 'moved'.
94  return ESGetToken<Product, Record>{m_transitionID, index, m_consumer->back().productKey_.name().value()};
95  }
edm::propagate_const< ESConsumesInfo * > m_consumer

◆ operator=() [1/2]

ESConsumesCollector& edm::ESConsumesCollector::operator= ( ESConsumesCollector const &  )
delete

◆ operator=() [2/2]

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

◆ registerMayConsume()

template<typename Product , typename Record , typename Collector , typename PTag >
auto edm::ESConsumesCollector::registerMayConsume ( std::unique_ptr< Collector >  iCollector,
PTag const &  productTag 
)
inlineprotected

Definition at line 105 of file ESConsumesCollector.h.

References consumes(), m_consumer, m_transitionID, and eostools::move().

105  {
106  //NOTE: for now, just treat like standard consumes request for the product needed to
107  // do the decision
108  iCollector->token() = consumes(productTag.inputTag());
109 
110  using namespace edm::eventsetup;
111  ESTokenIndex index{static_cast<ESTokenIndex::Value_t>(m_consumer->size())};
112  m_consumer->emplace_back(EventSetupRecordKey::makeKey<Record>(),
113  DataKey(DataKey::makeTypeTag<Product>(), "@mayConsume"),
114  "@mayConsume",
115  std::move(iCollector));
116  //even though m_consumer may expand, the address for
117  // name().value() remains the same since it is 'moved'.
118  return ESGetToken<Product, Record>{m_transitionID, index, m_consumer->back().productKey_.name().value()};
119  }
edm::propagate_const< ESConsumesInfo * > m_consumer
ESConsumesCollectorAdaptor consumes()
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ m_consumer

edm::propagate_const<ESConsumesInfo*> edm::ESConsumesCollector::m_consumer {nullptr}
private

◆ m_transitionID

unsigned int edm::ESConsumesCollector::m_transitionID {0}
private

Definition at line 124 of file ESConsumesCollector.h.

Referenced by consumesFrom(), and registerMayConsume().