Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
test
Integration
TestServiceUsingService_module.cc
Go to the documentation of this file.
1
#include "
art/Framework/Core/EDAnalyzer.h
"
2
#include "
art/Framework/Core/ModuleMacros.h
"
3
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
4
#include "
art/test/Integration/ServiceUsing.h
"
5
#include "
art/test/Integration/Wanted.h
"
6
#include "
cetlib/quiet_unit_test.hpp
"
7
8
namespace
art
{
9
namespace
test
{
10
class
TestServiceUsingService;
11
}
12
}
13
14
class
art::test::TestServiceUsingService
:
public
EDAnalyzer
{
15
public
:
16
explicit
TestServiceUsingService
(
fhicl::ParameterSet
const
&);
17
~TestServiceUsingService
();
18
19
void
analyze
(
art::Event
const
&)
override
;
20
21
void
beginJob
()
override
;
22
void
endJob
()
override
;
23
24
private
:
25
int
debug_level_
;
26
};
27
28
art::test::TestServiceUsingService::TestServiceUsingService
(
29
fhicl::ParameterSet
const
&
p
)
30
:
EDAnalyzer
{p}
31
,
debug_level_
{
ServiceHandle<ServiceUsing const>
()->getCachedValue()}
32
{}
33
34
art::test::TestServiceUsingService::~TestServiceUsingService
()
35
{
36
// Test that art::ServiceHandle can be dereferenced in a module destructor
37
ServiceHandle<ServiceUsing const>
{}
38
->getCachedValue();
39
}
40
41
void
42
art::test::TestServiceUsingService::analyze
(
Event
const
&)
43
{
44
// NOP.
45
}
46
47
void
48
art::test::TestServiceUsingService::beginJob
()
49
{
50
ServiceHandle<ServiceUsing const>
sus;
51
BOOST_CHECK_EQUAL(
debug_level_
, sus->getCachedValue());
52
BOOST_CHECK_EQUAL(
ServiceHandle<Wanted const>
{}->getCachedValue(),
53
sus->getCachedValue());
54
}
55
56
void
57
art::test::TestServiceUsingService::endJob
()
58
{
59
ServiceHandle<ServiceUsing const>
sus;
60
BOOST_CHECK(sus->postBeginJobCalled());
61
62
int
const
current_value{sus->getCachedValue()};
63
BOOST_CHECK_NE(
debug_level_
, current_value);
64
BOOST_CHECK_EQUAL(
ServiceHandle<Wanted const>
{}->getCachedValue(),
65
current_value);
66
}
67
68
DEFINE_ART_MODULE
(
art::test::TestServiceUsingService
)
art::ServiceHandle
Definition:
ServiceHandle.h:37
art::test::TestServiceUsingService::endJob
void endJob() override
Definition:
TestServiceUsingService_module.cc:57
art::test::TestServiceUsingService
Definition:
TestServiceUsingService_module.cc:14
ServiceUsing.h
test
Definition:
test.py:1
art::test::TestServiceUsingService::debug_level_
int debug_level_
Definition:
TestServiceUsingService_module.cc:25
ServiceHandle.h
art::test::TestServiceUsingService::TestServiceUsingService
TestServiceUsingService(fhicl::ParameterSet const &)
Definition:
TestServiceUsingService_module.cc:28
Wanted.h
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:68
quiet_unit_test.hpp
EDAnalyzer.h
ModuleMacros.h
test.p
p
Definition:
test.py:228
art::Event
Definition:
Event.h:40
art::test::TestServiceUsingService::~TestServiceUsingService
~TestServiceUsingService()
Definition:
TestServiceUsingService_module.cc:34
art::EDAnalyzer
Definition:
EDAnalyzer.h:22
art::test::TestServiceUsingService::analyze
void analyze(art::Event const &) override
Definition:
TestServiceUsingService_module.cc:42
art
Definition:
BasicOptionsHandler.h:11
art::test::TestServiceUsingService::beginJob
void beginJob() override
Definition:
TestServiceUsingService_module.cc:48
fhicl::ParameterSet
Definition:
ParameterSet.h:34
Generated by
1.8.11