GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GHdf5 Class Reference

COSI instrument response function class. More...

#include <GHdf5.hpp>

Inheritance diagram for GHdf5:
GBase

Public Member Functions

 GHdf5 (void)
 Void constructor.
 
 GHdf5 (const GFilename &filename)
 Load constructor.
 
 GHdf5 (const GHdf5 &file)
 Copy constructor.
 
virtual ~GHdf5 (void)
 Destructor.
 
GHdf5operator= (const GHdf5 &file)
 Assignment operator.
 
void clear (void)
 Clear instance.
 
GHdf5clone (void) const
 Clone instance.
 
std::string classname (void) const
 Return class name.
 
bool is_empty (void) const
 Signals if HDF5 instance is empty.
 
void load (const GFilename &filename)
 Load data from HDF5 file into instance.
 
void read (FILE *fptr)
 Read data from HDF5 file into instance.
 
const GXmlxml (void) const
 Return HDF5 metadata as XML object.
 
const GXmlElementxml_hdf5_entry (const std::string &name) const
 Return XML element to entry tag.
 
std::string print (const GChatter &chatter=NORMAL) const
 Print HDF5 file.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Private Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GHdf5 &file)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
void read_superblock (FILE *fptr)
 Read HDF5 file superblock.
 
void read_symbol_table_node (FILE *fptr, const uint64_t &address, const uint64_t &offset, const std::string &heap, GXmlElement *table, const int &indent)
 Read HDF5 symbol table node.
 
void read_symbol_table_entry (FILE *fptr, const uint64_t &address, const uint64_t &offset, const std::string &heap, GXmlElement *entry, const int &indent)
 Read and handle HDF5 symbol table entry.
 
void read_group (FILE *fptr, const uint64_t &address_btree, const uint64_t &address_heap, GXmlElement *group, const int &indent)
 Read and handle HDF5 group.
 
void read_btree_chunked (FILE *fptr, const uint64_t &address, const int &dimensions, GXmlElement *btree)
 Read HDF5 B-tree for chunked data.
 
void read_object_header (FILE *fptr, const uint64_t &address, GXmlElement *header, const int &indent)
 Read object header.
 
void read_object_header_v1 (FILE *fptr, GXmlElement *header, const int &indent)
 Read object header version 1.
 
void read_object_header_v2 (FILE *fptr, GXmlElement *header, const int &indent)
 Read object header version 2.
 
void read_object_header_message (FILE *fptr, const int &type, GXmlElement *message, const int &indent)
 Read one object header message.
 
void read_message_dataspace (FILE *fptr, GXmlElement *message, std::string &msg)
 Read dataspace message.
 
void read_message_datatype (FILE *fptr, GXmlElement *message, std::string &msg)
 Read datatype message.
 
void read_message_layout (FILE *fptr, GXmlElement *message, std::string &msg)
 Read Data Storage - Layout message.
 
void read_message_filter (FILE *fptr, GXmlElement *message, std::string &msg)
 Read Data Storage - Filter pipeline message.
 
void read_message_attribute (FILE *fptr, GXmlElement *message, std::string &msg)
 Read Attribute message.
 
std::string global_heap_string (FILE *fptr, const uint64_t &address, const int &id, const uint32_t &length)
 Get string from global heap.
 
void debug_msg (const std::string &msg, const int &indent)
 Show debug message.
 
std::string hexaddress (const uint64_t &address)
 Format address for debugging.
 
std::string extract (const std::string &string, const int &pos)
 Extract string from position until next null termination.
 
int pad2eight (const int &nbytes)
 Pad number of Bytes to 8 Bytes.
 

Private Attributes

GFilename m_filename
 
int m_offset
 
int m_length
 
GXml m_xml
 

Detailed Description

COSI instrument response function class.

The COSI instrument response function class defines the function that translates from physical quantities to measured quantities.

Todo
Complete the class description.

Definition at line 107 of file GHdf5.hpp.

Constructor & Destructor Documentation

◆ GHdf5() [1/3]

GHdf5::GHdf5 ( void )

Void constructor.

Creates an empty instance of the HDF5 class.

Definition at line 156 of file GHdf5.cpp.

References init_members().

Referenced by clone().

◆ GHdf5() [2/3]

GHdf5::GHdf5 ( const GFilename & filename)

Load constructor.

Parameters
[in]filenameFile name of HDF5 file.

Create HDF5 instance by loading data from a HDF5 file.

Definition at line 173 of file GHdf5.cpp.

References init_members(), and load().

◆ GHdf5() [3/3]

GHdf5::GHdf5 ( const GHdf5 & file)

Copy constructor.

Parameters
[in]fileHDF5 file instance.

Definition at line 191 of file GHdf5.cpp.

References copy_members(), and init_members().

◆ ~GHdf5()

GHdf5::~GHdf5 ( void )
virtual

Destructor.

Definition at line 207 of file GHdf5.cpp.

References free_members().

Member Function Documentation

◆ classname()

std::string GHdf5::classname ( void ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GHdf5").

Implements GBase.

Definition at line 213 of file GHdf5.hpp.

◆ clear()

void GHdf5::clear ( void )
virtual

Clear instance.

Clears HDF5 file instance by resetting all class members to an initial state. Any information that was present before will be lost.

Implements GBase.

Definition at line 267 of file GHdf5.cpp.

References free_members(), and init_members().

Referenced by load(), and read().

◆ clone()

GHdf5 * GHdf5::clone ( void ) const
virtual

Clone instance.

Returns
Pointer to deep copy of HDF5 file instance.

Implements GBase.

Definition at line 285 of file GHdf5.cpp.

References GHdf5().

◆ copy_members()

void GHdf5::copy_members ( const GHdf5 & file)
private

Copy class members.

Parameters
[in]fileHDF5 file instance.

Definition at line 464 of file GHdf5.cpp.

References m_filename, m_length, m_offset, and m_xml.

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

◆ debug_msg()

void GHdf5::debug_msg ( const std::string & msg,
const int & indent )
private

Show debug message.

Parameters
[in]msgDebug message.
[in]indentNumber of spaces to indent

Definition at line 2874 of file GHdf5.cpp.

Referenced by read_group(), read_object_header_message(), read_object_header_v1(), read_superblock(), read_symbol_table_entry(), and read_symbol_table_node().

◆ extract()

std::string GHdf5::extract ( const std::string & string,
const int & pos )
private

Extract string from position until next null termination.

Parameters
[in]stringString.
[in]posStart position in string.
Returns
Extracted string.

Returns extracted string.

Definition at line 2916 of file GHdf5.cpp.

Referenced by read_symbol_table_entry().

◆ free_members()

void GHdf5::free_members ( void )
private

Delete class members.

Definition at line 480 of file GHdf5.cpp.

Referenced by clear(), operator=(), and ~GHdf5().

◆ global_heap_string()

std::string GHdf5::global_heap_string ( FILE * fptr,
const uint64_t & address,
const int & id,
const uint32_t & length )
private

Get string from global heap.

Parameters
[in]fptrFile pointer.
[in]addressCollection address (address of global heap).
[in]idHeap object index.
[in]lengthLength of string.
Returns
String from global heap.
Exceptions
GException::invalid_valueInvalid group heap signature Invalid group heap version Object index not found in global heap collection Length of string does not correspond to length of object

Get string from the global heap using it's collection address address and the heap object index id.

If the requested global heap does not yet exist in the XML object it is read from the file and stored into a "gobal_heap" element. Multiple global heap elements may exist and are identified by their file address.

Definition at line 2684 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), GXml::element(), GXmlNode::element(), GXmlNode::elements(), gammalib::hdf5::fread_data(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_uint32(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), G_GLOBAL_HEAP_STRING, hexaddress(), m_length, m_xml, pad2eight(), read(), gammalib::str(), and gammalib::toint().

Referenced by read_message_attribute().

◆ hexaddress()

std::string GHdf5::hexaddress ( const uint64_t & address)
private

Format address for debugging.

Parameters
[in]addressAddress.
Returns
String with address hexadecimal format.

Returns a string with the address in hexadecimal format.

Definition at line 2897 of file GHdf5.cpp.

References gammalib::str().

Referenced by global_heap_string(), read_btree_chunked(), read_group(), read_message_attribute(), read_message_layout(), read_object_header_message(), read_object_header_v1(), read_symbol_table_entry(), and read_symbol_table_node().

◆ init_members()

void GHdf5::init_members ( void )
private

Initialise class members.

Definition at line 446 of file GHdf5.cpp.

References GFilename::clear(), GXml::clear(), m_filename, m_length, m_offset, and m_xml.

Referenced by clear(), GHdf5(), GHdf5(), GHdf5(), and operator=().

◆ is_empty()

bool GHdf5::is_empty ( void ) const
inline

Signals if HDF5 instance is empty.

Returns
True if HDF5 instance is empty.

Definition at line 225 of file GHdf5.hpp.

References GXml::is_empty(), and m_xml.

◆ load()

void GHdf5::load ( const GFilename & filename)

Load data from HDF5 file into instance.

Parameters
[in]filenameFile name of HDF5 file.
Exceptions
GException::file_errorUnable to open specified file.

Load data from HDF5 file into a HDF5 file.

Definition at line 301 of file GHdf5.cpp.

References clear(), gammalib::expand_env(), G_LOAD, m_filename, read(), and GFilename::url().

Referenced by GHdf5().

◆ operator=()

GHdf5 & GHdf5::operator= ( const GHdf5 & file)

Assignment operator.

Parameters
[in]fileHDF5 file instance.
Returns
HDF5 file instance.

Assign HDF5 file instance to this object. The assignment performs a deep copy of all information, hence the original object from which the assignment was made can be destroyed after this operation without any loss of information.

Definition at line 234 of file GHdf5.cpp.

References copy_members(), free_members(), and init_members().

◆ pad2eight()

int GHdf5::pad2eight ( const int & nbytes)
private

Pad number of Bytes to 8 Bytes.

Parameters
[in]nbytesNumber of Bytes.
Returns
Padded number of Bytes to 8 Bytes.

Returns a padded number of Bytes so that nbytes becomes a multiple of 8 Bytes.

Definition at line 2948 of file GHdf5.cpp.

Referenced by global_heap_string(), and read_message_attribute().

◆ print()

std::string GHdf5::print ( const GChatter & chatter = NORMAL) const
virtual

Print HDF5 file.

Parameters
[in]chatterChattiness.
Returns
String containing HDF5 information.

Implements GBase.

Definition at line 407 of file GHdf5.cpp.

References GFilename::length(), m_filename, m_length, m_offset, gammalib::parformat(), SILENT, and gammalib::str().

◆ read()

void GHdf5::read ( FILE * fptr)

Read data from HDF5 file into instance.

Parameters
[in]fptrFile pointer to HDF5 file.

Read data from HDF5 file into a HDF5 file.

Definition at line 338 of file GHdf5.cpp.

References clear(), and read_superblock().

Referenced by global_heap_string(), and load().

◆ read_btree_chunked()

void GHdf5::read_btree_chunked ( FILE * fptr,
const uint64_t & address,
const int & dimensions,
GXmlElement * btree )
private

Read HDF5 B-tree for chunked data.

Parameters
[in]fptrFile pointer.
[in]addressAddress of B-tree.
[in]dimensionsDataset dimensions + 1.
[in]btreePointer to XML element for btree.
Exceptions
GException::invalid_valueTREE signature not found B-tree node type is not 1

This method only supports version 1 B-trees. Version 2 B-trees have the signature "BTHD" and need to be implemented if required.

Definition at line 1073 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_uint64(), G_READ_BTREE_CHUNKED, hexaddress(), m_offset, read_btree_chunked(), and gammalib::str().

Referenced by read_btree_chunked(), and read_message_layout().

◆ read_group()

void GHdf5::read_group ( FILE * fptr,
const uint64_t & address_btree,
const uint64_t & address_heap,
GXmlElement * group,
const int & indent )
private

Read and handle HDF5 group.

Parameters
[in]fptrFile pointer.
[in]btree_addressAddress of B-tree.
[in]heap_addressAddress of heap.
[in]groupPointer to XML element for group.
[in]indentIndent for debugging messages.
Exceptions
GException::invalid_valueTREE or HEAP signatures not found Heap version is not zero B-tree node type is not 0 or 1

This method only supports version 1 B-trees. Version 2 B-trees have the signature "BTHD" and need to be implemented if required.

Definition at line 923 of file GHdf5.cpp.

References GXmlNode::append(), debug_msg(), gammalib::hdf5::fread_data(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), G_READ_GROUP, hexaddress(), m_length, m_offset, read_symbol_table_node(), and gammalib::str().

Referenced by read_symbol_table_entry().

◆ read_message_attribute()

void GHdf5::read_message_attribute ( FILE * fptr,
GXmlElement * message,
std::string & msg )
private

Read Attribute message.

Parameters
[in]fptrFile pointer.
[in]typeMessage type.
[in]msgString for debugging messages.
Exceptions
GException::invalid_valueInvalid attribute version

The Attribute message is used to store objects in the HDF5 file which are used as attributes, or "metadata" about the current object. An attribute is a small dataset; it has a name, a datatype, a dataspace, and raw data.

Since attributes are stored in the object header, they should be relatively small (in other words, less than 64KB). They can be associated with any type of object which has an object header (groups, datasets, or committed (named) datatypes).

Note: Attributes on an object must have unique names: the HDF5 Library currently enforces this by causing the creation of an attribute with a duplicate name to fail. Attributes on different objects may have the same name, however.

Definition at line 2491 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), gammalib::hdf5::fread_data_as_string(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_uint32(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), G_READ_MESSAGE_ATTRIBUTE, global_heap_string(), GXmlElement::has_attribute(), hexaddress(), m_offset, pad2eight(), read_message_dataspace(), read_message_datatype(), sign(), gammalib::str(), and gammalib::toint().

Referenced by read_object_header_message().

◆ read_message_dataspace()

void GHdf5::read_message_dataspace ( FILE * fptr,
GXmlElement * message,
std::string & msg )
private

Read dataspace message.

Parameters
[in]fptrFile pointer.
[in]typeMessage type.
[in]msgString for debugging messages (not used if empty length).
Returns
Number of elements in dataspace.

The dataspace message describes the number of dimensions (in other words, "rank") and size of each dimension that the data object has. This message is only used for datasets which have a simple, rectilinear, array-like layout; datasets requiring a more complex layout are not yet supported.

This method supports versions 1 and 2 of the dataspace message. If other version numbers are encountered the validity flag is set to 0 and the decoding is stopped.

Definition at line 1760 of file GHdf5.cpp.

References GXmlElement::attribute(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), m_length, and gammalib::str().

Referenced by read_message_attribute(), and read_object_header_message().

◆ read_message_datatype()

void GHdf5::read_message_datatype ( FILE * fptr,
GXmlElement * message,
std::string & msg )
private

Read datatype message.

Parameters
[in]fptrFile pointer.
[in]messagePointer to XML element.
[in]msgString for debugging messages (not used if empty length).
Returns
Size of datatype elements in Bytes.
Exceptions
GException::invalid_valueInvalid datatype version or class

The datatype message defines the datatype for each element of a dataset or a common datatype for sharing between multiple datasets. A datatype can describe an atomic type like a fixed- or floating-point type or more complex types like a C struct (compound datatype), array (array datatype) or C++ vector (variable-length datatype).

Datatype messages that are part of a dataset object do not describe how elements are related to one another; the dataspace message is used for that purpose. Datatype messages that are part of a committed datatype (formerly named datatype) message describe a common datatype that can be shared by multiple datasets in the file.

Definition at line 1938 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), gammalib::hdf5::classname(), gammalib::hdf5::fread_data(), gammalib::hdf5::fread_data_as_string(), gammalib::hdf5::fread_int(), G_READ_MESSAGE_DATATYPE, read_message_datatype(), sign(), and gammalib::str().

Referenced by read_message_attribute(), read_message_datatype(), and read_object_header_message().

◆ read_message_filter()

void GHdf5::read_message_filter ( FILE * fptr,
GXmlElement * message,
std::string & msg )
private

Read Data Storage - Filter pipeline message.

Parameters
[in]fptrFile pointer.
[in]typeMessage type.
[in]msgString for debugging messages.
Exceptions
GException::invalid_valueInvalid data filter pipeline message version

Definition at line 2378 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_zero(), G_READ_MESSAGE_FILTER, and gammalib::str().

Referenced by read_object_header_message().

◆ read_message_layout()

void GHdf5::read_message_layout ( FILE * fptr,
GXmlElement * message,
std::string & msg )
private

Read Data Storage - Layout message.

Parameters
[in]fptrFile pointer.
[in]messagePointer to XML element.
[in]msgString for debugging messages.
Exceptions
GException::invalid_valueInvalid data storage layout version or class

Definition at line 2203 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_uint64(), G_READ_MESSAGE_LAYOUT, hexaddress(), m_length, m_offset, read_btree_chunked(), and gammalib::str().

Referenced by read_object_header_message().

◆ read_object_header()

void GHdf5::read_object_header ( FILE * fptr,
const uint64_t & address,
GXmlElement * header,
const int & indent )
private

Read object header.

Parameters
[in]fptrFile pointer.
[in]addressAddress of header.
[in]headerPointer to XML element for header.
[in]indentIndent for debugging messages.
Exceptions
GException::invalid_valueInvalid object header version

The header information of an object is designed to encompass all the information about an object, except for the data itself. This information includes the dataspace, datatype, information about how the data is stored on disk (in external files, compressed, broken up in blocks, and so on), as well as other information used by the library to speed up access to the data objects or maintain a file’s integrity. Information stored by user applications as attributes is also stored in the object’s header. The header of each object is not necessarily located immediately prior to the object’s data in the file and in fact may be located in any position in the file. The order of the messages in an object header is not significant.

Object headers are composed of a prefix and a set of messages. The prefix contains the information needed to interpret the messages and a small amount of metadata about the object, and the messages contain the majority of the metadata about the object.

Definition at line 1207 of file GHdf5.cpp.

References gammalib::hdf5::fread_int(), G_READ_OBJECT_HEADER, read_object_header_v1(), read_object_header_v2(), and gammalib::str().

Referenced by read_symbol_table_entry().

◆ read_object_header_message()

void GHdf5::read_object_header_message ( FILE * fptr,
const int & type,
GXmlElement * message,
const int & indent )
private

Read one object header message.

Parameters
[in]fptrFile pointer.
[in]typeMessage type.
[in]messagePointer to XML element for message.
[in]indentIndent for debugging messages.
Exceptions
GException::invalid_valueInvalid message

Definition at line 1380 of file GHdf5.cpp.

References GXmlElement::attribute(), debug_msg(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_uint64(), hexaddress(), m_offset, read_message_attribute(), read_message_dataspace(), read_message_datatype(), read_message_filter(), read_message_layout(), and gammalib::str().

Referenced by read_object_header_v1().

◆ read_object_header_v1()

void GHdf5::read_object_header_v1 ( FILE * fptr,
GXmlElement * header,
const int & indent )
private

Read object header version 1.

Parameters
[in]fptrFile pointer.
[in]headerPointer to XML element for header.
[in]indentIndent for debugging messages.
Exceptions
GException::invalid_valueInvalid message type

Definition at line 1249 of file GHdf5.cpp.

References GXmlNode::append(), debug_msg(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), G_READ_OBJECT_HEADER_V1, hexaddress(), m_length, m_offset, read_object_header_message(), and gammalib::str().

Referenced by read_object_header().

◆ read_object_header_v2()

void GHdf5::read_object_header_v2 ( FILE * fptr,
GXmlElement * header,
const int & indent )
private

Read object header version 2.

Parameters
[in]fptrFile pointer.
[in]headerPointer to XML element for header.
[in]indentIndent for debugging messages.
Exceptions
GException::feature_not_implementedMethod not yet implemented.

Method not yet implemented.

Definition at line 1356 of file GHdf5.cpp.

References G_READ_OBJECT_HEADER_V2.

Referenced by read_object_header().

◆ read_superblock()

void GHdf5::read_superblock ( FILE * fptr)
private

Read HDF5 file superblock.

Parameters
[in]fptrFile pointer.
Exceptions
GException::invalid_valueFile is not a HDF5 file Superblock version out of valid range Invalid offset and length values

Reads the superblock of the HDF5 file and walks done the hierarchical HDF5 file structure to extract all metadata. The information is stored in the XML file member m_xml that will echo the hierarchical information of the HDF5 file.

The superblock may begin at certain predefined offsets within the HDF5 file, allowing a block of unspecified content for users to place additional information at the beginning (and end) of the HDF5 file without limiting the HDF5 library's ability to manage the objects within the file itself.

This method assumes that the fptr file pointer points to the superblock. If an offset is needed, the client needs to position the file pointer accordingly.

This method fully supports superblock versions 0 and 1. For superblock versions 2 and 3, entering of the group graph still needs to be implemented.

Definition at line 516 of file GHdf5.cpp.

References GXml::append(), GXmlElement::attribute(), debug_msg(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_uint32(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), G_READ_SUPERBLOCK, m_length, m_offset, m_xml, read_symbol_table_entry(), and gammalib::str().

Referenced by read().

◆ read_symbol_table_entry()

void GHdf5::read_symbol_table_entry ( FILE * fptr,
const uint64_t & address,
const uint64_t & offset,
const std::string & heap,
GXmlElement * entry,
const int & indent )
private

Read and handle HDF5 symbol table entry.

Parameters
[in]fptrFile pointer.
[in]addressAddress of symbol table entry.
[in]offsetByte offset in heap.
[in]heapHeap.
[in]entryPointer to XML element for entry.
[in]indentIndent for debugging messages.
Exceptions
GException::invalid_valueInvalid cache type encountered

Read and handle a symbol table entry. If the entry has a cache type of 1 the method will read the corresponding group.

Each symbol table entry in a symbol table node is designed to allow for very fast browsing of stored objects. Toward that design goal, the symbol table entries include space for caching certain constant metadata from the object header.

Definition at line 809 of file GHdf5.cpp.

References GXmlNode::append(), GXmlElement::attribute(), debug_msg(), extract(), gammalib::hdf5::fread_uint32(), gammalib::hdf5::fread_uint64(), gammalib::hdf5::fread_zero(), G_READ_SYMBOL_TABLE_ENTRY, hexaddress(), m_offset, read_group(), read_object_header(), and gammalib::str().

Referenced by read_superblock(), and read_symbol_table_node().

◆ read_symbol_table_node()

void GHdf5::read_symbol_table_node ( FILE * fptr,
const uint64_t & address,
const uint64_t & offset,
const std::string & heap,
GXmlElement * table,
const int & indent )
private

Read HDF5 symbol table node.

Parameters
[in]fptrFile pointer.
[in]addressAddress of symbol table node.
[in]offsetByte offset in heap.
[in]heapHeap.
[in]tablePointer to XML element for table.
[in]indentIndent for debugging messages.
Exceptions
GException::invalid_valueSymbol table node signature not found Invalid symbol table node version

This method reads a symbol table node from the file. The symbol table node is a leaf of a B-tree.

Each symbol table node starts with the signature "SNOD" and contains an arbitrary number of symbols (group entries). All symbol table nodes have the same length of 2*m_offset+24.

Definition at line 720 of file GHdf5.cpp.

References GXmlNode::append(), debug_msg(), gammalib::hdf5::fread_int(), gammalib::hdf5::fread_string(), gammalib::hdf5::fread_uint32(), gammalib::hdf5::fread_zero(), G_READ_SYMBOL_TABLE_NODE, hexaddress(), m_offset, read_symbol_table_entry(), and gammalib::str().

Referenced by read_group().

◆ xml()

const GXml & GHdf5::xml ( void ) const
inline

Return HDF5 metadata as XML object.

Returns
HDF5 metadata XML object.

Returns the XML object that holds the HDF5 file metadata that is gathered when loading a COSI response file. This method is mainly used for diagnostic purposes.

Definition at line 241 of file GHdf5.hpp.

References m_xml.

◆ xml_hdf5_entry()

const GXmlElement * GHdf5::xml_hdf5_entry ( const std::string & name) const

Return XML element to entry tag.

Parameters
[in]nameEntry name.
Returns
Pointer to XML element of given name.
Exceptions
GException::invalid_valueNo HDF5 metadata were loaded. No entry element with specified name found.

Returns a XML pointer to an entry element with a given name.

The method works recursevely down the entire XML structure of the HDF5 file and stops once the first entry element with a "name" attribute equal to name was found. If no such element could be found, the method throws an exception.

Definition at line 371 of file GHdf5.cpp.

References GXml::element(), G_XML_HDF5_ENTRY, GXml::is_empty(), m_xml, and gammalib::xml_get_element_by_attribute().

Member Data Documentation

◆ m_filename

GFilename GHdf5::m_filename
private

Definition at line 200 of file GHdf5.hpp.

Referenced by copy_members(), init_members(), load(), and print().

◆ m_length

◆ m_offset

◆ m_xml

GXml GHdf5::m_xml
private

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