h5cpp  0.6.0
A modern C++ wrapper for the HDF5 C library
hdf5::ObjectId Class Reference

Unique ID of an HDF5 object. More...

#include <object_id.hpp>

Public Member Functions

 ObjectId ()
 default constructor More...
 
 ObjectId (const ObjectHandle &handle)
 constructor More...
 
bool operator== (const ObjectId &other) const
 Equality operator for IDs. More...
 
bool operator!= (const ObjectId &other) const
 Inequality operator for IDs. More...
 
bool operator< (const ObjectId &other) const
 Allows sorting of IDs. More...
 
unsigned long file_number () const noexcept
 Get the HDF5 file number. More...
 
haddr_t object_address () const noexcept
 Get object address. More...
 
fs::path file_name () const noexcept
 Get file name. More...
 

Static Public Member Functions

static std::string get_file_name (const ObjectHandle &handle)
 get the name of the file More...
 
static H5O_info_t_ get_info (const ObjectHandle &handle)
 get object info More...
 

Detailed Description

Such an ID is constructed from an ObjectHandle instance. However, no reference to that handle is stored in the class. An instance of ObjectId allows the unique identification of an HDF5 object within the context of a program. The ID is currently formed from the

  • address of an object within the file it is stored
  • the HDF5 file number of the objects parent file

Optinally we also provide the name of the the object is stored in.

Constructor & Destructor Documentation

◆ ObjectId() [1/2]

hdf5::ObjectId::ObjectId ( )
inline

We need the default constructor for compliance with STL containers as we may want to store IDs in one.

◆ ObjectId() [2/2]

hdf5::ObjectId::ObjectId ( const ObjectHandle handle)

Construct an ID from a handler instance. If the handler is default constructed and thus invalid a default constructed Id instance will be returned.

Parameters
handlereference to an object handler

Member Function Documentation

◆ file_name()

fs::path hdf5::ObjectId::file_name ( ) const
noexcept

Return the name fo the file the object referenced by this ID is stored in. An empty path is returned in the case of a default constructed ID.

Returns
path to the objects parent file

◆ file_number()

unsigned long hdf5::ObjectId::file_number ( ) const
noexcept

Return the HDF5 file number of the file the object referenced by this ID belongs to. If the ID is default constructed this method returns 0.

Returns
file number of the parent file

◆ get_file_name()

static std::string hdf5::ObjectId::get_file_name ( const ObjectHandle handle)
static

Obtains the name of the file where the object is stored in.

◆ get_info()

static H5O_info_t_ hdf5::ObjectId::get_info ( const ObjectHandle handle)
static

H5O_info_t

Gets object info.

For HDF5 version 1.12.0 and higher, this explicitly returns a H5O_info1_t structure. For versions <= 1.10.5 it returns H5O_info_t.

◆ object_address()

haddr_t hdf5::ObjectId::object_address ( ) const
noexcept

Return the address of the referenced object within its file. If the ID instance is default constructed this method returns 0.

Returns
object address within its file

◆ operator!=()

bool hdf5::ObjectId::operator!= ( const ObjectId other) const

◆ operator<()

bool hdf5::ObjectId::operator< ( const ObjectId other) const

◆ operator==()

bool hdf5::ObjectId::operator== ( const ObjectId other) const

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