Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
test
Integration
SigIntAnalyzer_module.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Class: SigIntAnalyzer
3
// Module Type: analyzer
4
// File: SigIntAnalyzer_module.cc
5
//
6
// Generated at Wed Jul 17 11:09:19 2013 by Christopher Green using artmod
7
// from cetpkgsupport v1_02_00.
8
////////////////////////////////////////////////////////////////////////
9
10
#include "
art/Framework/Core/EDAnalyzer.h
"
11
#include "
art/Framework/Core/ModuleMacros.h
"
12
#include "
art/Framework/Principal/fwd.h
"
13
#include "
canvas/Utilities/InputTag.h
"
14
#include "
fhiclcpp/ParameterSet.h
"
15
16
#include <signal.h>
17
#include <string>
18
#include <unistd.h>
19
20
namespace
art
{
21
namespace
test
{
22
class
SigIntAnalyzer;
23
}
24
}
25
26
class
art::test::SigIntAnalyzer
:
public
EDAnalyzer
{
27
public
:
28
struct
Config
{
29
fhicl::Atom<std::string>
signal
{
30
fhicl::Name
{
"signal"
},
31
fhicl::Comment
{
"Job-ending signal to be emitted. Can choose from\n"
32
"SIGUSR2, SIGTERM, SIGQUIT, or SIGINT."
}};
33
};
34
using
Parameters
=
EDAnalyzer::Table<Config>
;
35
36
explicit
SigIntAnalyzer
(
Parameters
const
&
p
);
37
38
void
analyze
(
Event
const
&)
override
;
39
40
private
:
41
int
signal_
;
42
};
43
44
art::test::SigIntAnalyzer::SigIntAnalyzer
(
Parameters
const
&
p
) :
EDAnalyzer
{p}
45
{
46
auto
const
signal =
p
().signal();
47
if
(signal ==
"SIGUSR2"
) {
48
signal_
= SIGUSR2;
49
}
else
if
(signal ==
"SIGTERM"
) {
50
signal_
= SIGTERM;
51
}
else
if
(signal ==
"SIGQUIT"
) {
52
signal_
= SIGQUIT;
53
}
else
if
(signal ==
"SIGINT"
) {
54
signal_
= SIGINT;
55
}
else
{
56
throw
art::Exception
{
art::errors::Configuration
}
57
<<
"Incorrect signal string specified. Please select from:\n"
58
<<
" SIGUSR2,\n"
59
<<
" SIGTERM,\n"
60
<<
" SIGQUIT, or\n"
61
<<
" SIGINT."
;
62
}
63
}
64
65
void
66
art::test::SigIntAnalyzer::analyze
(
Event
const
&)
67
{
68
kill(getpid(),
signal_
);
69
}
70
71
DEFINE_ART_MODULE
(
art::test::SigIntAnalyzer
)
art::test::SigIntAnalyzer
Definition:
SigIntAnalyzer_module.cc:26
test
Definition:
test.py:1
art::test::SigIntAnalyzer::analyze
void analyze(Event const &) override
Definition:
SigIntAnalyzer_module.cc:66
art::errors::Configuration
Definition:
Exception.h:32
ParameterSet.h
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:68
art::test::SigIntAnalyzer::Config::signal
fhicl::Atom< std::string > signal
Definition:
SigIntAnalyzer_module.cc:29
fhicl::Atom< std::string >
art::detail::Analyzer::Table
Definition:
Analyzer.h:32
art::test::SigIntAnalyzer::signal_
int signal_
Definition:
SigIntAnalyzer_module.cc:41
EDAnalyzer.h
ModuleMacros.h
test.p
p
Definition:
test.py:228
art::Exception
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition:
Exception.h:66
fwd.h
art::test::SigIntAnalyzer::Config
Definition:
SigIntAnalyzer_module.cc:28
art::Event
Definition:
Event.h:40
art::EDAnalyzer
Definition:
EDAnalyzer.h:22
art
Definition:
BasicOptionsHandler.h:11
InputTag.h
art::test::SigIntAnalyzer::SigIntAnalyzer
SigIntAnalyzer(Parameters const &p)
Definition:
SigIntAnalyzer_module.cc:44
fhicl::Comment
Definition:
Comment.h:33
fhicl::Name
Definition:
Name.h:11
Generated by
1.8.11