rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
operation_descriptor.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/operation/operand_names.hpp>
6
7#include <rexlib/core/platform/dynamic_shared_object.h>
8#include <rexlib/core/span.hpp>
9
10#include <cstddef>
11#include <ostream>
12#include <string>
13
14namespace rexlib
15{
16
30{
31public:
46 const char *component,
47 const char *name,
50 ) noexcept;
51
54 ~operation_descriptor() = default;
55
57 operator=(const operation_descriptor &other) = default;
59 operator=(operation_descriptor &&other) noexcept = default;
60
68
76
84
92
104 std::size_t index,
105 bool output_operand
106 ) const noexcept;
107
119 std::ostream &os,
121 )
122 {
123 return os << descriptor.get_component() << '.' << descriptor.get_name();
124 }
125
126private:
127 const char *m_component;
128 const char *m_name;
129 span<const char* const> m_output_operand_names;
130 span<const char* const> m_input_operand_names;
131};
132
144REXLIB_API
147 std::size_t index,
148 bool output_operand
149);
150
162template <std::size_t OutputCount, std::size_t InputCount>
164 const char *component,
165 const char *name,
168) noexcept
169{
171 component,
172 name,
173 outputs.get(),
174 inputs.get()
175 );
176}
177
178} // namespace rexlib
Container for multidimensional numeric data.
Definition array.hpp:31
Immutable static description of an operation type.
Definition operation_descriptor.hpp:30
operation_descriptor(const char *component, const char *name, span< const char *const > output_operand_names, span< const char *const > input_operand_names) noexcept
Construct a descriptor.
const char * get_name() const noexcept
Get the name of the operation.
span< const char *const > get_input_operand_names() const noexcept
Get the names of the input operands.
span< const char *const > get_output_operand_names() const noexcept
Get the names of the output operands.
const char * get_operand_name(std::size_t index, bool output_operand) const noexcept
Get the name of one operand.
const char * get_component() const noexcept
Get the component owning the operation.
Represents a non-owning area of contiguous memory.
Definition span.hpp:99
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
std::string describe_operand(const operation_descriptor &descriptor, std::size_t index, bool output_operand)
Describe an operand for a diagnostic.
operation_descriptor make_operation_descriptor(const char *component, const char *name, const operand_names< OutputCount > &outputs, const operand_names< InputCount > &inputs) noexcept
Build a descriptor from compile time operand name lists.
Definition operation_descriptor.hpp:163
@ inputs
Bound by the input axes that name the variable.