Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-15 04:21:40

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Framework
0004 // Class  :     __class__
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  __author__
0010 //         Created:  __date__
0011 //
0012 
0013 // system include files
0014 #include <fmt/format.h>
0015 
0016 // user include files
0017 #include "FWCore/Framework/interface/ESSourceProductResolverBase.h"
0018 #include "FWCore/Framework/interface/DataKey.h"
0019 #include "FWCore/ServiceRegistry/interface/ESModuleCallingContext.h"
0020 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0021 #include "FWCore/Utilities/interface/ConvertException.h"
0022 
0023 namespace edm {
0024   void exceptionContext(cms::Exception&, ESModuleCallingContext const&);
0025 }
0026 
0027 //
0028 // member functions
0029 //
0030 
0031 bool edm::eventsetup::ESSourceProductResolverBase::needToPrefetch(edm::WaitingTaskHolder iTask) noexcept {
0032   m_waitingList.add(std::move(iTask));
0033   bool expected = false;
0034   return m_prefetching.compare_exchange_strong(expected, true);
0035 }
0036 
0037 void edm::eventsetup::ESSourceProductResolverBase::doPrefetchAndSignals(
0038     edm::eventsetup::EventSetupRecordImpl const& iRecord,
0039     edm::eventsetup::DataKey const& iKey,
0040     edm::ESParentContext const& iParent) {
0041   edm::ESModuleCallingContext context(
0042       providerDescription(), reinterpret_cast<std::uintptr_t>(this), ESModuleCallingContext::State::kRunning, iParent);
0043   iRecord.activityRegistry()->preESModuleSignal_.emit(iRecord.key(), context);
0044   struct EndGuard {
0045     EndGuard(EventSetupRecordImpl const& iRecord, ESModuleCallingContext const& iContext)
0046         : record_{iRecord}, context_{iContext} {}
0047     ~EndGuard() { record_.activityRegistry()->postESModuleSignal_.emit(record_.key(), context_); }
0048     EventSetupRecordImpl const& record_;
0049     ESModuleCallingContext const& context_;
0050   } guardAR(iRecord, context);
0051   try {
0052     convertException::wrap([&] { prefetch(iKey, EventSetupRecordDetails(&iRecord)); });
0053   } catch (cms::Exception& iException) {
0054     iException.addContext(fmt::format(
0055         "Retrieving data product {} '{}' in record {}", iKey.type().name(), iKey.name().value(), iRecord.key().name()));
0056     exceptionContext(iException, context);
0057     throw;
0058   }
0059 }
0060 
0061 //
0062 // const member functions
0063 //
0064 
0065 //
0066 // static member functions
0067 //