CMS 3D CMS Logo

ESProxyFactoryProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Framework
4 // Class : ESProxyFactoryProducer
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Author: Chris Jones
10 // Created: Thu Apr 7 21:36:15 CDT 2005
11 //
12 
13 // system include files
14 #include <algorithm>
15 #include <cassert>
16 
17 // user include files
20 
22 
24 
25 using namespace edm::eventsetup;
26 namespace edm {
27 
28  using Record2Factories = std::multimap<EventSetupRecordKey, FactoryInfo>;
29 
31 
33 
35  unsigned int iovIndex) {
36  KeyedProxiesVector keyedProxiesVector;
37  using Iterator = Record2Factories::iterator;
38  std::pair<Iterator, Iterator> range = record2Factories_.equal_range(iRecord);
39  for (Iterator it = range.first; it != range.second; ++it) {
40  std::shared_ptr<DataProxy> proxy(it->second.factory_->makeProxy(iovIndex).release());
41  if (nullptr != proxy.get()) {
42  keyedProxiesVector.emplace_back((*it).second.key_, proxy);
43  }
44  }
45  return keyedProxiesVector;
46  }
47 
49  std::unique_ptr<ProxyFactoryBase> iFactory,
50  const std::string& iLabel) {
51  if (nullptr == iFactory.get()) {
52  assert(false && "Factor pointer was null");
53  ::exit(1);
54  }
55 
56  usingRecordWithKey(iRecord);
57 
58  std::shared_ptr<ProxyFactoryBase> temp(iFactory.release());
59  FactoryInfo info(temp->makeKey(iLabel), temp);
60 
61  //has this already been registered?
62  std::pair<Record2Factories::const_iterator, Record2Factories::const_iterator> range =
63  record2Factories_.equal_range(iRecord);
64  if (range.second !=
65  std::find_if(range.first, range.second, [&info](const auto& r2f) { return r2f.second.key_ == info.key_; })) {
66  throw cms::Exception("IdenticalProducts")
67  << "Producer has been asked to produce " << info.key_.type().name() << " \"" << info.key_.name().value()
68  << "\" multiple times.\n Please modify the code.";
69  }
70 
72  }
73 
74 } // namespace edm
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
funct::false
false
Definition: Factorize.h:29
ESProxyFactoryProducer.h
edm
HLT enums.
Definition: AlignableModifier.h:19
cms::cuda::assert
assert(be >=bs)
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
ProxyFactoryBase.h
Iterator
Definition: DQMStoreStats.h:94
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DataProxy.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::ESProxyFactoryProducer::record2Factories_
std::multimap< EventSetupRecordKey, eventsetup::FactoryInfo > record2Factories_
Definition: ESProxyFactoryProducer.h:108
edm::ESProxyFactoryProducer::ESProxyFactoryProducer
ESProxyFactoryProducer()
Definition: ESProxyFactoryProducer.cc:30
edm::ESProxyFactoryProducer::registerFactoryWithKey
virtual void registerFactoryWithKey(const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
Definition: ESProxyFactoryProducer.cc:48
edm::ESProxyFactoryProducer::registerProxies
KeyedProxiesVector registerProxies(const EventSetupRecordKey &, unsigned int iovIndex) override
Definition: ESProxyFactoryProducer.cc:34
edm::eventsetup::DataProxyProvider::KeyedProxiesVector
std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >> KeyedProxiesVector
Definition: DataProxyProvider.h:196
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::eventsetup::DataProxyProvider::usingRecordWithKey
void usingRecordWithKey(const EventSetupRecordKey &key)
Definition: DataProxyProvider.h:194
edm::ESProxyFactoryProducer::~ESProxyFactoryProducer
~ESProxyFactoryProducer() noexcept(false) override
Definition: ESProxyFactoryProducer.cc:32
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
Exception.h
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52
edm::Record2Factories
std::multimap< EventSetupRecordKey, FactoryInfo > Record2Factories
Definition: ESProxyFactoryProducer.cc:28
edm::eventsetup
Definition: ES_DDDetector.cc:16
edm::eventsetup::FactoryInfo
Definition: ESProxyFactoryProducer.h:68