My Project 1.14.3
Loading...
Searching...
No Matches
H5File.h
1// C++ informative line for the emacs editor: -*- C++ -*-
2/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 * Copyright by The HDF Group. *
4 * All rights reserved. *
5 * *
6 * This file is part of HDF5. The full HDF5 copyright notice, including *
7 * terms governing use, modification, and redistribution, is contained in *
8 * the COPYING file, which can be found at the root of the source code *
9 * distribution tree, or in https://www.hdfgroup.org/licenses. *
10 * If you do not have access to either file, you may request a copy from *
11 * help@hdfgroup.org. *
12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13
14#ifndef H5File_H
15#define H5File_H
16
17namespace H5 {
18
23// Inheritance: Group -> CommonFG/H5Object -> H5Location -> IdComponent
24class H5_DLLCPP H5File : public Group {
25 public:
26 // Creates or opens an HDF5 file.
27 H5File(const char *name, unsigned int flags,
28 const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT,
29 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
30 H5File(const H5std_string &name, unsigned int flags,
31 const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT,
32 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
33 H5File(const char *name, unsigned int flags, const FileAccPropList &access_plist);
34 H5File(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist);
35
36 // Open the file
37 void openFile(const H5std_string &name, unsigned int flags,
38 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
39 void openFile(const char *name, unsigned int flags,
40 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
41
42 // Close this file.
43 virtual void close() override;
44
45 // Gets a copy of the access property list of this file.
46 FileAccPropList getAccessPlist() const;
47
48 // Gets a copy of the creation property list of this file.
49 FileCreatPropList getCreatePlist() const;
50
51 // Gets general information about this file.
52 void getFileInfo(H5F_info2_t &file_info) const;
53
54 // Returns the amount of free space in the file.
55 hssize_t getFreeSpace() const;
56
57 // Returns the number of opened object IDs (files, datasets, groups
58 // and datatypes) in the same file.
59 ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
60
61 // Retrieves a list of opened object IDs (files, datasets, groups
62 // and datatypes) in the same file.
63 void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
64
65 // Returns the pointer to the file handle of the low-level file driver.
66 void getVFDHandle(void **file_handle) const;
67 void getVFDHandle(const FileAccPropList &fapl, void **file_handle) const;
68 // void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
69
70 // Returns the file size of the HDF5 file.
71 hsize_t getFileSize() const;
72
73 // Returns the 'file number' of the HDF5 file.
74 unsigned long getFileNum() const;
75
76 // Determines if a file, specified by its name, is in HDF5 format
77 static bool isHdf5(const char *name);
78 static bool isHdf5(const H5std_string &name);
79
80 // Determines if a file, specified by its name, can be accessed as HDF5
81 static bool isAccessible(const char *name,
82 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
83 static bool isAccessible(const H5std_string &name,
84 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
85
86 // Reopens this file.
87 void reOpen(); // added for better name
88
89#ifndef DOXYGEN_SHOULD_SKIP_THIS
90 void reopen(); // obsolete in favor of reOpen()
91
92 // Creates an H5File using an existing file id. Not recommended
93 // in applications.
94 H5File(hid_t existing_id);
95
96#endif // DOXYGEN_SHOULD_SKIP_THIS
97
99 virtual H5std_string
100 fromClass() const override
101 {
102 return ("H5File");
103 }
104
105 // Throw file exception.
106 virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override;
107
108 // For CommonFG to get the file id.
109 virtual hid_t getLocId() const override;
110
111 // Default constructor
112 H5File();
113
114 // Copy constructor: same as the original H5File.
115 H5File(const H5File &original);
116
117 // Gets the HDF5 file id.
118 virtual hid_t getId() const override;
119
120 // H5File destructor.
121 virtual ~H5File() override;
122
123 protected:
124#ifndef DOXYGEN_SHOULD_SKIP_THIS
125 // Sets the HDF5 file id.
126 virtual void p_setId(const hid_t new_id) override;
127#endif // DOXYGEN_SHOULD_SKIP_THIS
128
129 private:
130 hid_t id; // HDF5 file id
131
132 // This function is private and contains common code between the
133 // constructors taking a string or a char*
134 void p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
135 const FileAccPropList &access_plist);
136
137}; // end of H5File
138} // namespace H5
139
140#endif // H5File_H
Class FileAccPropList inherits from PropList and provides wrappers for the HDF5 file access property ...
Definition H5FaccProp.h:24
Class FileCreatPropList inherits from PropList and provides wrappers for the HDF5 file create propert...
Definition H5FcreatProp.h:24
Class Group represents an HDF5 group.
Definition H5Group.h:23
Class H5File represents an HDF5 file and inherits from class Group as file is a root group.
Definition H5File.h:24
virtual H5std_string fromClass() const override
Returns this class name.
Definition H5File.h:100
virtual hid_t getLocId() const override
Definition H5AbstractDs.cpp:33


The HDF Group Help Desk:
  Copyright by The HDF Group