Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
test
Integration
event-processor
ThrowingProducer_module.cc
Go to the documentation of this file.
1
#include "
art/Framework/Core/EDProducer.h
"
2
#include "
art/Framework/Core/ModuleMacros.h
"
3
#include "
art/test/Integration/event-processor/ThrowAfterConfig.h
"
4
#include "
canvas/Utilities/Exception.h
"
5
#include "
fhiclcpp/types/Atom.h
"
6
7
namespace
art
{
8
namespace
test
{
9
10
class
ThrowingProducer
:
public
EDProducer
{
11
unsigned
count_
{};
12
unsigned
const
threshold_
;
13
14
public
:
15
using
Parameters
=
Table<ThrowAfterConfig>
;
16
17
ThrowingProducer
(
Parameters
const
&
p
)
18
:
EDProducer
{p}, threshold_{
p
().throwAfter()}
19
{
20
if
(
p
().throwFromCtor()) {
21
throw
Exception
{
errors::OtherArt
} <<
"Throw from c'tor.\n"
;
22
}
23
}
24
25
private
:
26
void
27
produce
(
Event
&)
override
28
{
29
++
count_
;
30
if
(
count_
>= threshold_) {
31
throw
Exception
{
errors::OtherArt
} <<
"Throw from produce.\n"
;
32
}
33
}
34
};
35
36
}
// namespace test
37
}
// namespace art
38
39
DEFINE_ART_MODULE
(
art::test::ThrowingProducer
)
test
Definition:
test.py:1
art::test::ThrowingProducer
Definition:
ThrowingProducer_module.cc:10
Exception.h
art::ProducerTable
Definition:
ProducerTable.h:19
art::test::ThrowingProducer::count_
unsigned count_
Definition:
ThrowingProducer_module.cc:11
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:68
art::errors::OtherArt
Definition:
Exception.h:24
ModuleMacros.h
art::test::ThrowingProducer::ThrowingProducer
ThrowingProducer(Parameters const &p)
Definition:
ThrowingProducer_module.cc:17
art::EDProducer
Definition:
EDProducer.h:15
EDProducer.h
test.p
p
Definition:
test.py:228
art::Exception
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition:
Exception.h:66
art::Event
Definition:
Event.h:40
art::test::ThrowingProducer::threshold_
unsigned const threshold_
Definition:
ThrowingProducer_module.cc:12
Atom.h
art
Definition:
BasicOptionsHandler.h:11
art::test::ThrowingProducer::produce
void produce(Event &) override
Definition:
ThrowingProducer_module.cc:27
ThrowAfterConfig.h
Generated by
1.8.11