Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 08:55:34

0001 /*
0002  *  Copyright (c), 2020, EPFL - Blue Brain Project
0003  *
0004  *  Distributed under the Boost Software License, Version 1.0.
0005  *    (See accompanying file LICENSE_1_0.txt or copy at
0006  *          http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  */
0009 #pragma once
0010 
0011 #include <H5Ipublic.h>
0012 
0013 #include "H5Utils.hpp"
0014 #include "H5Path_traits.hpp"
0015 
0016 namespace HighFive {
0017 
0018 template <typename Derivate>
0019 inline PathTraits<Derivate>::PathTraits() {
0020     static_assert(std::is_same<Derivate, Group>::value || std::is_same<Derivate, DataSet>::value ||
0021                       std::is_same<Derivate, Attribute>::value,
0022                   "PathTraits can only be applied to Group, DataSet and Attribute");
0023     const auto& obj = static_cast<const Derivate&>(*this);
0024     if (obj.isValid()) {
0025         const hid_t file_id = detail::h5i_get_file_id<PropertyException>(obj.getId());
0026         _file_obj.reset(new File(file_id));
0027     }
0028 }
0029 
0030 template <typename Derivate>
0031 inline std::string PathTraits<Derivate>::getPath() const {
0032     return details::get_name([this](char* buffer, size_t length) {
0033         return detail::h5i_get_name(static_cast<const Derivate&>(*this).getId(), buffer, length);
0034     });
0035 }
0036 
0037 template <typename Derivate>
0038 inline File& PathTraits<Derivate>::getFile() const noexcept {
0039     return *_file_obj;
0040 }
0041 
0042 }  // namespace HighFive