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


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois