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
sbnana
sbnanalysis
core
Loader.hh
Go to the documentation of this file.
1
#ifndef __sbnanalysis_core_Loader__
2
#define __sbnanalysis_core_Loader__
3
4
/**
5
* \file Loader.hh
6
*
7
* Loading Processors from shared libraries.
8
*
9
* Author: A. Mastbaum <mastbaum@uchicago.edu>, 2018/02/05
10
*/
11
12
#include <string>
13
#include <vector>
14
15
namespace
fhicl {
16
class
ParameterSet;
17
}
18
19
namespace
core {
20
21
class
ProcessorBase;
22
class
PostProcessorBase;
23
24
/**
25
* \struct export_table
26
* \brief Struct containing (macro defined) creation/deletion operations
27
*/
28
struct
export_table
{
29
/** Function to create an Processor instance. */
30
ProcessorBase
* (*create)(
void
);
31
32
/** Function to delete an Processor instance. */
33
void
(*
destroy
)(
ProcessorBase
*);
34
};
35
36
/**
37
* \struct export_table_postprocess
38
* \brief Struct containing (macro defined) creation/deletion operations
39
*/
40
struct
export_table_postprocess
{
41
/** Function to create an PostProcessor instance. */
42
PostProcessorBase
* (*create)(
void
);
43
44
/** Function to delete an PostProcessor instance. */
45
void
(*
destroy
)(
PostProcessorBase
*);
46
};
47
48
/**
49
* Load a processor from a shared library.
50
*
51
* \param libpath Path to the shared library
52
* \returns A table of exported hooks for creating/deleting instances
53
*/
54
export_table
*
LoadProcessor
(
char
* libname);
55
56
/**
57
* Load a post-processor from a shared library.
58
*
59
* \param libpath Path to the shared library
60
* \returns A table of exported hooks for creating/deleting instances
61
*/
62
export_table_postprocess
*
LoadPostProcessor
(
char
* libname);
63
64
65
/**
66
* Load configuration from JSON file to object.
67
*
68
* \param config Path to the JSON file
69
* \returns Configuration as a JSON object
70
*/
71
fhicl::ParameterSet*
LoadConfig
(
char
* configfile);
72
73
74
/**
75
* \class ProcessorDef
76
* \brief Definition for a dynamically-loaded Processor
77
*/
78
struct
ProcessorDef
{
79
char
*
name
;
//!< Name of the Processor
80
struct
export_table
*
exports
;
//!< Table for ctor/dtor access
81
fhicl::ParameterSet*
config
;
//!< Configuration as an object
82
core::ProcessorBase
*
proc
;
//!< Pointer to the processor
83
};
84
85
}
// namespace core
86
87
#endif // __sbnanalysis_core_Loader__
88
core::ProcessorDef
Definition for a dynamically-loaded Processor.
Definition:
Loader.hh:78
core::export_table
Struct containing (macro defined) creation/deletion operations.
Definition:
Loader.hh:28
core::export_table::destroy
void(* destroy)(ProcessorBase *)
Definition:
Loader.hh:33
core::ProcessorDef::name
char * name
Name of the Processor.
Definition:
Loader.hh:79
core::LoadProcessor
export_table * LoadProcessor(char *libname)
Definition:
Loader.cxx:15
core::LoadPostProcessor
export_table_postprocess * LoadPostProcessor(char *libname)
Definition:
Loader.cxx:47
core::export_table_postprocess::destroy
void(* destroy)(PostProcessorBase *)
Definition:
Loader.hh:45
core::ProcessorBase
A generic tree-writing event-by-event processor.
Definition:
ProcessorBase.hh:47
core::ProcessorDef::config
fhicl::ParameterSet * config
Configuration as an object.
Definition:
Loader.hh:81
nlohmann::detail::void
j template void())
Definition:
json.hpp:3108
core::LoadConfig
fhicl::ParameterSet * LoadConfig(char *configfile)
Definition:
Loader.cxx:80
core::ProcessorDef::proc
core::ProcessorBase * proc
Pointer to the processor.
Definition:
Loader.hh:82
core::PostProcessorBase
A generic tree-reading event-by-event processor.
Definition:
PostProcessorBase.hh:43
core::export_table_postprocess
Struct containing (macro defined) creation/deletion operations.
Definition:
Loader.hh:40
core::ProcessorDef::exports
struct export_table * exports
Table for ctor/dtor access.
Definition:
Loader.hh:80
Generated by
1.8.5