rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
operand_descriptor.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/ndarray/array_descriptor.hpp>
6
7#include <rexlib/core/hardware/memory_resource.hpp>
8#include <rexlib/core/platform/dynamic_shared_object.h>
9
10namespace rexlib
11{
12
13class array;
14class const_array_ref;
15
16
29{
30public:
31 REXLIB_API
32 operand_descriptor() noexcept;
33
34 REXLIB_API
35 explicit operand_descriptor(
36 const array_descriptor &descriptor,
37 const memory_resource* resource = nullptr
38 ) noexcept;
39
40 REXLIB_API
41 explicit operand_descriptor(
42 array_descriptor &&descriptor,
43 const memory_resource* resource = nullptr
44 ) noexcept;
45
46 REXLIB_API
48 const strided_layout& layout,
49 numerical_type data_type,
50 const memory_resource* resource = nullptr
51 ) noexcept;
52
53 REXLIB_API
55 strided_layout&& layout,
56 numerical_type data_type,
57 const memory_resource* resource = nullptr
58 ) noexcept;
59
60 REXLIB_API
62 REXLIB_API
63 operand_descriptor(operand_descriptor &&other) noexcept;
64 REXLIB_API
66
67 REXLIB_API
68 operand_descriptor& operator=(const operand_descriptor &other);
69 REXLIB_API
70 operand_descriptor& operator=(operand_descriptor &&other) noexcept;
71
72 friend bool operator==(
73 const operand_descriptor &lhs,
74 const operand_descriptor &rhs
75 ) noexcept
76 {
77 return
80 }
81
82 friend bool operator!=(
83 const operand_descriptor &lhs,
84 const operand_descriptor &rhs
85 ) noexcept
86 {
87 return !(lhs == rhs);
88 }
89
95 REXLIB_API
96 std::size_t hash() const noexcept;
97
103 REXLIB_API
104 const strided_layout& get_layout() const noexcept;
105
111 REXLIB_API
113
119 REXLIB_API
120 const array_descriptor& get_array_descriptor() const noexcept;
121
127 REXLIB_API
129 const array_descriptor &descriptor
130 ) noexcept;
131
137 REXLIB_API
138 const memory_resource* get_memory_resource() const noexcept;
139
145 REXLIB_API
147 const memory_resource* resource
148 ) noexcept;
149
157 REXLIB_API
159
160private:
161 array_descriptor m_descriptor;
162 const memory_resource* m_memory_region;
163};
164
165} // namespace rexlib
Description of the memory representation of a multidimensional array.
Definition array_descriptor.hpp:22
Non-owning read-only reference to an array.
Definition const_array_ref.hpp:36
Abstract description of a physical memory region.
Definition memory_resource.hpp:21
Logical representation of an operand's properties.
Definition operand_descriptor.hpp:29
void set_array_descriptor(const array_descriptor &descriptor) noexcept
Set the array descriptor.
const strided_layout & get_layout() const noexcept
Get the in memory layout of the data.
const memory_resource * get_memory_resource() const noexcept
Get the memory resource.
std::size_t hash() const noexcept
Get the hash value for this object.
numerical_type get_data_type() const noexcept
Get the data type of the elements.
static operand_descriptor from_array(const_array_ref a) noexcept
Construct an operand descriptor from an existing array.
void set_memory_resource(const memory_resource *resource) noexcept
Set the memory resource.
const array_descriptor & get_array_descriptor() const noexcept
Get the array descriptor.
Definition strided_layout.hpp:21
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
numerical_type
Representation of all considered numerical types for computations.
Definition numerical_type.hpp:19