
Overview
ritsuko provides common utilities for parsing and validation throughout the ArtifactDB C++ codebase. This is generally not intended for consumption by external developers, but they are nonetheless free to use it. Functionality includes some convenience wrappers for HDF5 parsing, date/time string checking functions, a definition of R's missing value, and more random stuff that is re-usable across different C++ libraries.
Check out the reference documentation for available functions. Some usage examples are shown below.
Non-HDF5 utilities
For the non-HDF5-dependent utilities, we can just pull in ritsuko's main header:
std::string potential_date = "2031-11-21"
}
std::string potential_time = "2031-11-21T11:49:21.34+09:00"
}
double r_missing_value()
Definition r_missing_value.hpp:19
bool is_rfc3339(const char *ptr, size_t len)
Definition is_date_time.hpp:237
bool is_date(const char *ptr, size_t len)
Definition is_date_time.hpp:73
Umbrella header for ritsuko.
HDF5 utilities
For the HDF5 utilities, we need to include a different header:
H5::H5File handle("some.h5", H5F_ACC_RDONLY);
auto dhandle = handle.openDataSet("some_data");
&dhandle,
len,
10000
);
for (hsize_t i = 0; i < len; ++i, stream.next()) {
auto val = stream.get();
}
dhandle.getCreatePlist(),
dims,
10000
);
std::vector<double> buffer;
while (!iter.finished()) {
buffer.resize(iter.size());
dhandle.read(
buffer.data(),
H5::PredType::NATIVE_DOUBLE,
iter.memory_space(),
iter.file_space()
);
iter.next();
}
Stream a numeric 1-dimensional HDF5 dataset into memory.
Definition Stream1dNumericDataset.hpp:31
Umbrella header for ritsuko's HDF5 utilities.
std::string open_and_load_scalar_string_attribute(const H5Object_ &handle, const char *name, bool utf8=true)
Definition miscellaneous.hpp:49
hsize_t get_1d_length(const H5::DataSpace &space, bool allow_scalar)
Definition get_1d_length.hpp:25
std::vector< hsize_t > pick_nd_block_dimensions(const H5::DSetCreatPropList &cplist, const std::vector< hsize_t > &dimensions, hsize_t buffer_size=10000)
Definition pick_nd_block_dimensions.hpp:26
std::vector< hsize_t > get_dimensions(const H5::DataSpace &space, bool allow_scalar)
Definition get_dimensions.hpp:25
Iterate through an N-dimensional dataset by block.
Definition IterateNdDataset.hpp:25
Utilities for variable length string arrays
For ritsuko's custom variable length string (VLS) arrays for HDF5, yet another header is involved:
H5::H5File handle("some.h5", H5F_ACC_RDONLY);
&dhandle,
len,
1000
);
for (hsize_t i = 0; i < len; ++i, stream.next()) {
auto val = stream.get();
}
Stream a 1-dimensional VLS array into memory.
Definition Stream1dArray.hpp:38
H5::DataSet open_heap(const H5::Group &handle, const char *name)
Definition open.hpp:71
H5::DataSet open_pointers(const H5::Group &handle, const char *name, size_t offset_precision, size_t length_precision)
Definition open.hpp:41
Utilities for handling ritsuko's custom VLS arrays.
Building projects
CMake with FetchContent
If you're using CMake, you just need to add something like this to your CMakeLists.txt
:
include(FetchContent)
FetchContent_Declare(
ritsuko
GIT_REPOSITORY https://github.com/ArtifactDB/ritsuko
GIT_TAG master # or any version of interest
)
FetchContent_MakeAvailable(ritsuko)
Then you can link to ritsuko to make the headers available during compilation:
# For executables:
target_link_libraries(myexe ritsuko)
# For libaries
target_link_libraries(mylib INTERFACE ritsuko)
CMake with find_package()
You can install the library by cloning a suitable version of this repository and running the following commands:
mkdir build && cd build
cmake .. -DRITSUKO_TESTS=OFF
cmake --build . --target install
Then you can use find_package()
as usual:
find_package(artifactdb_ritsuko CONFIG REQUIRED)
target_link_libraries(mylib INTERFACE artifactdb::ritsuko)
Further remarks
This library is named after Ritsuko Akizuki, as befitting her important support role.