|
libzarr
Header-only C++17 Zarr v2/v3, WASM-compatible
|
#include <array.hpp>
Public Member Functions | |
| const ArrayMeta & | meta () const |
| Normalized metadata (shape, chunks, dtype, codecs, attributes). | |
| const std::string & | path () const |
| Node path within the store ("" = root). | |
| std::vector< std::uint64_t > | grid_shape () const |
| Chunk-grid extent per dimension. | |
| std::uint64_t | nbytes () const |
| Whole-array size in bytes (elements x itemsize). | |
| std::uint64_t | chunk_nbytes () const |
| One full chunk's size in bytes. | |
| Bytes | read_chunk (const std::vector< std::uint64_t > &index) const |
| void | write_chunk (const std::vector< std::uint64_t > &index, const void *data, std::size_t size) |
| Bytes | read_chunk_range (const std::vector< std::uint64_t > &index, std::uint64_t element_offset, std::uint64_t element_count) const |
| void | read (void *dst, std::size_t size) const |
| void | write (const void *src, std::size_t size) |
| void | read_region (const std::vector< std::uint64_t > &origin, const std::vector< std::uint64_t > &shape, void *dst, std::size_t size) const |
| void | write_region (const std::vector< std::uint64_t > &origin, const std::vector< std::uint64_t > &shape, const void *src, std::size_t size) |
| const json & | attributes () const |
| User attributes (.zattrs). | |
| void | set_attributes (json attributes) |
| std::string | chunk_store_key (const std::vector< std::uint64_t > &index) const |
Store key of the chunk at index (bounds-checked against the grid). | |
Static Public Member Functions | |
| static Array | create (std::shared_ptr< Store > store, const std::string &path, const ArraySpec &spec) |
| static Array | open (std::shared_ptr< Store > store, const std::string &path, OpenOptions options={}) |
Friends | |
| class | Group |
A Zarr array bound to a Store. Value-semantics handle: cheap to move, holds a shared reference to the store.
|
inlinestatic |
Creates an array at path ("" = the store root) in spec.format, writing canonical metadata. Fails if the spec is invalid; overwrites existing metadata.
|
inlinestatic |
Opens an existing array at path, probing v3 (zarr.json) first, then v2 (.zarray).
|
inline |
Reads the whole array into dst (native order, C layout); size must equal nbytes().
|
inline |
Reads one chunk as a full native/C-order buffer. Missing chunks read as fill; edge chunks come back full-sized (fill-padded), per the format.
|
inline |
Reads element_count consecutive elements of one chunk starting at linear element element_offset (in stored C order), using a store byte-range read — a single hosted object can be range-served. Requires an uncompressed, untransposed chunk layout (CodecPipeline::supports_partial_read).
|
inline |
Reads the hyperslab of shape starting at origin (array coordinates) into dst as a C-order native buffer of exactly size bytes. Missing chunks read as fill.
|
inline |
Replaces the user attributes and persists them. For v3, the stored zarr.json is patched in place, preserving any extension members.
|
inline |
Writes the whole array from src (native order, C layout); size must equal nbytes(). Edge chunks are fill-padded, per the format.
|
inline |
Writes one full chunk (native byte order, C layout, exactly chunk_nbytes() bytes — edge chunks included, fill-padded).
|
inline |
Writes the hyperslab of shape starting at origin from src (a C-order native buffer of exactly size bytes). Partially covered chunks are read-modify-written, preserving their other elements; chunks the region covers entirely are rebuilt without a read.