h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
H5File.hpp
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 "bits/H5Annotate_traits.hpp"
16#include "bits/H5Node_traits.hpp"
17
18namespace h5gt {
19
23class File : public Object,
24 public NodeTraits<File>,
25 public AnnotateTraits<File> {
26public:
27
28 // this makes available to use both
29 // Object::getObjectType and NodeTraits<T>::getObjectType
32
33 const static ObjectType type = ObjectType::File;
34
35 enum OpenFlag: unsigned {
37 ReadOnly = 0x00u,
39 ReadWrite = 0x01u,
41 Truncate = 0x02u,
43 Excl = 0x04u,
45 Debug = 0x08u,
47 Create = 0x10u,
52 };
53
61 explicit File(const std::string& filename, unsigned openFlags = ReadOnly,
62 const FileAccessProps& fileAccessProps = FileDriver());
63
64 bool operator==(const File& other) const;
65 bool operator!=(const File& other) const;
66
67 static File FromId(const hid_t& id, const bool& increaseRefCount = false){
68 Object obj = Object(id, ObjectType::File, increaseRefCount);
69 return File(obj);
70 };
71
72protected:
73 File(const Object& obj) : Object(obj){};
74};
75
76} // namespace h5gt
77
78// H5File is the main user constructible -> bring in implementation headers
79#include "bits/H5Annotate_traits_misc.hpp"
80#include "bits/H5File_misc.hpp"
81#include "bits/H5Node_traits_misc.hpp"
82
83#endif // H5FILE_HPP
Definition H5Annotate_traits.hpp:19
Definition H5PropertyList.hpp:152
file driver base concept
Definition H5FileDriver.hpp:23
File class.
Definition H5File.hpp:25
ObjectType getObjectType() const
Gets the fundamental type of the object (dataset, group, etc)
Definition H5Object_misc.hpp:195
OpenFlag
Definition H5File.hpp:35
@ Truncate
Open flag: Truncate a file if already existing.
Definition H5File.hpp:41
@ Overwrite
Derived open flag: common write mode (=ReadWrite|Create|Truncate)
Definition H5File.hpp:49
@ OpenOrCreate
Derived open flag: Opens RW or exclusively creates.
Definition H5File.hpp:51
@ Excl
Open flag: Open will fail if file already exist.
Definition H5File.hpp:43
@ Debug
Open flag: Open in debug mode.
Definition H5File.hpp:45
@ ReadWrite
Open flag: Read Write access.
Definition H5File.hpp:39
@ ReadOnly
Open flag: Read only access.
Definition H5File.hpp:37
@ Create
Open flag: Create non existing file.
Definition H5File.hpp:47
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:23
Definition H5Object.hpp:55
ObjectType getObjectType() const
Gets the fundamental type of the object (dataset, group, etc)
Definition H5Object_misc.hpp:195