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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
// -*- C++ -*-
//
// Package: test
// Class : DummyServiceE0
//
// Implementation:
// <Notes on implementation>
//
// Original Author: David Dagenhart
#include "FWCore/ServiceRegistry/test/stubs/DummyServiceE0.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include <iostream>
using namespace testserviceregistry;
namespace {
int testCounter = 0;
}
// ------------------------------------------------------
void DummyServiceBase::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
descriptions.addDefault(desc);
}
DummyServiceE0::DummyServiceE0(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
std::cout << "DummyServiceE0 Constructor " << testCounter << std::endl;
if (testCounter != 0)
abort();
++testCounter;
iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceE0::postBeginJob);
iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceE0::postEndJob);
}
void DummyServiceE0::postBeginJob() {
std::cout << "DummyServiceE0 PostBeginJob " << testCounter << std::endl;
if (testCounter != 5)
abort();
++testCounter;
}
void DummyServiceE0::postEndJob() {
std::cout << "DummyServiceE0 PostEndJob " << testCounter << std::endl;
if (testCounter != 14)
abort();
++testCounter;
}
DummyServiceE0::~DummyServiceE0() {
std::cout << "DummyServiceE0 Destructor " << testCounter << std::endl;
if (testCounter != 19)
abort();
++testCounter;
}
// ------------------------------------------------------
DummyServiceA1::DummyServiceA1(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
std::cout << "DummyServiceA1 Constructor " << testCounter << std::endl;
if (testCounter != 1)
abort();
++testCounter;
iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceA1::postBeginJob);
iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceA1::postEndJob);
}
void DummyServiceA1::postBeginJob() {
std::cout << "DummyServiceA1 PostBeginJob " << testCounter << std::endl;
if (testCounter != 6)
abort();
++testCounter;
}
void DummyServiceA1::postEndJob() {
std::cout << "DummyServiceA1 PostEndJob " << testCounter << std::endl;
if (testCounter != 13)
abort();
++testCounter;
}
DummyServiceA1::~DummyServiceA1() {
std::cout << "DummyServiceA1 Destructor " << testCounter << std::endl;
if (testCounter != 18)
abort();
++testCounter;
}
// ------------------------------------------------------
DummyServiceD2::DummyServiceD2(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
std::cout << "DummyServiceD2 Constructor " << testCounter << std::endl;
if (testCounter != 2)
abort();
++testCounter;
iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceD2::postBeginJob);
iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceD2::postEndJob);
}
void DummyServiceD2::postBeginJob() {
std::cout << "DummyServiceD2 PostBeginJob " << testCounter << std::endl;
if (testCounter != 7)
abort();
++testCounter;
}
void DummyServiceD2::postEndJob() {
std::cout << "DummyServiceD2 PostEndJob " << testCounter << std::endl;
if (testCounter != 12)
abort();
++testCounter;
}
DummyServiceD2::~DummyServiceD2() {
std::cout << "DummyServiceD2 Destructor " << testCounter << std::endl;
if (testCounter != 17)
abort();
++testCounter;
}
// ------------------------------------------------------
DummyServiceB3::DummyServiceB3(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
// Make this service dependent on service D2 in order to "On Demand Creation"
edm::Service<DummyServiceD2>().isAvailable();
std::cout << "DummyServiceB3 Constructor " << testCounter << std::endl;
if (testCounter != 3)
abort();
++testCounter;
iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceB3::postBeginJob);
iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceB3::postEndJob);
}
void DummyServiceB3::postBeginJob() {
std::cout << "DummyServiceB3 PostBeginJob " << testCounter << std::endl;
if (testCounter != 8)
abort();
++testCounter;
}
void DummyServiceB3::postEndJob() {
std::cout << "DummyServiceB3 PostEndJob " << testCounter << std::endl;
if (testCounter != 11)
abort();
++testCounter;
}
DummyServiceB3::~DummyServiceB3() {
std::cout << "DummyServiceB3 Destructor " << testCounter << std::endl;
if (testCounter != 16)
abort();
++testCounter;
}
// ------------------------------------------------------
DummyServiceC4::DummyServiceC4(edm::ParameterSet const&, edm::ActivityRegistry& iAR) {
std::cout << "DummyServiceC4 Constructor " << testCounter << std::endl;
if (testCounter != 4)
abort();
++testCounter;
iAR.watchPostBeginJob(this, &testserviceregistry::DummyServiceC4::postBeginJob);
iAR.watchPostEndJob(this, &testserviceregistry::DummyServiceC4::postEndJob);
}
void DummyServiceC4::postBeginJob() {
std::cout << "DummyServiceC4 PostBeginJob " << testCounter << std::endl;
if (testCounter != 9)
abort();
++testCounter;
}
void DummyServiceC4::postEndJob() {
std::cout << "DummyServiceC4 PostEndJob " << testCounter << std::endl;
if (testCounter != 10)
abort();
++testCounter;
}
DummyServiceC4::~DummyServiceC4() {
std::cout << "DummyServiceC4 Destructor " << testCounter << std::endl;
if (testCounter != 15)
abort();
++testCounter;
}
|