Loading...
Searching...
No Matches
casacore::HDF5File Class Reference
casa package (libcasa_casa) » HDF5_module

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).
| ~HDF5File ()
| The destructor closes the file and deletes it when it was opened using ByteIO::Scratch or ByteIO::Delete.
void | reopenRW ()
| Reopen the underlying file for read/write access.
Bool | isWritable () const
| Is the file writable?
Bool | isOpenedForDelete () const
| Is the file opened for delete?
Bool | isClosed () const
| Is the file temporarily closed?
virtual void | close ()
| Close the file (temporarily).
void | reopen ()
| Reopen the file if closed (which may change the HID).
void | flush ()
| Flush the data to disk.
size_t | getChunkCacheSize () const
| Get or set the chunk cache size (in bytes).
void | setChunkCacheSize (size_t nbytes)
Public Member Functions inherited from casacore::HDF5Object
| HDF5Object ()
| Default constructor sets to invalid hid.
virtual | ~HDF5Object ()
| The destructor in a derived class should close the hid appropriately.
| HDF5Object (const HDF5Object &)=delete
| Copy constructor cannot be used because a HID cannot be copied.
HDF5Object & | operator= (const HDF5Object &)=delete
| Assignment cannot be used because a HID cannot be copied.
bool | isValid () const
| Is it a valid hid?
hid_t | getHid () const
| Get the hid.
| operator hid_t () const
| Convert automatically to hid_t.
void | setName (const String &name)
| Get or set the name.
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.
Static Public Member Functions inherited from casacore::HDF5Object
static Bool | hasHDF5Support ()
| Check if there is HDF5 support compiled in.
static void | throwNoHDF5 ()
| If no HDF5, throw an exception that HDF5 is not supported.

## Private Member Functions

void | doOpen ()
| Open or create the file.
| HDF5File (const HDF5File &that)
| Copy constructor cannot be used.
HDF5File & | operator= (const HDF5File &that)
| Assignment cannot be used.

## 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.
void | clearHid ()
| Clear the hid (set to invalid).

## Detailed Description

A class representing an HDF5 file.

### Intended use:

Public interface

### Review Status

Test programs:
  tHDF5File

### Prerequisite

- HDF5 system

### Synopsis

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;

### Motivation

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 66 of file HDF5File.h.

## Constructor & Destructor Documentation

## HDF5File() [1/2]

casacore::HDF5File::HDF5File | ( | const String & | name,
|  | ByteIO::OpenOption | = ByteIO::Old )

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.

References casacore::name(), and casacore::ByteIO::Old.

Referenced by HDF5File(), and operator=().

## ~HDF5File()

casacore::HDF5File::~HDF5File | ( |  | ) |

The destructor closes the file and deletes it when it was opened using ByteIO::Scratch or ByteIO::Delete.

## HDF5File() [2/2]

casacore::HDF5File::HDF5File | ( | const HDF5File & | that | ) |

private

Copy constructor cannot be used.

References HDF5File().

## Member Function Documentation

## close()

virtual void casacore::HDF5File::close | ( |  | ) |

virtual

Close the file (temporarily).

Note it will not delete the file; that is only done by the destructor.

Implements casacore::HDF5Object.

## doOpen()

void casacore::HDF5File::doOpen | ( |  | ) |

private

Open or create the file.

## flush()

void casacore::HDF5File::flush | ( |  | ) |

Flush the data to disk.

## getChunkCacheSize()

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.

## isClosed()

Bool casacore::HDF5File::isClosed | ( |  | ) | const

inline

Is the file temporarily closed?

Definition at line 98 of file HDF5File.h.

References casacore::HDF5Object::getHid().

## isHDF5()

Bool casacore::HDF5File::isHDF5 | ( | const String & | name | ) |

static

Test if the file with the given name is an HDF5 file.

References casacore::name().

## isOpenedForDelete()

Bool casacore::HDF5File::isOpenedForDelete | ( |  | ) | const

inline

Is the file opened for delete?

Definition at line 94 of file HDF5File.h.

References itsDelete.

## isWritable()

Bool casacore::HDF5File::isWritable | ( |  | ) | const

inline

Is the file writable?

Definition at line 90 of file HDF5File.h.

References itsOption, and casacore::ByteIO::Update.

## operator=()

HDF5File & casacore::HDF5File::operator= | ( | const HDF5File & | that | ) |

private

Assignment cannot be used.

References HDF5File().

## reopen()

void casacore::HDF5File::reopen | ( |  | ) |

Reopen the file if closed (which may change the HID).

## reopenRW()

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.

## setChunkCacheSize()

void casacore::HDF5File::setChunkCacheSize | ( | size_t | nbytes | ) |

## Member Data Documentation

## itsDelete

Bool casacore::HDF5File::itsDelete

private

Definition at line 126 of file HDF5File.h.

Referenced by isOpenedForDelete().

## itsName

String casacore::HDF5File::itsName

private

Definition at line 125 of file HDF5File.h.

## itsOption

ByteIO::OpenOption casacore::HDF5File::itsOption

private

Definition at line 124 of file HDF5File.h.

Referenced by isWritable().

The documentation for this class was generated from the following file:

- casa/HDF5/HDF5File.h