CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

edm::ESConsumesCollector::ESConsumesCollector ( )
delete
edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesCollector const &  )
delete
edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesCollector &&  )
default
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

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

Definition at line 205 of file ESConsumesCollector.h.

References eostools::move().

205  {
206  return ESConsumesCollectorWithTagAdaptor(this, std::move(tag));
207  }
def move
Definition: eostools.py:511
template<typename Product , typename Record >
auto edm::ESConsumesCollector::consumesFrom ( ESInputTag const &  tag)
inline

Definition at line 74 of file ESConsumesCollector.h.

References edm::ESInputTag::data(), m_consumer, m_transitionID, and edm::ESInputTag::module().

Referenced by CaloGeometryBuilder::CaloGeometryBuilder(), SiStripGainESProducer::GainGetterT< Record >::GainGetterT(), calogeometryDBEPimpl::AdditionalTokens< CaloTowerGeometry >::makeTokens(), calogeometryDBEPimpl::AdditionalTokens< HcalGeometry >::makeTokens(), calogeometryDBEPimpl::AdditionalTokens< HGCalGeometry >::makeTokens(), SiStripGainSimESProducer::TokenLabel::TokenLabel(), and SiStripDelayESProducer::TokenSign::TokenSign().

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
template<typename Product , typename Record >
auto edm::ESConsumesCollector::consumesFrom ( )
inline

Definition at line 87 of file ESConsumesCollector.h.

References consumes(), 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
ESConsumesCollector& edm::ESConsumesCollector::operator= ( ESConsumesCollector const &  )
delete
ESConsumesCollector& edm::ESConsumesCollector::operator= ( ESConsumesCollector &&  )
default
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  }
def move
Definition: eostools.py:511
edm::propagate_const< ESConsumesInfo * > m_consumer
ESConsumesCollectorAdaptor consumes()

Member Data Documentation

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

Definition at line 124 of file ESConsumesCollector.h.

Referenced by consumesFrom(), and registerMayConsume().