rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
parametric_operation.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/operation/basic_operation.hpp>
6#include <rexlib/core/operation/rule_signature.hpp>
7
8#include <rexlib/core/platform/dynamic_shared_object.h>
9
10#include <type_traits>
11#include <utility>
12
13namespace rexlib
14{
15
40template <typename Derived, typename Traits>
42 : public basic_operation<Derived, Traits>
43{
44public:
45 using typename basic_operation<Derived, Traits>::shape_rule_type;
46 using typename basic_operation<Derived, Traits>::type_rule_type;
47 using parameters_type = typename Traits::parameters_type;
49 shape_rule_type,
50 type_rule_type,
51 parameters_type
52 >;
53
54 static_assert(
55 shape_rule_type::requires_parameters ||
56 type_rule_type::requires_parameters,
57 "The rules of a parametric operation read nothing from its "
58 "parameters. Declare it as a trivial operation instead."
59 );
60
75 template <
76 typename... Args,
77 typename = typename std::enable_if<
78 std::is_constructible<parameters_type, Args...>::value
79 >::type
80 >
82
92 const parameters_type& get_parameters() const noexcept;
93
95
97 signature_type m_signature;
98};
99
100} // namespace rexlib
101
102#include "parametric_operation.inl"
Container for multidimensional numeric data.
Definition array.hpp:31
CRTP base supplying the static description of an operation.
Definition basic_operation.hpp:49
Interface deciding the shape and data type of the operands of an operation.
Definition operation_signature.hpp:31
CRTP base for operations whose signature depends on parameters.
Definition parametric_operation.hpp:43
const parameters_type & get_parameters() const noexcept
Get the parameters of the operation.
parametric_operation(Args &&... args)
Construct the operation by constructing its parameters.
const operation_signature & get_signature() const noexcept override
Get the signature deciding the shape and data type of the operands of this operation.
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10