SpECTRE Documentation Coverage Report
Current view: top level - IO/H5 - Version.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 75.0 % 4 3
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            1 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : /// \file
       5              : /// Defines class h5::Version for storing version history of files
       6              : 
       7              : #pragma once
       8              : 
       9              : #include <cstdint>
      10              : #include <hdf5.h>
      11              : #include <string>
      12              : 
      13              : #include "IO/H5/Object.hpp"
      14              : #include "IO/H5/OpenGroup.hpp"
      15              : 
      16              : namespace h5 {
      17              : /*!
      18              :  * \ingroup HDF5Group
      19              :  * \brief Used to store the version of the file
      20              :  *
      21              :  * A Version object should be stored inside each H5 object that is to represent
      22              :  * a file, e.g. Dat, or Text.
      23              :  *
      24              :  * \example
      25              :  * To write the version use:
      26              :  * \snippet Test_Version.cpp h5file_write_version
      27              :  * To read the version use:
      28              :  * \snippet Test_Version.cpp h5file_read_version
      29              :  *
      30              :  */
      31            1 : class Version : public h5::Object {
      32              :  public:
      33              :   /// \cond HIDDEN_SYMOLS
      34              :   static std::string extension() { return ".ver"; }
      35              : 
      36              :   Version(bool exists, detail::OpenGroup&& group, hid_t location,
      37              :           std::string name, uint32_t version = 1);
      38              : 
      39              :   // Write a single string as the version.
      40              :   //
      41              :   // This is used for fixing a bug in CCE data written by SpEC and
      42              :   // will be removed once we no longer need to match that formatting. Do not
      43              :   // use for SpECTRE versioning!
      44              :   Version(bool exists, detail::OpenGroup&& group, hid_t location,
      45              :           std::string name, std::string version);
      46              : 
      47              :   Version(const Version& /*rhs*/) = delete;
      48              :   Version& operator=(const Version& /*rhs*/) = delete;
      49              : 
      50              :   Version(Version&& /*rhs*/) = delete;             // NOLINT
      51              :   Version& operator=(Version&& /*rhs*/) = delete;  // NOLINT
      52              :   ~Version() override = default;
      53              :   /// \endcond
      54              : 
      55            0 :   uint32_t get_version() const { return version_; }
      56              : 
      57            1 :   const std::string& subfile_path() const override { return path_; }
      58              : 
      59              :  private:
      60              :   /// \cond HIDDEN_SYMBOLS
      61              :   std::string path_;
      62              :   uint32_t version_;
      63              :   // group_ is necessary since the when the h5::Object is destroyed it closes
      64              :   // all groups that were opened to get to it.
      65              :   detail::OpenGroup group_;
      66              :   /// \endcond
      67              : };
      68              : }  // namespace h5
        

Generated by: LCOV version 2.0-1