Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:03

0001 // -*- C++ -*-
0002 //
0003 // Package:     test
0004 // Class  :     DummyServiceE0
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  David Dagenhart
0010 
0011 #include "FWCore/ServiceRegistry/test/stubs/DummyServiceE0.h"
0012 
0013 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0015 #include "FWCore/ServiceRegistry/interface/Service.h"
0016 
0017 #include <iostream>
0018 
0019 using namespace testserviceregistry;
0020 
0021 namespace {
0022   int testCounter = 0;
0023 }
0024 
0025 // ------------------------------------------------------
0026 
0027 void DummyServiceBase::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0028   edm::ParameterSetDescription desc;
0029   descriptions.addDefault(desc);
0030 }
0031 
0032 DummyServiceE0::DummyServiceE0(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
0033   std::cout << "DummyServiceE0 Constructor " << testCounter << std::endl;
0034   if (testCounter != 0)
0035     abort();
0036   ++testCounter;
0037 
0038   iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceE0::postBeginJob);
0039   iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceE0::postEndJob);
0040 }
0041 
0042 void DummyServiceE0::postBeginJob() {
0043   std::cout << "DummyServiceE0 PostBeginJob " << testCounter << std::endl;
0044   if (testCounter != 5)
0045     abort();
0046   ++testCounter;
0047 }
0048 
0049 void DummyServiceE0::postEndJob() {
0050   std::cout << "DummyServiceE0 PostEndJob " << testCounter << std::endl;
0051   if (testCounter != 14)
0052     abort();
0053   ++testCounter;
0054 }
0055 
0056 DummyServiceE0::~DummyServiceE0() {
0057   std::cout << "DummyServiceE0 Destructor " << testCounter << std::endl;
0058   if (testCounter != 19)
0059     abort();
0060   ++testCounter;
0061 }
0062 
0063 // ------------------------------------------------------
0064 
0065 DummyServiceA1::DummyServiceA1(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
0066   std::cout << "DummyServiceA1 Constructor " << testCounter << std::endl;
0067   if (testCounter != 1)
0068     abort();
0069   ++testCounter;
0070 
0071   iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceA1::postBeginJob);
0072   iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceA1::postEndJob);
0073 }
0074 
0075 void DummyServiceA1::postBeginJob() {
0076   std::cout << "DummyServiceA1 PostBeginJob " << testCounter << std::endl;
0077   if (testCounter != 6)
0078     abort();
0079   ++testCounter;
0080 }
0081 
0082 void DummyServiceA1::postEndJob() {
0083   std::cout << "DummyServiceA1 PostEndJob " << testCounter << std::endl;
0084   if (testCounter != 13)
0085     abort();
0086   ++testCounter;
0087 }
0088 
0089 DummyServiceA1::~DummyServiceA1() {
0090   std::cout << "DummyServiceA1 Destructor " << testCounter << std::endl;
0091   if (testCounter != 18)
0092     abort();
0093   ++testCounter;
0094 }
0095 
0096 // ------------------------------------------------------
0097 
0098 DummyServiceD2::DummyServiceD2(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
0099   std::cout << "DummyServiceD2 Constructor " << testCounter << std::endl;
0100   if (testCounter != 2)
0101     abort();
0102   ++testCounter;
0103 
0104   iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceD2::postBeginJob);
0105   iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceD2::postEndJob);
0106 }
0107 
0108 void DummyServiceD2::postBeginJob() {
0109   std::cout << "DummyServiceD2 PostBeginJob " << testCounter << std::endl;
0110   if (testCounter != 7)
0111     abort();
0112   ++testCounter;
0113 }
0114 
0115 void DummyServiceD2::postEndJob() {
0116   std::cout << "DummyServiceD2 PostEndJob " << testCounter << std::endl;
0117   if (testCounter != 12)
0118     abort();
0119   ++testCounter;
0120 }
0121 
0122 DummyServiceD2::~DummyServiceD2() {
0123   std::cout << "DummyServiceD2 Destructor " << testCounter << std::endl;
0124   if (testCounter != 17)
0125     abort();
0126   ++testCounter;
0127 }
0128 
0129 // ------------------------------------------------------
0130 
0131 DummyServiceB3::DummyServiceB3(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
0132   // Make this service dependent on service D2 in order to "On Demand Creation"
0133   edm::Service<DummyServiceD2>().isAvailable();
0134 
0135   std::cout << "DummyServiceB3 Constructor " << testCounter << std::endl;
0136   if (testCounter != 3)
0137     abort();
0138   ++testCounter;
0139 
0140   iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceB3::postBeginJob);
0141   iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceB3::postEndJob);
0142 }
0143 
0144 void DummyServiceB3::postBeginJob() {
0145   std::cout << "DummyServiceB3 PostBeginJob " << testCounter << std::endl;
0146   if (testCounter != 8)
0147     abort();
0148   ++testCounter;
0149 }
0150 
0151 void DummyServiceB3::postEndJob() {
0152   std::cout << "DummyServiceB3 PostEndJob " << testCounter << std::endl;
0153   if (testCounter != 11)
0154     abort();
0155   ++testCounter;
0156 }
0157 
0158 DummyServiceB3::~DummyServiceB3() {
0159   std::cout << "DummyServiceB3 Destructor " << testCounter << std::endl;
0160   if (testCounter != 16)
0161     abort();
0162   ++testCounter;
0163 }
0164 
0165 // ------------------------------------------------------
0166 
0167 DummyServiceC4::DummyServiceC4(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
0168   std::cout << "DummyServiceC4 Constructor " << testCounter << std::endl;
0169   if (testCounter != 4)
0170     abort();
0171   ++testCounter;
0172 
0173   iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceC4::postBeginJob);
0174   iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceC4::postEndJob);
0175 }
0176 
0177 void DummyServiceC4::postBeginJob() {
0178   std::cout << "DummyServiceC4 PostBeginJob " << testCounter << std::endl;
0179   if (testCounter != 9)
0180     abort();
0181   ++testCounter;
0182 }
0183 
0184 void DummyServiceC4::postEndJob() {
0185   std::cout << "DummyServiceC4 PostEndJob " << testCounter << std::endl;
0186   if (testCounter != 10)
0187     abort();
0188   ++testCounter;
0189 }
0190 
0191 DummyServiceC4::~DummyServiceC4() {
0192   std::cout << "DummyServiceC4 Destructor " << testCounter << std::endl;
0193   if (testCounter != 15)
0194     abort();
0195   ++testCounter;
0196 }