forked from activeloopai/deeplake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstd_span_array.hpp
More file actions
61 lines (47 loc) · 1.04 KB
/
Copy pathstd_span_array.hpp
File metadata and controls
61 lines (47 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include "../dtype.hpp"
#include "../exceptions.hpp"
#include <base/span_cast.hpp>
#include <icm/small_vector.hpp>
#include <cstdint>
#include <span>
namespace nd {
namespace impl {
class std_span_array_nd
{
public:
std_span_array_nd(std::shared_ptr<void> owner, std::span<const uint8_t> data, icm::shape shape, dtype dt)
: owner_(std::move(owner))
, data_(data)
, shape_(std::move(shape))
, dtype_(dt)
{
}
inline enum dtype dtype() const
{
return dtype_;
}
inline std::span<const uint8_t> data() const
{
return data_;
}
inline const std::shared_ptr<void>& owner() const
{
return owner_;
}
inline const icm::shape& shape() const
{
return shape_;
}
constexpr bool is_dynamic() const noexcept
{
return false;
}
private:
const std::shared_ptr<void> owner_;
const std::span<const uint8_t> data_;
const icm::shape shape_;
const enum dtype dtype_;
};
} // namespace impl
} // namespace nd