{"id":19872468,"url":"https://github.com/davidace/h5pp","last_synced_at":"2025-05-02T09:31:09.296Z","repository":{"id":47897266,"uuid":"173670247","full_name":"DavidAce/h5pp","owner":"DavidAce","description":"A C++17 interface for HDF5","archived":false,"fork":false,"pushed_at":"2025-04-11T06:06:49.000Z","size":10872,"stargazers_count":95,"open_issues_count":2,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-11T07:44:39.447Z","etag":null,"topics":["binary-storage","cmake","cpp17","eigen","eigen3","hdf5","hdf5-library","hdf5-wrapper","header-only","spdlog","storage"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidAce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-04T03:53:51.000Z","updated_at":"2025-04-11T06:06:52.000Z","dependencies_parsed_at":"2023-11-10T16:27:42.148Z","dependency_job_id":"f1ee92ee-70f4-4a68-9782-183e33fe21f8","html_url":"https://github.com/DavidAce/h5pp","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2Fh5pp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2Fh5pp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2Fh5pp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2Fh5pp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidAce","download_url":"https://codeload.github.com/DavidAce/h5pp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252015781,"owners_count":21680822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-storage","cmake","cpp17","eigen","eigen3","hdf5","hdf5-library","hdf5-wrapper","header-only","spdlog","storage"],"created_at":"2024-11-12T16:15:42.375Z","updated_at":"2025-05-02T09:31:09.286Z","avatar_url":"https://github.com/DavidAce.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Ubuntu 20.04](https://github.com/DavidAce/h5pp/actions/workflows/ubuntu20.yml/badge.svg)](https://github.com/DavidAce/h5pp/actions/workflows/ubuntu20.yml)\n[![Ubuntu 22.04](https://github.com/DavidAce/h5pp/actions/workflows/ubuntu22.yml/badge.svg)](https://github.com/DavidAce/h5pp/actions/workflows/ubuntu22.yml)\n[![Ubuntu 24.04](https://github.com/DavidAce/h5pp/actions/workflows/ubuntu24.yml/badge.svg)](https://github.com/DavidAce/h5pp/actions/workflows/ubuntu24.yml)\n[![Windows 2022](https://github.com/DavidAce/h5pp/actions/workflows/windows2022.yml/badge.svg)](https://github.com/DavidAce/h5pp/actions/workflows/windows2022.yml)\n[![macOS 14](https://github.com/DavidAce/h5pp/actions/workflows/macos14.yml/badge.svg)](https://github.com/DavidAce/h5pp/actions/workflows/macos14.yml)\n[![macOS 15](https://github.com/DavidAce/h5pp/actions/workflows/macos15.yml/badge.svg)](https://github.com/DavidAce/h5pp/actions/workflows/macos15.yml)\n[![Documentation Status](https://readthedocs.org/projects/h5pp/badge/?version=latest)](https://h5pp.readthedocs.io/en/latest/?badge=latest)\n[![Conan](https://img.shields.io/badge/Install%20with-conan-green)](https://conan.io/center/h5pp)\n[![codecov](https://codecov.io/gh/davidace/h5pp/branch/dev/graph/badge.svg)](https://codecov.io/gh/davidace/h5pp)\n---\n\n# h5pp\n\n`h5pp` is a high-level C++17 interface for the [HDF5](https://www.hdfgroup.org/) C library. With simplicity in\nmind, `h5pp` lets users store common C++ data types into portable binary [HDF5](https://www.hdfgroup.org/) files.\n\n[Latest release](https://github.com/DavidAce/h5pp/releases)\n\n[Documentation](https://h5pp.readthedocs.io)\n\nGo to [examples](https://github.com/DavidAce/h5pp/tree/master/examples) to learn how to use `h5pp`.\n\nGo to [quickstart](https://github.com/DavidAce/h5pp/tree/master/quickstart) to see ways of installing `h5pp`.\n\n---\n\n## Table of Contents\n\n* [Introduction](#introduction)\n* [Features](#features)\n* [Examples](#examples)\n* [Get h5pp](#get-h5pp)\n* [Requirements](#requirements)\n* [Install](#install)\n* [To-do](#to-do)\n\n## Introduction\n\n[HDF5](https://www.hdfgroup.org/) is a portable file format for storing large datasets efficiently. HDF5 has\nofficial [low-level API's for C and Fortran](https://portal.hdfgroup.org/display/HDF5/Core+Library) with wrappers\nfor C++ and Java, and third-party bindings for Python, Julia, Matlab and many other languages. This makes HDF5 a\ngreat tool for handling data in a collaborative setting.\n\nAlthough well documented, the low-level C API is vast and using it directly can be challenging. There are many\nhigh-level wrappers already that help the user experience, but as a matter of opinion, things could be even simpler.\n\n### Goals\n\n`h5pp` is a high-level C++17 interface for the HDF5 C library which aims to be simple to use:\n\n* Read and write common C++ types in a single line of code.\n* Meaningful logs and error messages.\n* No prior knowledge of HDF5 is required.\n* Simple access to HDF5 features like tables, compression, chunking and hyperslabs.\n* Simple installation with opt-in automatic installation of dependencies.\n* Simple documentation.\n\n## Features\n\n* Header-only C++17 template library.\n* High-level front-end to the C API of the HDF5 library.\n* Type support:\n    * all numeric types: `(u)int#_t`, `float`, `double`, `long double`.\n    * **`std::complex\u003c\u003e`** with any of the types above.\n    * CUDA-style POD-structs with `x,y` or `x,y,z` members as atomic type, such as `float3` or `double2`. These work\n      with any of the types above. In `h5pp` these go by the name `Scalar2\u003c\u003e` and `Scalar3\u003c\u003e`.\n    * Contiguous containers with a `.data()` member, such as `std::vector\u003c\u003e`.\n    * Raw C-style arrays or pointer to buffer + dimensions.\n    * [**Eigen**](http://eigen.tuxfamily.org) types such as `Eigen::Matrix\u003c\u003e`, `Eigen::Array\u003c\u003e` and `Eigen::Tensor\u003c\u003e`,\n      with automatic conversion to/from row-major storage\n    * Text types `std::string`, `char` arrays, and `std::vector\u003cstd::string\u003e`.\n    * Structs as HDF5 Compound types ([example](https://github.com/DavidAce/h5pp/blob/master/examples/example-04a-custom-struct-easy.cpp))\n    * Structs as HDF5 Tables (with user-defined compound HDF5 types for entries)\n    * Ragged \"variable-length\" data in HDF5 Table columns using `h5pp::varr_t\u003c\u003e` and `h5pp::vstr_t`.\n* Modern CMake installation of `h5pp` and (opt-in) installation of dependencies.\n* Multi-platform: Linux, Windows, OSX. (Developed under Linux).\n\n## Examples\n\n### Write an `std::vector`\n\n```c++\n    #include \u003ch5pp/h5pp.h\u003e\n    int main() {\n        std::vector\u003cdouble\u003e v = {1.0, 2.0, 3.0};    // Define a vector\n        h5pp::File file(\"somePath/someFile.h5\");    // Create a file \n        file.writeDataset(v, \"myStdVector\");        // Write the vector into a new dataset \"myStdVector\"\n    }\n```\n\n### Read an `std::vector`\n\n```c++\n    #include \u003ch5pp/h5pp.h\u003e\n    int main() {\n        h5pp::File file(\"somePath/someFile.h5\", h5pp::FileAccess::READWRITE);    // Open (or create) a file\n        auto v = file.readDataset\u003cstd::vector\u003cdouble\u003e\u003e(\"myStdVector\");           // Read the dataset from file\n    }\n```\n\nFind more code examples in the [examples directory](https://github.com/DavidAce/h5pp/tree/master/examples).\n\n\n## Get h5pp\n\nThere are currently 3 ways to obtain `h5pp`:\n\n* From [conan-center](https://conan.io/center/h5pp).\n* From [GitHub](https://github.com/DavidAce/h5pp).\n* As a `.deb` package from [latest release](https://github.com/DavidAce/h5pp/releases) (Ubuntu/Debian only).\n\n## Requirements\n\n* C++17 capable compiler. GCC version \u003e= 7 or Clang version \u003e= 7.0\n* CMake version \u003e= 3.15\n* [**HDF5**](https://support.hdfgroup.org/HDF5/)  library, version \u003e= 1.8\n\n### Optional dependencies\n\n* [**Eigen**](http://eigen.tuxfamily.org) \u003e= 3.3.4: Store Eigen containers. Enable with `#define H5PP_USE_EIGEN3`.\n* [**spdlog**](https://github.com/gabime/spdlog) \u003e= 1.3.1: Logging library. Enable with `#define H5PP_USE_SPDLOG`.\n* [**fmt**](https://github.com/fmtlib/fmt) \u003e= 6.1.2: String formatting (used in `spdlog`). Enable with `#define H5PP_USE_FMT`.\n\n**NOTE:** Logging works the same with or without [Spdlog](https://github.com/gabime/spdlog) enabled. When Spdlog is *\nnot* found, a hand-crafted logger is used in its place to give identical output but without any performance\nconsiderations (implemented with STL lists, strings and streams).\n\n## Install\n\nRead the instructions [here](https://h5pp.readthedocs.io/en/latest/installation.html#installation) or see installation\nexamples under [quickstart](https://github.com/DavidAce/h5pp/tree/master/quickstart). Find a summary below.\n\n### Option 1: Install with Conan (Recommended)\n\nInstall and configure [conan](https://conan.io), then run the following command to install\nfrom [conan center](https://conan.io/center/h5pp):\n\n```\n\u003e conan install h5pp/1.11.2\n```\n\n### Option 2: Install with CMake Presets\n\nGit clone and use one of the bundled CMake Presets to configure and build the project.\nIn this case we choose `release-cmake` to install all the dependencies using just CMake. \n\n```bash\n    git clone https://github.com/DavidAce/h5pp.git\n    cd h5pp\n    cmake --preset=release-cmake         # Configure. Optionally add -DCMAKE_INSTALL_PREFIX=\u003cinstall-dir\u003e\n    cmake --build --preset=release-cmake # Builds tests and examples. Optionally add --parallel=\u003cnum cores\u003e\n    cmake --install build/release-cmake  # Install to \u003cinstall-dir\u003e (default is ./install)\n    ctest --preset=release-cmake         # Optionally run tests\n```\n\nRead more about `h5pp` CMake options in the [documentation](https://h5pp.readthedocs.io/en/latest/installation.html)\n\n### Option 3: Copy the headers\n\n`h5pp` is header-only. Copy the files under `include` to your project and then add `#include \u003ch5pp/h5pp.h\u003e`.\n\nRead more about linking h5pp to its dependencies [here](https://h5pp.readthedocs.io/en/latest/installation.html#link)\n\n## To-do\n\n* For version 2.0.0\n    * Single header\n    * Compiled-library mode\n\nIn no particular order\n\n* Continue adding documentation\n* Expand the pointer-to-data interface\n* Expand testing using catch2 for more edge-cases in\n    * filesystem permissions\n    * user-defined types\n    * tables\n* Expose more of the C-API:\n    * More support for parallel read/write with MPI\n\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidace%2Fh5pp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidace%2Fh5pp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidace%2Fh5pp/lists"}