HighFive 2.9.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5File.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3 *
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9#pragma once
10
11#include <string>
12
13#include "H5FileDriver.hpp"
14#include "H5Object.hpp"
15#include "H5PropertyList.hpp"
18
19namespace HighFive {
20
24class File: public Object, public NodeTraits<File>, public AnnotateTraits<File> {
25 public:
27
28 enum : unsigned {
30 ReadOnly = 0x00u,
32 ReadWrite = 0x01u,
34 Truncate = 0x02u,
36 Excl = 0x04u,
38 Debug = 0x08u,
40 Create = 0x10u,
45 };
46
54 explicit File(const std::string& filename,
55 unsigned openFlags = ReadOnly,
56 const FileAccessProps& fileAccessProps = FileAccessProps::Default());
57
66 File(const std::string& filename,
67 unsigned openFlags,
68 const FileCreateProps& fileCreateProps,
69 const FileAccessProps& fileAccessProps = FileAccessProps::Default());
70
74 const std::string& getName() const noexcept;
75
76
78 std::string getPath() const noexcept {
79 return "/";
80 }
81
83 hsize_t getMetadataBlockSize() const;
84
86 std::pair<H5F_libver_t, H5F_libver_t> getVersionBounds() const;
87
88#if H5_VERSION_GE(1, 10, 1)
90 H5F_fspace_strategy_t getFileSpaceStrategy() const;
91
93 hsize_t getFileSpacePageSize() const;
94#endif
95
101 void flush();
102
105 return details::get_plist<FileCreateProps>(*this, H5Fget_create_plist);
106 }
107
110 return details::get_plist<FileAccessProps>(*this, H5Fget_access_plist);
111 }
112
114 size_t getFileSize() const;
115
122 size_t getFreeSpace() const;
123
124 protected:
125 File() = default;
126 using Object::Object;
127
128 private:
129 mutable std::string _filename{};
130
131 template <typename>
132 friend class PathTraits;
133};
134
135} // namespace HighFive
136
137// H5File is the main user constructible -> bring in implementation headers
139#include "bits/H5File_misc.hpp"
Definition H5Annotate_traits.hpp:18
File class.
Definition H5File.hpp:24
FileCreateProps getCreatePropertyList() const
Get the list of properties for creation of this file.
Definition H5File.hpp:104
size_t getFileSize() const
Get the size of this file in bytes.
Definition H5File_misc.hpp:128
std::pair< H5F_libver_t, H5F_libver_t > getVersionBounds() const
Returns the HDF5 version compatibility bounds.
Definition H5File_misc.hpp:99
void flush()
flush
Definition H5File_misc.hpp:124
size_t getFreeSpace() const
Get the amount of tracked, unused space in bytes.
Definition H5File_misc.hpp:134
FileAccessProps getAccessPropertyList() const
Get the list of properties for accession of this file.
Definition H5File.hpp:109
hsize_t getMetadataBlockSize() const
Returns the block size for metadata in bytes.
Definition H5File_misc.hpp:94
@ OpenOrCreate
Derived open flag: Opens RW or exclusively creates.
Definition H5File.hpp:44
@ Overwrite
Derived open flag: common write mode (=ReadWrite|Create|Truncate)
Definition H5File.hpp:42
@ Truncate
Open flag: Truncate a file if already existing.
Definition H5File.hpp:34
@ Create
Open flag: Create non existing file.
Definition H5File.hpp:40
@ ReadOnly
Open flag: Read only access.
Definition H5File.hpp:30
@ ReadWrite
Open flag: Read Write access.
Definition H5File.hpp:32
@ Debug
Open flag: Open in debug mode.
Definition H5File.hpp:38
@ Excl
Open flag: Open will fail if file already exist.
Definition H5File.hpp:36
File()=default
static const ObjectType type
Definition H5File.hpp:26
std::string getPath() const noexcept
Object path of a File is always "/".
Definition H5File.hpp:78
const std::string & getName() const noexcept
Return the name of the file.
Definition H5File_misc.hpp:85
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:28
Definition H5Object.hpp:54
Object()
Definition H5Object_misc.hpp:25
Definition H5Path_traits.hpp:16
HDF5 property Lists.
Definition H5PropertyList.hpp:160
static const PropertyList< T > & Default() noexcept
Return the Default property type object.
Definition H5PropertyList.hpp:178
Definition H5_definitions.hpp:22
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:24