File indexing completed on 2025-04-19 08:55:36
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <string>
0012
0013 #include "H5FileDriver.hpp"
0014 #include "H5Object.hpp"
0015 #include "H5PropertyList.hpp"
0016 #include "bits/H5Annotate_traits.hpp"
0017 #include "bits/H5Node_traits.hpp"
0018
0019 namespace HighFive {
0020
0021
0022
0023
0024 class File: public Object, public NodeTraits<File>, public AnnotateTraits<File> {
0025 public:
0026 const static ObjectType type = ObjectType::File;
0027
0028 enum : unsigned {
0029
0030 ReadOnly = 0x00u,
0031
0032 ReadWrite = 0x01u,
0033
0034 Truncate = 0x02u,
0035
0036 Excl = 0x04u,
0037
0038 Debug = 0x08u,
0039
0040 Create = 0x10u,
0041
0042 Overwrite = Truncate,
0043
0044 OpenOrCreate = ReadWrite | Create
0045 };
0046
0047
0048
0049
0050
0051
0052
0053
0054 explicit File(const std::string& filename,
0055 unsigned openFlags = ReadOnly,
0056 const FileAccessProps& fileAccessProps = FileAccessProps::Default());
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066 File(const std::string& filename,
0067 unsigned openFlags,
0068 const FileCreateProps& fileCreateProps,
0069 const FileAccessProps& fileAccessProps = FileAccessProps::Default());
0070
0071
0072
0073
0074 const std::string& getName() const noexcept;
0075
0076
0077
0078 std::string getPath() const noexcept {
0079 return "/";
0080 }
0081
0082
0083 hsize_t getMetadataBlockSize() const;
0084
0085
0086 std::pair<H5F_libver_t, H5F_libver_t> getVersionBounds() const;
0087
0088 #if H5_VERSION_GE(1, 10, 1)
0089
0090 H5F_fspace_strategy_t getFileSpaceStrategy() const;
0091
0092
0093 hsize_t getFileSpacePageSize() const;
0094 #endif
0095
0096
0097
0098
0099
0100
0101 void flush();
0102
0103
0104 FileCreateProps getCreatePropertyList() const {
0105 return details::get_plist<FileCreateProps>(*this, H5Fget_create_plist);
0106 }
0107
0108
0109 FileAccessProps getAccessPropertyList() const {
0110 return details::get_plist<FileAccessProps>(*this, H5Fget_access_plist);
0111 }
0112
0113
0114 size_t getFileSize() const;
0115
0116
0117
0118
0119
0120
0121
0122 size_t getFreeSpace() const;
0123
0124 protected:
0125 File() = default;
0126 using Object::Object;
0127
0128 private:
0129 mutable std::string _filename{};
0130
0131 template <typename>
0132 friend class PathTraits;
0133 };
0134
0135 }
0136
0137
0138 #include "bits/H5Annotate_traits_misc.hpp"
0139 #include "bits/H5File_misc.hpp"
0140 #include "bits/H5Node_traits_misc.hpp"
0141 #include "bits/H5Path_traits_misc.hpp"