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_id.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <typeindex>
6#include <functional>
7#include <cstddef>
8
9namespace rexlib
10{
11
16{
17public:
18 explicit operation_id(std::type_index id) noexcept;
19 operation_id(const operation_id &other) = default;
20 operation_id(operation_id &&other) = default;
21 ~operation_id() = default;
22
23 operation_id& operator=(const operation_id &other) = default;
24 operation_id& operator=(operation_id &&other) = default;
25
26 friend bool
27 operator==(const operation_id &lhs, const operation_id &rhs) noexcept
28 {
29 return lhs.m_id == rhs.m_id;
30 }
31
32 friend bool
33 operator!=(const operation_id &lhs, const operation_id &rhs) noexcept
34 {
35 return !(lhs == rhs);
36 }
37
43 std::size_t hash() const noexcept;
44
47
49 std::type_index m_id;
50};
51
52} // namespace rexlib
53
54namespace std
55{
56
57template<>
59{
60 using key_type = rexlib::operation_id;
61 std::size_t operator()(const key_type &k) const noexcept;
62};
63
64} // namespace std
65
66#include "operation_id.inl"
Container for multidimensional numeric data.
Definition array.hpp:31
Unique identification for an operation type.
Definition operation_id.hpp:16
std::size_t hash() const noexcept
Compute the hash for this operation identifier.
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10