casacore
|
A class representing an HDF5 file. More...
#include <HDF5File.h>
Public Member Functions | |
HDF5File (const String &name, ByteIO::OpenOption=ByteIO::Old) | |
Create an HDF5 file object with the given file name (possible tilde or environment variables in it will be expanded). More... | |
~HDF5File () | |
The destructor closes the file and deletes it when it was opened using ByteIO::Scratch or ByteIO::Delete. More... | |
void | reopenRW () |
Reopen the underlying file for read/write access. More... | |
Bool | isWritable () const |
Is the file writable? More... | |
Bool | isOpenedForDelete () const |
Is the file opened for delete? More... | |
Bool | isClosed () const |
Is the file temporarily closed? More... | |
virtual void | close () |
Close the file (temporarily). More... | |
void | reopen () |
Reopen the file if closed (which may change the HID). More... | |
void | flush () |
Flush the data to disk. More... | |
size_t | getChunkCacheSize () const |
Get or set the chunk cache size (in bytes). More... | |
void | setChunkCacheSize (size_t nbytes) |
Public Member Functions inherited from casacore::HDF5Object | |
HDF5Object () | |
Default constructor sets to invalid hid. More... | |
virtual | ~HDF5Object () |
The destructor in a derived class should close the hid appropriately. More... | |
bool | isValid () const |
Is it a valid hid? More... | |
hid_t | getHid () const |
Get the hid. More... | |
operator hid_t () const | |
Convert automatically to hid_t. More... | |
void | setName (const String &name) |
Get or set the name. More... | |
const String & | getName () const |
Static Public Member Functions | |
static Bool | isHDF5 (const String &name) |
Test if the file with the given name is an HDF5 file. More... | |
Static Public Member Functions inherited from casacore::HDF5Object | |
static Bool | hasHDF5Support () |
Check if there is HDF5 support compiled in. More... | |
static void | throwNoHDF5 () |
If no HDF5, throw an exception that HDF5 is not supported. More... | |
Private Member Functions | |
void | doOpen () |
Open or create the file. More... | |
HDF5File (const HDF5File &that) | |
Copy constructor cannot be used. More... | |
HDF5File & | operator= (const HDF5File &that) |
Assignment cannot be used. More... | |
Private Attributes | |
ByteIO::OpenOption | itsOption |
String | itsName |
Bool | itsDelete |
Additional Inherited Members | |
Protected Member Functions inherited from casacore::HDF5Object | |
void | setHid (hid_t hid) |
Set the hid. More... | |
void | clearHid () |
Clear the hid (set to invalid). More... | |
A class representing an HDF5 file.
Public interface
This class wraps the HDF5 functions to open, create, or close an HDF5 file. If the file is opened as readonly, it is possible to reopen it for read/write (provided the user has the correct privileges). It is also possible to temporarily close the file and reopen it later.
Note: It is ensured that the class and the static function isHDF5
are also defined if HDF5 is not compiled in;
It was overkill to use the HDF5 C++ interface. Instead little wrappers have been written. HDF5File can be embedded in a shared pointer making it possible to share an HDF5 file amongst various HDF5Array objects.
Definition at line 68 of file HDF5File.h.
|
explicit |
Create an HDF5 file object with the given file name (possible tilde or environment variables in it will be expanded).
The ByteIO option determines if the file will be created, opened for input and/or output, or possibly deleted by the destructor.
casacore::HDF5File::~HDF5File | ( | ) |
The destructor closes the file and deletes it when it was opened using ByteIO::Scratch or ByteIO::Delete.
|
private |
Copy constructor cannot be used.
|
virtual |
Close the file (temporarily).
Note it will not delete the file; that is only done by the destructor.
Implements casacore::HDF5Object.
|
private |
Open or create the file.
void casacore::HDF5File::flush | ( | ) |
Flush the data to disk.
size_t casacore::HDF5File::getChunkCacheSize | ( | ) | const |
Get or set the chunk cache size (in bytes).
Note that all data sets in a file share the cache.
|
inline |
Is the file temporarily closed?
Definition at line 100 of file HDF5File.h.
References casacore::HDF5Object::getHid().
Test if the file with the given name is an HDF5 file.
|
inline |
|
inline |
Is the file writable?
Definition at line 92 of file HDF5File.h.
References itsOption, and casacore::ByteIO::Update.
void casacore::HDF5File::reopen | ( | ) |
Reopen the file if closed (which may change the HID).
void casacore::HDF5File::reopenRW | ( | ) |
Reopen the underlying file for read/write access.
Nothing will be done if the stream is writable already. Otherwise it will be reopened and an exception will be thrown if it is not possible to reopen it for read/write access.
void casacore::HDF5File::setChunkCacheSize | ( | size_t | nbytes | ) |
|
private |
Definition at line 128 of file HDF5File.h.
Referenced by isOpenedForDelete().
|
private |
Definition at line 127 of file HDF5File.h.
|
private |
Definition at line 126 of file HDF5File.h.
Referenced by isWritable().