Toggle navigation
MoMEMta
include
momemta
ModuleDefBuilder.h
1
/*
2
* MoMEMta: a modular implementation of the Matrix Element Method
3
* Copyright (C) 2016 Universite catholique de Louvain (UCL), Belgium
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#pragma once
20
21
#include <memory>
22
#include <string>
23
#include <vector>
24
25
#include <momemta/ModuleDef.h>
26
27
// Forward declaration
28
class
Module
;
29
class
ParameterSet
;
30
class
Pool
;
31
32
namespace
momemta
{
33
37
struct
ModuleRegistrationData
{
38
ModuleRegistrationData
() {}
39
ModuleRegistrationData
(
const
ModuleDef
& def):
module_def
(def) { }
40
42
ModuleDef
module_def
;
43
};
44
45
namespace
registration {
46
47
// Builder class passed to the REGISTER_MODULE macro
48
class
ModuleDefBuilder
{
49
public
:
50
explicit
ModuleDefBuilder
(
const
std::string& name);
51
52
template
<
typename
ModuleType>
53
ModuleDefBuilder
& Type() {
54
// Currently not used
55
return
*
this
;
56
}
57
72
ModuleDefBuilder
& Attr(
const
std::string& spec);
73
79
ModuleDefBuilder
& GlobalAttr(
const
std::string& spec);
80
86
ModuleDefBuilder
& OptionalAttr(
const
std::string& spec);
87
99
/* TODO: Add support for type when defining inputs, in the same way as attributes
100
TODO: we can then ensure that inputs are connected to compatible outputs */
101
ModuleDefBuilder
& Input(
const
std::string& spec);
102
108
ModuleDefBuilder
& OptionalInput(
const
std::string& spec);
109
115
ModuleDefBuilder
& Inputs(
const
std::string& spec);
116
122
ModuleDefBuilder
& OptionalInputs(
const
std::string& spec);
123
124
ModuleDefBuilder
& Output(
const
std::string& spec);
125
131
ModuleDefBuilder
& Sticky();
132
133
ModuleRegistrationData
Build()
const
;
134
135
std::string name()
const
;
136
137
private
:
138
mutable
ModuleRegistrationData
reg_data;
139
140
std::vector<std::string> attrs;
141
std::vector<std::string> inputs;
142
std::vector<std::string> outputs;
143
};
144
145
}
146
147
}
momemta
Definition:
Graph.h:21
Module
Parent class for all the modules.
Definition:
Module.h:37
ParameterSet
A class encapsulating a lua table.
Definition:
ParameterSet.h:82
Pool
Definition:
Pool.h:40
momemta::registration::ModuleDefBuilder
Definition:
ModuleDefBuilder.h:48
momemta::ModuleRegistrationData
Definition:
ModuleDefBuilder.h:37
momemta::ModuleDef
Definition:
ModuleDef.h:61
momemta::ModuleRegistrationData::module_def
ModuleDef module_def
Definition of the module (inputs, outputs, attributes, ...)
Definition:
ModuleDefBuilder.h:42
Generated by
1.8.13