StoreAccessor

Header file: <libs/zarr/store_accessor.hpp> [source]

template<typename Store>
struct StoreAccessor

A template class for converting types into vectors of single bytes to write to a “store” under a given key.

This class provides functions for converting various types (e.g., vectors / Kokkos views of unsigned integers or doubles) into spans of single bytes, which can then be written to a “store” under a specified key. The store is any object, but for example it could be a file system satisfying the Zarr storage specification version 2.

Template Parameters:

Store – The type of the store object.

Public Functions

inline StoreAccessor &operator=(std::span<const uint8_t> buffer)

Write a range of memory representing unsigned bytes (uint8_t) to the store.

Parameters:

buffer – A span representing the range of memory containing the unsigned bytes.

Returns:

A reference to the current StoreAccessor object.

inline StoreAccessor &operator=(std::string_view buffer)

Convert a C++ string type into a range of memory representing unsigned bytes, then writes the bytes to the store.

Reinterprets (i.e. converts) the range of memory occupied by a string as a series of unsigned bytes (uint8_t), and then writes this memory to the store.

Parameters:

buffer – The string to be converted and written to the store.

Returns:

A reference to the current StoreAccessor object.

template<typename T>
inline StoreAccessor &operator=(const std::span<const T> buffer)

Convert a vector of type T into a range of memory representing unsigned bytes then writes the bytes to the store.

Reinterprets (i.e. converts) the range of memory occupied by a vector of type T as a series of unsigned bytes (uint8_t), and then writes this memory to the store.

Template Parameters:

T – The type of the elements in the vector.

Parameters:

buffer – The vector to be converted and written to the store.

Returns:

A reference to the current StoreAccessor object.

template<typename T>
inline StoreAccessor &operator=(const Kokkos::View<T*, HostSpace> buffer)

Convert a Kokkos view of type T in the host memory space into a range of memory representing unsigned bytes, then writes the bytes to the store.

Reinterprets (i.e. converts) the range of memory occupied by the elements of a Kokkos view of type T in the host memory space as a series of unsigned bytes (uint8_t), and then writes this memory to the store.

Template Parameters:

T – The type of the elements in the Kokkos view in the host memory space.

Parameters:

buffer – The Kokkos view to be converted and written to the store.

Returns:

A reference to the current StoreAccessor object.

Public Members

Store &store

Reference to the store object.

std::string_view key

The key under which data will be stored in the store.