1#ifndef TAKANE_STRING_FACTOR_HPP
2#define TAKANE_STRING_FACTOR_HPP
8#include "ritsuko/hdf5/hdf5.hpp"
11#include "utils_string.hpp"
12#include "utils_factor.hpp"
25namespace string_factor {
33 auto vstring = internal_json::extract_version_for_type(metadata.
other,
"string_factor");
34 auto version = ritsuko::parse_version_string(vstring.c_str(), vstring.size(),
true);
35 if (version.major != 1) {
36 throw std::runtime_error(
"unsupported version string '" + vstring +
"'");
39 auto handle = ritsuko::hdf5::open_file(path /
"contents.h5");
40 auto ghandle = ritsuko::hdf5::open_group(handle,
"string_factor");
41 internal_factor::check_ordered_attribute(ghandle);
43 size_t num_levels = internal_factor::validate_factor_levels(ghandle,
"levels", options.
hdf5_buffer_size);
44 size_t num_codes = internal_factor::validate_factor_codes(ghandle,
"codes", num_levels, options.
hdf5_buffer_size);
46 internal_string::validate_names(ghandle,
"names", num_codes, options.
hdf5_buffer_size);
56 auto handle = ritsuko::hdf5::open_file(path /
"contents.h5");
57 auto ghandle = handle.openGroup(
"string_factor");
58 auto dhandle = ghandle.openDataSet(
"codes");
59 return ritsuko::hdf5::get_1d_length(dhandle.getSpace(),
false);
size_t height(const std::filesystem::path &path, const ObjectMetadata &metadata, Options &options)
Definition string_factor.hpp:55
void validate(const std::filesystem::path &path, const ObjectMetadata &metadata, Options &options)
Definition string_factor.hpp:32
takane validation functions.
Definition _derived_from.hpp:15
Validation options.
Definition utils_public.hpp:94
hsize_t hdf5_buffer_size
Definition utils_public.hpp:103