RMF
ConstFile.h
Go to the documentation of this file.
1 /**
2  * \file RMF/HDF5/ConstFile.h
3  * \brief Handle read/write of Model data from/to files.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef RMF_HDF5_CONST_FILE_H
10 #define RMF_HDF5_CONST_FILE_H
11 
12 #include "RMF/config.h"
13 #include "ConstGroup.h"
14 
15 RMF_ENABLE_WARNINGS
16 
17 namespace RMF {
18 namespace HDF5 {
19 
20 /** Store a handle to a non-writable HDF5 file. See
21  \external{https://support.hdfgroup.org/HDF5/doc/RM/RM_H5F.html,
22  the HDF5 manual} for more information.
23 
24  \note At the moment, a given file can only be opened once within a
25  a process. This can be fixed if there is demand.
26  */
27 class RMFEXPORT ConstFile : public ConstGroup {
28  public:
29 #if !defined(RMF_DOXYGEN) && !defined(SWIG)
30  ConstFile(std::shared_ptr<SharedHandle> h);
31 #endif
32  ConstFile(File f);
33  ConstFile() {}
34  RMF_SHOWABLE(ConstFile, "ConstFile " << get_name());
35  std::string get_name() const;
36  ~ConstFile();
37 };
38 
39 /** Open an existing HDF5 file read only. The file cannot already
40  be open.
41  */
42 RMFEXPORT ConstFile open_file_read_only(std::string name);
43 
44 /** */
45 typedef std::vector<Group> ConstGroups;
46 /** */
47 typedef std::vector<File> ConstFiles;
48 
49 /** For debugging, one can get the number of open HDF5 handles for either
50  one file, or the whole system.*/
52 /** For debugging you can get the names of open handles in either one file
53  or the whole process.*/
55 
56 /** Turn on and off printing of HDF5 error messages. They can help in
57  diagnostics, but, for the moment, can only be output to standard
58  error and so are off by default.
59  */
60 RMFEXPORT void set_show_errors(bool tf);
61 
62 } /* namespace HDF5 */
63 } /* namespace RMF */
64 
65 RMF_DISABLE_WARNINGS
66 
67 #endif /* RMF_HDF5_CONST_FILE_H */
std::vector< String > Strings
Definition: HDF5/types.h:46
Handle read/write of Model data from/to files.
ConstFile open_file_read_only(std::string name)
int get_number_of_open_handles(ConstFile f=ConstFile())
Strings get_open_handle_names(ConstFile f=ConstFile())
void set_show_errors(bool tf)