IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
ArrayX.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/Indexer.h>
5#include <iolink/VectorX.h>
6
7namespace iolink
8{
9
29template <typename T>
30class ArrayX
31{
32public:
36 using ValueType = T;
37
47 explicit ArrayX(const VectorXu64& shape);
48
54 explicit ArrayX(const Indexer& indexer);
55
56 // The following default implementations are needed
57 // for the Python wrapping.
58
59 ArrayX(const ArrayX& other);
60 ArrayX& operator=(const ArrayX& other);
61
62 ArrayX(ArrayX&& other) noexcept;
63 ArrayX& operator=(ArrayX&& other) noexcept;
64
65 ~ArrayX();
66
70 size_t dimensionCount() const;
71
75 const VectorXu64& shape() const;
76
80 const Indexer& indexer() const;
81
90 T at(const VectorXu64& index) const;
91
101 void setAt(const VectorXu64& index, T value);
102
109
113 const T* buffer() const;
114
118 T* buffer();
119
123 std::string toString() const;
124
125 bool operator==(const ArrayX& other) const;
126
127 bool operator!=(const ArrayX& other) const;
128
129private:
130 class Private;
131 Private* m_private;
132};
133
134// ===================== //
135// Template declarations //
136// ===================== //
137
138extern template class IOLINK_API_IMPORT ArrayX<int8_t>;
139extern template class IOLINK_API_IMPORT ArrayX<int16_t>;
140extern template class IOLINK_API_IMPORT ArrayX<int32_t>;
141extern template class IOLINK_API_IMPORT ArrayX<int64_t>;
142extern template class IOLINK_API_IMPORT ArrayX<uint8_t>;
143extern template class IOLINK_API_IMPORT ArrayX<uint16_t>;
144extern template class IOLINK_API_IMPORT ArrayX<uint32_t>;
145extern template class IOLINK_API_IMPORT ArrayX<uint64_t>;
146extern template class IOLINK_API_IMPORT ArrayX<float>;
147extern template class IOLINK_API_IMPORT ArrayX<double>;
148
149//==================== //
150// Aliases declaration //
151//==================== //
152
163
164} // end namespace iolink