3#ifndef LIBZARR_TYPES_HPP
4#define LIBZARR_TYPES_HPP
18#define LIBZARR_VERSION_MAJOR 1
20#define LIBZARR_VERSION_MINOR 0
22#define LIBZARR_VERSION_PATCH 0
28#define LIBZARR_DEPRECATED(msg) [[deprecated(msg)]]
36class error :
public std::runtime_error {
38 using std::runtime_error::runtime_error;
42using Bytes = std::vector<std::uint8_t>;
52enum class DType : std::uint8_t {
72 return kind == DType::float16 || kind == DType::float32 || kind == DType::float64;
77 return kind == DType::int8 || kind == DType::int16 || kind == DType::int32 ||
83 return kind == DType::uint8 || kind == DType::uint16 || kind == DType::uint32 ||
84 kind == DType::uint64;
89 return kind == DType::complex64 || kind == DType::complex128;
111 case DType::complex64:
113 case DType::complex128:
132 if (
kind == DType::raw) {
133 throw error(
"DataType::of(DType::raw): raw has no fixed size, use DataType::raw_bytes()");
A concrete element type: kind plus size (the size only varies for raw).
Definition types.hpp:122
friend constexpr bool operator!=(DataType a, DataType b)
Differing kind or size.
Definition types.hpp:148
std::uint32_t itemsize
Element size in bytes.
Definition types.hpp:126
static constexpr DataType raw_bytes(std::uint32_t size)
A raw byte-string type of size bytes (v2 |V<size>).
Definition types.hpp:139
DType kind
Element type kind.
Definition types.hpp:124
static constexpr DataType of(DType kind)
Definition types.hpp:131
friend constexpr bool operator==(DataType a, DataType b)
Equal kind and size.
Definition types.hpp:144
constexpr bool is_float(DType kind)
True for float16/float32/float64.
Definition types.hpp:71
constexpr bool is_unsigned_int(DType kind)
True for uint8..uint64.
Definition types.hpp:82
DType
Definition types.hpp:52
constexpr bool is_signed_int(DType kind)
True for int8..int64.
Definition types.hpp:76
constexpr std::uint32_t fixed_itemsize(DType kind)
Definition types.hpp:94
std::vector< std::uint8_t > Bytes
Owned byte buffer used throughout the value-based public API.
Definition types.hpp:42
ZarrFormat
Zarr storage format version.
Definition types.hpp:45
constexpr bool is_complex(DType kind)
True for complex64/complex128.
Definition types.hpp:88