HighFive  2.3.1
HighFive - Header-only C++ HDF5 interface
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 #ifndef H5FILE_HPP
10 #define H5FILE_HPP
11 
12 #include <string>
13 
14 #include "H5FileDriver.hpp"
15 #include "H5Object.hpp"
17 #include "bits/H5Node_traits.hpp"
18 
19 namespace HighFive {
20 
24 class File : public Object,
25  public NodeTraits<File>,
26  public AnnotateTraits<File> {
27  public:
28 
30 
31  enum : unsigned {
33  ReadOnly = 0x00u,
35  ReadWrite = 0x01u,
37  Truncate = 0x02u,
39  Excl = 0x04u,
41  Debug = 0x08u,
43  Create = 0x10u,
48  };
49 
57  explicit File(const std::string& filename, unsigned openFlags = ReadOnly,
58  const FileAccessProps& fileAccessProps = FileAccessProps::Default());
59 
63  const std::string& getName() const noexcept;
64 
65 
67  std::string getPath() const noexcept {
68  return "/";
69  }
70 
76  void flush();
77 
78  private:
79  using Object::Object;
80 
81  mutable std::string _filename{};
82 
83  template <typename> friend class PathTraits;
84 };
85 
86 } // namespace HighFive
87 
88 // H5File is the main user constructible -> bring in implementation headers
90 #include "bits/H5File_misc.hpp"
93 
94 #endif // H5FILE_HPP
Definition: H5Annotate_traits.hpp:19
File class.
Definition: H5File.hpp:26
void flush()
flush
Definition: H5File_misc.hpp:87
File(const std::string &filename, unsigned openFlags=ReadOnly, const FileAccessProps &fileAccessProps=FileAccessProps::Default())
File.
Definition: H5File_misc.hpp:42
@ OpenOrCreate
Derived open flag: Opens RW or exclusively creates.
Definition: H5File.hpp:47
@ Overwrite
Derived open flag: common write mode (=ReadWrite|Create|Truncate)
Definition: H5File.hpp:45
@ Truncate
Open flag: Truncate a file if already existing.
Definition: H5File.hpp:37
@ Create
Open flag: Create non existing file.
Definition: H5File.hpp:43
@ ReadOnly
Open flag: Read only access.
Definition: H5File.hpp:33
@ ReadWrite
Open flag: Read Write access.
Definition: H5File.hpp:35
@ Debug
Open flag: Open in debug mode.
Definition: H5File.hpp:41
@ Excl
Open flag: Open will fail if file already exist.
Definition: H5File.hpp:39
static const ObjectType type
Definition: H5File.hpp:29
std::string getPath() const noexcept
Object path of a File is always "/".
Definition: H5File.hpp:67
const std::string & getName() const noexcept
Return the name of the file.
Definition: H5File_misc.hpp:78
NodeTraits: Base class for Group and File.
Definition: H5Node_traits.hpp:23
Definition: H5Object.hpp:36
Object()
Definition: H5Object_misc.hpp:16
Definition: H5Path_traits.hpp:16
HDF5 property Lists.
Definition: H5PropertyList.hpp:62
static const PropertyList< T > & Default() noexcept
Return the Default property type object.
Definition: H5PropertyList.hpp:81
Definition: H5_definitions.hpp:15
ObjectType
Enum of the types of objects (H5O api)
Definition: H5Object.hpp:25