ProducingModuleAdaptorBase

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
// -*- C++ -*-
//
// Package:     FWCore/Framework
// Class  :     edm::stream::EDProducerAdaptorBase
//
// Implementation:
//     [Notes on implementation]
//
// Original Author:  Chris Jones
//         Created:  Fri, 02 Aug 2013 21:43:44 GMT
//

// system include files

// user include files
#include "FWCore/Framework/interface/stream/EDProducerAdaptorBase.h"
#include "FWCore/Framework/interface/stream/EDProducerBase.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/Framework/interface/EventPrincipal.h"
#include "FWCore/Framework/interface/LuminosityBlockPrincipal.h"
#include "FWCore/Framework/interface/RunPrincipal.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/src/EventAcquireSignalsSentry.h"
#include "FWCore/Framework/src/EventSignalsSentry.h"
#include "FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc"
#include "FWCore/Framework/interface/TransitionInfoTypes.h"
#include "FWCore/ServiceRegistry/interface/ESParentContext.h"

using namespace edm::stream;
namespace edm {
  namespace stream {

    template <>
    ProductResolverIndex ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::transformPrefetch_(
        size_t iTransformIndex) const noexcept {
      return m_streamModules[0]->transformPrefetch_(iTransformIndex);
    }
    template <>
    size_t ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::transformIndex_(
        edm::ProductDescription const& iBranch) const noexcept {
      return m_streamModules[0]->transformIndex_(iBranch);
    }
    template <>
    void ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::doTransformAsync(
        WaitingTaskHolder iTask,
        size_t iTransformIndex,
        EventPrincipal const& iEvent,
        ActivityRegistry* iAct,
        ModuleCallingContext iMCC,
        ServiceWeakToken const& iToken) noexcept {
      EventForTransformer ev(iEvent, iMCC);
      m_streamModules[iEvent.streamID()]->transformAsync_(iTask, iTransformIndex, ev, iAct, iToken);
    }

    //
    // constants, enums and typedefs
    //

    //
    // static data member definitions
    //

    //
    // constructors and destructor
    //
    EDProducerAdaptorBase::EDProducerAdaptorBase() {}

    bool EDProducerAdaptorBase::doEvent(EventTransitionInfo const& info,
                                        ActivityRegistry* act,
                                        ModuleCallingContext const* mcc) {
      EventPrincipal const& ep = info.principal();
      assert(ep.streamID() < m_streamModules.size());
      auto mod = m_streamModules[ep.streamID()];
      EventSignalsSentry sentry(act, mcc);
      Event e(ep, moduleDescription(), mcc);
      e.setConsumer(mod);
      e.setProducer(mod, &mod->previousParentage_, &mod->gotBranchIDsFromAcquire_);
      ESParentContext parentC(mcc);
      const EventSetup c{
          info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
      mod->produce(e, c);
      commit(e, &mod->previousParentageId_);
      return true;
    }

    void EDProducerAdaptorBase::doAcquire(EventTransitionInfo const& info,
                                          ActivityRegistry* act,
                                          ModuleCallingContext const* mcc,
                                          WaitingTaskHolder&& holder) {
      EventPrincipal const& ep = info.principal();
      assert(ep.streamID() < m_streamModules.size());
      auto mod = m_streamModules[ep.streamID()];
      EventAcquireSignalsSentry sentry(act, mcc);
      Event e(ep, moduleDescription(), mcc);
      e.setConsumer(mod);
      e.setProducerForAcquire(mod, nullptr, mod->gotBranchIDsFromAcquire_);
      ESParentContext parentC(mcc);
      const EventSetup c{
          info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
      mod->doAcquire_(e, c, std::move(holder));
    }

    template class edm::stream::ProducingModuleAdaptorBase<edm::stream::EDProducerBase>;
  }  // namespace stream
}  // namespace edm