LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
SourceTraits.h
Go to the documentation of this file.
1
#ifndef art_Framework_IO_Sources_SourceTraits_h
2
#define art_Framework_IO_Sources_SourceTraits_h
3
// SourceTraits
5
//
6
// Attributes controlling the behavior of Source with respect to a
7
// particular detail class.
8
//
9
// Specialize as required.
10
//
11
// Generally speaking, type traits are simple struct or class templates
12
// whose purpose is to signal (at compile time) one or more properties
13
// of another type, specified as the (usually only) template
14
// argument. The property to be signalled may be a compile-time
15
// expression in the template, set explicitly, or (more rarely) left
16
// unspecified. One is expected to specialize the trait for your own
17
// types in order to convey the intended information about them.
19
// Available traits.
20
//
21
// Specialize the following traits for your source detail class if you
22
// wish to tune the behavior of your InputSource:
23
//
24
// 1. Source_generator.
25
//
26
// If art::Source_generator<MyClass>::value is true, it indicates that
27
// your source detail class MyClass does not read files or otherwise use
28
// the input string provided to it in its readFile(...)
29
// function. Defaults to false; specialize to true for your detail class
30
// XXXX as below:
31
//
32
// namespace art {
33
// template<>
34
// struct Source_generator<XXXX> {
35
// static constexpr bool value = true;
36
// };
37
// }
38
//
39
// 2. Source_wantFileServices.
40
//
41
// If art::Source_wantFileServices<MyClass>::value is false you are
42
// representing that your source detail class MyClass will be working
43
// from the list of filenames provided by the FHiCL parameter
44
// source.fileNames, but does not want them treated as real files by the
45
// standard service interfaces (CatalogInterface and FileTransfer). Use
46
// this if source.fileNames is a list of URLS for streaming data, for
47
// instance. Absent specialization,
48
// art::Source_wantFileServices<MyClass>::value is defined as the
49
// logical negation of art::Source_generator<MyClass>::value (see
50
// above); specialize as you wish.
51
//
53
namespace
art
{
54
// We are a generator, not a reader (or, we read our data from
55
// somewhere other than files specified by source.fileNames).
56
template
<
typename
DETAIL>
57
struct
Source_generator
{
58
static
constexpr
bool
value
=
false
;
59
};
60
61
// Use the standard service interfaces (CatalogInterface and
62
// FileTransfer) to obtain files.
63
template
<
typename
DETAIL>
64
struct
Source_wantFileServices
{
65
// If you're a generator, you almost certainly don't want to use the
66
// standard file services.
67
static
constexpr
bool
value
= !
Source_generator<DETAIL>::value
;
68
};
69
70
}
// namespace art
71
72
#endif
/* art_Framework_IO_Sources_SourceTraits_h */
73
74
// Local Variables:
75
// mode: c++
76
// End:
art::Source_generator::value
static constexpr bool value
Definition:
SourceTraits.h:58
art::Source_generator
Definition:
SourceTraits.h:57
art::Source_wantFileServices
Definition:
SourceTraits.h:64
art
Definition:
MVAAlg.h:12
art
Framework
IO
Sources
SourceTraits.h
Generated on Thu May 2 2024 20:59:29 for LArSoft by
1.8.11