My Project 1.10.10
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
34 // Open the file
35 void openFile(const H5std_string &name, unsigned int flags,
36 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
37 void openFile(const char *name, unsigned int flags,
38 const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
39
40 // Close this file.
41 virtual void close() H5_OVERRIDE;
42
43 // Gets a copy of the access property list of this file.
44 FileAccPropList getAccessPlist() const;
45
46 // Gets a copy of the creation property list of this file.
47 FileCreatPropList getCreatePlist() const;
48
49 // Gets general information about this file.
50 void getFileInfo(H5F_info2_t &file_info) const;
51
52 // Returns the amount of free space in the file.
53 hssize_t getFreeSpace() const;
54
55 // Returns the number of opened object IDs (files, datasets, groups
56 // and datatypes) in the same file.
57 ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
58
59 // Retrieves a list of opened object IDs (files, datasets, groups
60 // and datatypes) in the same file.
61 void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
62
63 // Returns the pointer to the file handle of the low-level file driver.
64 void getVFDHandle(void **file_handle) const;
65 void getVFDHandle(const FileAccPropList &fapl, void **file_handle) const;
66 // void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
67
68 // Returns the file size of the HDF5 file.
69 hsize_t getFileSize() const;
70
71 // Determines if a file, specified by its name, is in HDF5 format
72 static bool isHdf5(const char *name);
73 static bool isHdf5(const H5std_string &name);
74
75 // Reopens this file.
76 void reOpen(); // added for better name
77
78#ifndef DOXYGEN_SHOULD_SKIP_THIS
79 void reopen(); // obsolete in favor of reOpen()
80
81 // Creates an H5File using an existing file id. Not recommended
82 // in applications.
83 H5File(hid_t existing_id);
84
85#endif // DOXYGEN_SHOULD_SKIP_THIS
86
88 virtual H5std_string
89 fromClass() const H5_OVERRIDE
90 {
91 return ("H5File");
92 }
93
94 // Throw file exception.
95 virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE;
96
97 // For CommonFG to get the file id.
98 virtual hid_t getLocId() const H5_OVERRIDE;
99
100 // Default constructor
101 H5File();
102
103 // Copy constructor: same as the original H5File.
104 H5File(const H5File &original);
105
106 // Gets the HDF5 file id.
107 virtual hid_t getId() const H5_OVERRIDE;
108
109 // H5File destructor.
110 virtual ~H5File();
111
112 protected:
113#ifndef DOXYGEN_SHOULD_SKIP_THIS
114 // Sets the HDF5 file id.
115 virtual void p_setId(const hid_t new_id) H5_OVERRIDE;
116#endif // DOXYGEN_SHOULD_SKIP_THIS
117
118 private:
119 hid_t id; // HDF5 file id
120
121 // This function is private and contains common code between the
122 // constructors taking a string or a char*
123 void p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
124 const FileAccPropList &access_plist);
125
126}; // end of H5File
127} // namespace H5
128
129#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 hid_t getLocId() const H5_OVERRIDE
virtual H5std_string fromClass() const H5_OVERRIDE
Returns this class name.
Definition H5File.h:89
Definition H5AbstractDs.cpp:33


The HDF Group Help Desk:
  Copyright by The HDF Group