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 ()
 
template<typename Product , typename Record >
auto consumesFrom (ESInputTag const &tag)
 
 ESConsumesCollector ()=delete
 
 ESConsumesCollector (ESConsumesCollector &&)=default
 
 ESConsumesCollector (ESConsumesCollector const &)=delete
 
ESConsumesCollectoroperator= (ESConsumesCollector &&)=default
 
ESConsumesCollectoroperator= (ESConsumesCollector const &)=delete
 

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 61 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 98 of file ESConsumesCollector.h.

99  : m_consumer{iConsumer}, m_transitionID{iTransitionID} {}

Member Function Documentation

◆ consumes() [1/2]

ESConsumesCollectorAdaptor edm::ESConsumesCollector::consumes ( )
inline

Definition at line 200 of file ESConsumesCollector.h.

200 { return ESConsumesCollectorAdaptor(this); }

Referenced by registerMayConsume().

◆ consumes() [2/2]

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

Definition at line 201 of file ESConsumesCollector.h.

201  {
202  return ESConsumesCollectorWithTagAdaptor(this, std::move(tag));
203  }

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

◆ consumesFrom() [1/2]

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

Definition at line 84 of file ESConsumesCollector.h.

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

References m_consumer, and m_transitionID.

◆ consumesFrom() [2/2]

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

Definition at line 71 of file ESConsumesCollector.h.

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

References m_consumer, m_transitionID, and GlobalPosition_Frontier_DevDB_cff::tag.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ 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 102 of file ESConsumesCollector.h.

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

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

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 121 of file ESConsumesCollector.h.

Referenced by consumesFrom(), and registerMayConsume().

edm::eventsetup::DataKey
Definition: DataKey.h:29
edm::ESConsumesCollector::m_transitionID
unsigned int m_transitionID
Definition: ESConsumesCollector.h:121
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::ESConsumesCollector::m_consumer
edm::propagate_const< ESConsumesInfo * > m_consumer
Definition: ESConsumesCollector.h:120
ESTokenIndex
edm::ESConsumesCollector::consumes
ESConsumesCollectorAdaptor consumes()
Definition: ESConsumesCollector.h:200
ESGetToken
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::eventsetup
Definition: ES_DDDetector.cc:16