Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
srcs
larcore
larcore
CoreUtils
EnsureOnlyOneSchedule.h
Go to the documentation of this file.
1
#ifndef larcore_CoreUtils_EnsureOnlyOneSchedule_h
2
#define larcore_CoreUtils_EnsureOnlyOneSchedule_h
3
4
#include "art/Utilities/Globals.h"
5
#include "canvas/Utilities/Exception.h"
6
#include "cetlib_except/demangle.h"
7
8
/**
9
* @file EnsureOnlyOneSchedule.h
10
* @brief Type whose constructor throws if more than one art schedule is configured
11
*
12
* This class is intended to be used in the context of an art job. It
13
* is helpful for services that have the notion of a "current event,"
14
* but are thread-safe within that event. The constructor of this
15
* class will throw an exception if more than one art schedule is
16
* configured. It should be used via private inheritance:
17
*
18
* class MyService : lar::EnsureOnlyOneSchedule<MyService> {
19
* ..
20
* };
21
*
22
*/
23
24
namespace
lar {
25
template
<
typename
T>
26
class
EnsureOnlyOneSchedule
{
27
public
:
28
EnsureOnlyOneSchedule
()
29
{
30
if
(
auto
const
nschedules =
art::Globals::instance
()->nschedules(); nschedules > 1) {
31
throw
art::Exception{art::errors::Configuration}
32
<<
"This job uses "
<< nschedules <<
" schedules, but the type '"
<< cet::demangle_symbol(
typeid
(T).
name
()) <<
" supports\n"
33
<<
"processing only one event at a time. Please reconfigure your job to use only one schedule.\n"
;
34
}
35
}
36
};
37
}
38
39
#endif
/* larcore_CoreUtils_EnsureOnlyOneSchedule_h */
40
41
// Local Variables:
42
// mode: c++
43
// End:
lar::EnsureOnlyOneSchedule::EnsureOnlyOneSchedule
EnsureOnlyOneSchedule()
Definition:
EnsureOnlyOneSchedule.h:28
instance
const std::string instance
Definition:
BlipMaker_module.cc:35
name
then echo fcl name
Definition:
sbndpoms_genfclwithrunnumber_maker.sh:220
lar::EnsureOnlyOneSchedule
Definition:
EnsureOnlyOneSchedule.h:26
Generated by
1.8.5