rexlib
0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
rexlib
core
operation
operation_declaration_macros.hpp
1
// SPDX-License-Identifier: GPL-3.0-only
2
3
#pragma once
4
5
#include <rexlib/core/operation/operand_names.hpp>
6
#include <rexlib/core/operation/parametric_operation.hpp>
7
#include <rexlib/core/operation/trivial_operation.hpp>
8
#include <rexlib/core/platform/constexpr.hpp>
9
#include <rexlib/core/platform/dynamic_shared_object.h>
10
17
#define REXLIB_OPERANDS(...) \
18
::rexlib::make_operand_names(__VA_ARGS__)
19
25
#define REXLIB_DETAIL_OPERATION_TRAITS_MEMBERS( \
26
op, outputs, inputs, shape, ... \
27
) \
28
using shape_rule_type = shape; \
29
using type_rule_type = __VA_ARGS__; \
30
\
31
static const char* get_name() noexcept \
32
{ \
33
return #op; \
34
} \
35
\
36
static const auto& get_output_names() noexcept \
37
{ \
38
static REXLIB_CONST_CONSTEXPR auto names = outputs; \
39
return names; \
40
} \
41
\
42
static const auto& get_input_names() noexcept \
43
{ \
44
static REXLIB_CONST_CONSTEXPR auto names = inputs; \
45
return names; \
46
}
47
69
#define REXLIB_DECLARE_OPERATION_TRAITS( \
70
op, component_traits, outputs, inputs, shape, ... \
71
) \
72
struct op##_operation_traits \
73
: component_traits \
74
{ \
75
REXLIB_DETAIL_OPERATION_TRAITS_MEMBERS( \
76
op, outputs, inputs, shape, __VA_ARGS__ \
77
) \
78
}
79
97
#define REXLIB_DECLARE_OPERATION( \
98
op, component_traits, outputs, inputs, shape, ... \
99
) \
100
REXLIB_DECLARE_OPERATION_TRAITS( \
101
op, component_traits, outputs, inputs, shape, __VA_ARGS__ \
102
); \
103
\
104
REXLIB_BEGIN_TEMPLATE_BASE \
105
class REXLIB_API op##_operation final \
106
: public ::rexlib::trivial_operation< \
107
op##_operation, \
108
op##_operation_traits \
109
> \
110
{ \
111
}; \
112
REXLIB_END_TEMPLATE_BASE
113
128
#define REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS( \
129
op, component_traits, outputs, inputs, shape, parameters, ... \
130
) \
131
struct op##_operation_traits \
132
: component_traits \
133
{ \
134
using parameters_type = parameters; \
135
\
136
REXLIB_DETAIL_OPERATION_TRAITS_MEMBERS( \
137
op, outputs, inputs, shape, __VA_ARGS__ \
138
) \
139
}
140
166
#define REXLIB_DECLARE_PARAMETRIC_OPERATION( \
167
op, component_traits, outputs, inputs, shape, parameters, ... \
168
) \
169
REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS( \
170
op, component_traits, outputs, inputs, shape, parameters, \
171
__VA_ARGS__ \
172
); \
173
\
174
REXLIB_BEGIN_TEMPLATE_BASE \
175
class REXLIB_API op##_operation final \
176
: public ::rexlib::parametric_operation< \
177
op##_operation, \
178
op##_operation_traits \
179
> \
180
{ \
181
public: \
182
using ::rexlib::parametric_operation< \
183
op##_operation, \
184
op##_operation_traits \
185
>::parametric_operation; \
186
}; \
187
REXLIB_END_TEMPLATE_BASE
Generated by
1.9.8