|
| 1 | +#include "DummyClient.h" |
| 2 | +#include "SonicCMS/Core/interface/SonicEDProducer.h" |
| 3 | +#include "DataFormats/TestObjects/interface/ToyProducts.h" |
| 4 | +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" |
| 5 | +#include "FWCore/Framework/interface/MakerMacros.h" |
| 6 | + |
| 7 | +#include <memory> |
| 8 | + |
| 9 | +namespace edmtest { |
| 10 | + template <typename Client> |
| 11 | + class SonicDummyProducer : public SonicEDProducer<Client> { |
| 12 | + public: |
| 13 | + //needed because base class has dependent scope |
| 14 | + using typename SonicEDProducer<Client>::Input; |
| 15 | + using typename SonicEDProducer<Client>::Output; |
| 16 | + explicit SonicDummyProducer(edm::ParameterSet const& cfg) : |
| 17 | + SonicEDProducer<Client>(cfg), |
| 18 | + input_(cfg.getParameter<int>("input")) |
| 19 | + { |
| 20 | + this->template produces<IntProduct>(); |
| 21 | + } |
| 22 | + |
| 23 | + void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { |
| 24 | + iInput = input_; |
| 25 | + } |
| 26 | + |
| 27 | + void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { |
| 28 | + iEvent.put(std::make_unique<IntProduct>(iOutput)); |
| 29 | + } |
| 30 | + |
| 31 | + //to ensure distinct cfi names - specialized below |
| 32 | + static std::string getCfiName(); |
| 33 | + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { |
| 34 | + edm::ParameterSetDescription desc; |
| 35 | + Client::fillPSetDescription(desc); |
| 36 | + desc.add<int>("input"); |
| 37 | + descriptions.add(getCfiName(),desc); |
| 38 | + } |
| 39 | + |
| 40 | + private: |
| 41 | + //members |
| 42 | + int input_; |
| 43 | + }; |
| 44 | + |
| 45 | + typedef SonicDummyProducer<DummyClientSync> SonicDummyProducerSync; |
| 46 | + typedef SonicDummyProducer<DummyClientPseudoAsync> SonicDummyProducerPseudoAsync; |
| 47 | + |
| 48 | + template<> std::string SonicDummyProducerSync::getCfiName() { return "SonicDummyProducerSync"; } |
| 49 | + template<> std::string SonicDummyProducerPseudoAsync::getCfiName() { return "SonicDummyProducerPseudoAsync"; } |
| 50 | +} |
| 51 | + |
| 52 | +using edmtest::SonicDummyProducerSync; |
| 53 | +DEFINE_FWK_MODULE(SonicDummyProducerSync); |
| 54 | +using edmtest::SonicDummyProducerPseudoAsync; |
| 55 | +DEFINE_FWK_MODULE(SonicDummyProducerPseudoAsync); |
| 56 | + |
0 commit comments