rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
basic_operation.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/operation.hpp>
7#include <rexlib/core/operation/operation_descriptor.hpp>
8
9#include <rexlib/core/platform/constexpr.hpp>
10#include <rexlib/core/platform/dynamic_shared_object.h>
11
12#include <cstddef>
13
14namespace rexlib
15{
16
46template <typename Derived, typename Traits>
48 : public operation
49{
50public:
51 using traits_type = Traits;
52 using shape_rule_type = typename Traits::shape_rule_type;
53 using type_rule_type = typename Traits::type_rule_type;
54
55 static REXLIB_CONST_CONSTEXPR std::size_t output_operand_count =
56 type_rule_type::output_count;
57 static REXLIB_CONST_CONSTEXPR std::size_t input_operand_count =
58 type_rule_type::input_count;
59
60 static_assert(
61 output_operand_count == operand_names_count<
62 decltype(Traits::get_output_names())
63 >::value,
64 "The operation declares a different number of output operand names "
65 "than its typing rule has output slots."
66 );
67
68 static_assert(
69 input_operand_count == operand_names_count<
70 decltype(Traits::get_input_names())
71 >::value,
72 "The operation declares a different number of input operand names "
73 "than its typing rule has input slots."
74 );
75
82
89
100};
101
102} // namespace rexlib
103
104#include "basic_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
static const operation_descriptor & get_static_descriptor() noexcept
Get the description shared by every instance.
const operation_descriptor & get_descriptor() const noexcept override
Get the description of this operation.
operation_id get_id() const noexcept override
Get the identifier of Derived.
Immutable static description of an operation type.
Definition operation_descriptor.hpp:30
Unique identification for an operation type.
Definition operation_id.hpp:16
Abstract class that describes an operation.
Definition operation.hpp:23
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
Get the operand count of an operand name list.
Definition operand_names.hpp:71