|
GammaLib 2.2.0.dev
|
Functions | |
| std::string | fread_data (FILE *fptr, const int &nbytes) |
| Read data from HDF5 file. | |
| std::string | fread_data (FILE *fptr, const GXmlElement *dataspace, const GXmlElement *datatype, const GXmlElement *datalayout, const GXmlElement *datafilter=NULL) |
| Read data. | |
| std::string | fread_data_chunk (FILE *fptr, const GXmlElement *chunk, const GXmlElement *dataspace, const GXmlElement *datatype, const GXmlElement *datalayout, const GXmlElement *datafilter=NULL) |
| Read data chunk. | |
| int | fread_int (FILE *fptr, const int &nbytes) |
| Read data as integer from HDF5 file. | |
| uint32_t | fread_uint32 (FILE *fptr, const int &nbytes) |
| Read data as unsiged 32 Bit integer from HDF5 file. | |
| uint64_t | fread_uint64 (FILE *fptr, const int &nbytes) |
| Read data as unsiged 64 Bit integer from HDF5 file. | |
| std::string | fread_string (FILE *fptr, const int &nbytes) |
| Read string data from HDF5 file. | |
| std::string | fread_data_as_string (FILE *fptr, const GXmlElement *datatype) |
| Read data with any data type as a string. | |
| void | fread_zero (FILE *fptr, const int &nbytes) |
| Read zero data from HDF5 file. | |
| int | data_to_int (const char *data, const GXmlElement *datatype) |
| Convert data into integer value. | |
| double | data_to_double (const char *data, const GXmlElement *datatype) |
| Convert data into double precision floating point value. | |
| std::string | data_to_string (const char *data, const GXmlElement *datatype) |
| Convert data into string. | |
| std::string | data_filter (const std::string &data, const GXmlElement *datafilter) |
| Filter data. | |
| std::string | data_filter_bitshuffle (const std::string &data, const GXmlElement *filter) |
| Filter data according to Bitshuffle algorithm. | |
| const GXmlElement * | xml_msg_type (const GXmlElement *header, const std::string &type, const int &number=0) |
| Return specific occurence of header message of given type. | |
| bool | xml_has_msg_type (const GXmlElement *header, const std::string &type, const int &number=0) |
| Checks if specific occurence of header message of given type exists. | |
| int | xml_msg_attributes (const GXmlElement *header, const std::string &name="") |
| Return number of "Attribute" messages in header. | |
| const GXmlElement * | xml_msg_attribute (const GXmlElement *header, const std::string &name, const int &number=0) |
| Return "Attribute" message XML element with specified name. | |
| bool | xml_has_msg_attribute (const GXmlElement *header, const std::string &name, const int &number=0) |
| Checks if "Attribute" message XML element with specified name exists. | |
| std::string | xml_msg_attribute (const GXmlElement *header, const std::string &name, const std::string &key) |
| Return "Attribute" message key value from attribute with specified name. | |
| const GXmlElement * | xml_msg_dataspace (const GXmlElement *header) |
| Return "Dataspace" message XML element. | |
| const GXmlElement * | xml_msg_datatype (const GXmlElement *header) |
| Return "Datatype" message XML element. | |
| const GXmlElement * | xml_msg_datalayout (const GXmlElement *header) |
| Return "DataStorageLayout" message XML element. | |
| const GXmlElement * | xml_msg_datafilter (const GXmlElement *header) |
| Return "DataStorageFilterPipeline" message XML element. | |
| std::string | classname (const int &cls) |
| Convert datatype class into classname. | |
| std::string gammalib::hdf5::classname | ( | const int & | cls | ) |
Convert datatype class into classname.
| [in] | cls | Datatype class. |
Return class name from datatype class.
Definition at line 4365 of file GHdf5.cpp.
References classname().
Referenced by classname(), data_to_double(), data_to_int(), data_to_string(), and GHdf5::read_message_datatype().
| std::string gammalib::hdf5::data_filter | ( | const std::string & | data, |
| const GXmlElement * | datafilter ) |
Filter data.
| [in] | data | Data string. |
| [in] | datafilter | Pointer to datafilter XML element. |
| GException::invalid_argument | No "filters" attribute in datafilter |
| GException::invalid_value | Unxpected number of "filter" elements |
| GException::feature_not_implemented | Requested filter is not yet implemented |
Filter data according to specified datafilter.
Definition at line 3822 of file GHdf5.cpp.
References GXmlElement::attribute(), data_filter_bitshuffle(), GXmlNode::element(), GXmlNode::elements(), G_DATA_FILTER, GXmlElement::has_attribute(), gammalib::str(), and gammalib::toint().
Referenced by fread_data(), and fread_data_chunk().
| std::string gammalib::hdf5::data_filter_bitshuffle | ( | const std::string & | data, |
| const GXmlElement * | filter ) |
Filter data according to Bitshuffle algorithm.
| [in] | data | Data string. |
| [in] | filter | Pointer to bitshuffle filter XML element. |
| GException::invalid_argument | Invalid number of client data values found in filter |
| GException::feature_not_implemented | Unsupported Bitshuffle algorithm specified in filter |
Filter data according to Bitshuffle algorithm with parameters specified by filter.
The method was inspired by https://github.com/kiyo-masui/bitshuffle and specifically the bshuf_h5_filter() function in the file bshuf_h5filter.c.
Definition at line 3903 of file GHdf5.cpp.
References bitshuffle_decompress(), bitshuffle_read_uint32(), bitshuffle_read_uint64(), GXmlNode::element(), GXmlNode::elements(), G_DATA_FILTER_BITSHUFFLE, GXmlElement::integer(), and gammalib::str().
Referenced by data_filter().
| double gammalib::hdf5::data_to_double | ( | const char * | data, |
| const GXmlElement * | datatype ) |
Convert data into double precision floating point value.
| [in] | data | Pointer to data. |
| [in] | datatype | Pointer to datatype XML element. |
| GException::feature_not_implemented | Conversion of specified datatype not yet supported GException::invalid_value Conversion of datatype not supported |
Converts one data element of given datatype into a double precision floating point value.
Definition at line 3639 of file GHdf5.cpp.
References GXmlElement::attribute(), classname(), G_DATA_TO_DOUBLE, gammalib::order(), gammalib::str(), and gammalib::toint().
| int gammalib::hdf5::data_to_int | ( | const char * | data, |
| const GXmlElement * | datatype ) |
Convert data into integer value.
| [in] | data | Pointer to data. |
| [in] | datatype | Pointer to datatype XML element. |
| GException::feature_not_implemented | Conversion of specified datatype not yet supported GException::invalid_value Conversion of datatype not supported |
Converts one data element of given datatype into an integer value. The method does not check for overflow. Fixed-point data are assumed to be stored in little endian order.
Definition at line 3558 of file GHdf5.cpp.
References GXmlElement::attribute(), classname(), G_DATA_TO_INT, gammalib::order(), gammalib::str(), and gammalib::toint().
| std::string gammalib::hdf5::data_to_string | ( | const char * | data, |
| const GXmlElement * | datatype ) |
Convert data into string.
| [in] | data | Pointer to data. |
| [in] | datatype | Pointer to datatype XML element. |
| GException::feature_not_implemented | Conversion of specified datatype not yet supported |
Converts one data element of given datatype into a character string.
Definition at line 3717 of file GHdf5.cpp.
References GXmlElement::attribute(), classname(), data_to_string(), GXmlNode::element(), G_DATA_TO_STRING, gammalib::number(), sign(), gammalib::str(), and gammalib::toint().
Referenced by data_to_string(), and fread_data_as_string().
| std::string gammalib::hdf5::fread_data | ( | FILE * | fptr, |
| const GXmlElement * | dataspace, | ||
| const GXmlElement * | datatype, | ||
| const GXmlElement * | datalayout, | ||
| const GXmlElement * | datafilter = NULL ) |
Read data.
| [in] | fptr | File pointer. |
| [in] | dataspace | Pointer to "Dataspace" message XML element. |
| [in] | datatype | Pointer to "Datatype" message XML element. |
| [in] | datalayout | Pointer to "DataStorageLayout" message XML element. |
| [in] | datafilter | Pointer to "DataStorageFilterPipeline" message XML element. |
| GException::invalid_argument | No "elements" attribute in dataspace No "size" attribute in datatype No "address" attribute in datalayout No "class" attribute in datalayout @excaption GException::runtime_error Attempt to read beyond end of file |
Reads entire data structure and stores the Bytes into a string.
The address from where to read the data is extracted from datalayout. The current position of the file pointer fptr is not modified by the function. The number of Bytes to read is extracted from dataspace and datatype.
If datafilter is not NULL, a data filter is applied to the data before returning them to the client.
Definition at line 3044 of file GHdf5.cpp.
References GXmlElement::attribute(), data_filter(), G_FREAD_DATA2, GXmlElement::has_attribute(), gammalib::str(), gammalib::toint(), and gammalib::toulonglong().
| std::string gammalib::hdf5::fread_data | ( | FILE * | fptr, |
| const int & | nbytes ) |
Read data from HDF5 file.
| [in] | fptr | File pointer. |
| [in] | nbytes | Number of Bytes to read (>0). |
| GException::invalid_argument | Number of Bytes not positive |
| GException::runtime_error | Attempt to read beyond end of file |
Reads nbytes from the current position of the file pointer fptr into a string.
Definition at line 2984 of file GHdf5.cpp.
References G_FREAD_DATA1, and gammalib::str().
Referenced by GHdf5::global_heap_string(), GHdf5::read_group(), and GHdf5::read_message_datatype().
| std::string gammalib::hdf5::fread_data_as_string | ( | FILE * | fptr, |
| const GXmlElement * | datatype ) |
Read data with any data type as a string.
| [in] | fptr | File pointer. |
| [in] | datatype | Datatype. |
| GException::runtime_error | Attempt reading beyond end of file |
Reads one element of any datatype and return it as a string.
Definition at line 3456 of file GHdf5.cpp.
References GXmlElement::attribute(), data_to_string(), G_FREAD_DATA_AS_STRING, gammalib::str(), and gammalib::toint().
Referenced by GHdf5::read_message_attribute(), and GHdf5::read_message_datatype().
| std::string gammalib::hdf5::fread_data_chunk | ( | FILE * | fptr, |
| const GXmlElement * | chunk, | ||
| const GXmlElement * | dataspace, | ||
| const GXmlElement * | datatype, | ||
| const GXmlElement * | datalayout, | ||
| const GXmlElement * | datafilter = NULL ) |
Read data chunk.
| [in] | fptr | File pointer. |
| [in] | chunk | Pointer to "key" XML element. |
| [in] | dataspace | Pointer to "Dataspace" message XML element. |
| [in] | datatype | Pointer to "Datatype" message XML element. |
| [in] | datalayout | Pointer to "DataStorageLayout" message XML element. |
| [in] | datafilter | Pointer to "DataStorageFilterPipeline" message XML element. |
| GException::invalid_argument | No "address" attribute in chunk key No "size" attribute in chunk key No "class" attribute in datalayout "DataStorageLayout" is not chunked |
| GException::runtime_error | Attempt to read beyond end of file |
Reads a data chunk and stores the Bytes into a string.
The address from where to read the data and the number of Bytes to read is extracted from chunk.
The current position of the file pointer fptr is not modified by the function.
If datafilter is not NULL, a data filter is applied to the data before returning them to the client.
Definition at line 3172 of file GHdf5.cpp.
References GXmlElement::attribute(), data_filter(), G_FREAD_DATA_CHUNK, GXmlElement::has_attribute(), gammalib::str(), gammalib::toint(), and gammalib::toulonglong().
| int gammalib::hdf5::fread_int | ( | FILE * | fptr, |
| const int & | nbytes ) |
Read data as integer from HDF5 file.
| [in] | fptr | File pointer. |
| [in] | nbytes | Number of Bytes to read (1...4). |
| GException::out_of_range | Number of Bytes not in valid range GException::runtime_error Attempt to read beyond end of file |
Definition at line 3256 of file GHdf5.cpp.
References G_FREAD_INT, and gammalib::str().
Referenced by GHdf5::global_heap_string(), GHdf5::read_btree_chunked(), GHdf5::read_group(), GHdf5::read_message_attribute(), GHdf5::read_message_dataspace(), GHdf5::read_message_datatype(), GHdf5::read_message_filter(), GHdf5::read_message_layout(), GHdf5::read_object_header(), GHdf5::read_object_header_message(), GHdf5::read_object_header_v1(), GHdf5::read_superblock(), and GHdf5::read_symbol_table_node().
| std::string gammalib::hdf5::fread_string | ( | FILE * | fptr, |
| const int & | nbytes ) |
Read string data from HDF5 file.
| [in] | fptr | File pointer. |
| [in] | nbytes | Number of Bytes to read (>0). |
| GException::invalid_argument | Number of Bytes not positive |
| GException::runtime_error | Attempt to read beyond end of file |
Reads a string from the current position of the file pointer fptr into a string. The method always reads nbytes from the file and advances the file pointer by that amount. If a NULL termination character is encountered the string is truncated to the segement before that character.
Definition at line 3399 of file GHdf5.cpp.
References G_FREAD_STRING, and gammalib::str().
Referenced by GHdf5::global_heap_string(), GHdf5::read_btree_chunked(), GHdf5::read_group(), GHdf5::read_message_attribute(), GHdf5::read_message_filter(), GHdf5::read_superblock(), and GHdf5::read_symbol_table_node().
| uint32_t gammalib::hdf5::fread_uint32 | ( | FILE * | fptr, |
| const int & | nbytes ) |
Read data as unsiged 32 Bit integer from HDF5 file.
| [in] | fptr | File pointer. |
| [in] | nbytes | Number of Bytes to read (1...4). |
| GException::out_of_range | Number of Bytes not in valid range GException::runtime_error Attempt to read beyond end of file |
Definition at line 3302 of file GHdf5.cpp.
References G_FREAD_UINT32, and gammalib::str().
Referenced by GHdf5::global_heap_string(), GHdf5::read_message_attribute(), GHdf5::read_superblock(), GHdf5::read_symbol_table_entry(), and GHdf5::read_symbol_table_node().
| uint64_t gammalib::hdf5::fread_uint64 | ( | FILE * | fptr, |
| const int & | nbytes ) |
Read data as unsiged 64 Bit integer from HDF5 file.
| [in] | fptr | File pointer. |
| [in] | nbytes | Number of Bytes to read (1...8). |
| GException::out_of_range | Number of Bytes not in valid range GException::runtime_error Attempt to read beyond end of file |
Definition at line 3348 of file GHdf5.cpp.
References G_FREAD_UINT64, and gammalib::str().
Referenced by GHdf5::global_heap_string(), GHdf5::read_btree_chunked(), GHdf5::read_group(), GHdf5::read_message_attribute(), GHdf5::read_message_dataspace(), GHdf5::read_message_layout(), GHdf5::read_object_header_message(), GHdf5::read_object_header_v1(), GHdf5::read_superblock(), and GHdf5::read_symbol_table_entry().
| void gammalib::hdf5::fread_zero | ( | FILE * | fptr, |
| const int & | nbytes ) |
Read zero data from HDF5 file.
| [in] | fptr | File pointer. |
| [in] | nbytes | Number of Bytes to read (>0). |
| GException::out_of_range | Number of Bytes not positive GException::runtime_error Attempt to read beyond end of file |
Definition at line 3498 of file GHdf5.cpp.
References G_FREAD_ZERO, and gammalib::str().
Referenced by GHdf5::global_heap_string(), GHdf5::read_group(), GHdf5::read_message_attribute(), GHdf5::read_message_dataspace(), GHdf5::read_message_filter(), GHdf5::read_object_header_v1(), GHdf5::read_superblock(), GHdf5::read_symbol_table_entry(), and GHdf5::read_symbol_table_node().
| bool gammalib::hdf5::xml_has_msg_attribute | ( | const GXmlElement * | header, |
| const std::string & | name, | ||
| const int & | number = 0 ) |
Checks if "Attribute" message XML element with specified name exists.
| [in] | header | Pointer to XML header element. |
| [in] | name | Name of "Attribute" message. |
| [in] | number | Number of occurences to return (0=return first occurence). |
Returns true if an "Attribute" message with name exists.
Definition at line 4261 of file GHdf5.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), GXmlElement::has_attribute(), and gammalib::number().
| bool gammalib::hdf5::xml_has_msg_type | ( | const GXmlElement * | header, |
| const std::string & | type, | ||
| const int & | number = 0 ) |
Checks if specific occurence of header message of given type exists.
| [in] | header | Pointer to XML header element. |
| [in] | type | Message type. |
| [in] | number | Occurence of message. |
Returns true if the occurence number of header message of type exists.
Definition at line 4089 of file GHdf5.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), GXmlElement::has_attribute(), and gammalib::number().
Referenced by xml_msg_datafilter(), xml_msg_datalayout(), xml_msg_dataspace(), and xml_msg_datatype().
| const GXmlElement * gammalib::hdf5::xml_msg_attribute | ( | const GXmlElement * | header, |
| const std::string & | name, | ||
| const int & | number = 0 ) |
Return "Attribute" message XML element with specified name.
| [in] | header | Pointer to XML header element. |
| [in] | name | Name of "Attribute" message. |
| [in] | number | Number of occurences to return (0=return first occurence). |
name.Returns a XML pointer to a message element of type "Attribute" and with the specified name.
If several "Attribute" messages have the same name, the first of these messages is returned.
Definition at line 4193 of file GHdf5.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_XML_MSG_ATTRIBUTE, GXmlElement::has_attribute(), gammalib::number(), and gammalib::order().
| std::string gammalib::hdf5::xml_msg_attribute | ( | const GXmlElement * | header, |
| const std::string & | name, | ||
| const std::string & | key ) |
Return "Attribute" message key value from attribute with specified name.
| [in] | header | Pointer to XML header element. |
| [in] | name | Name of "Attribute" message. |
| [in] | key | Key of "Attribute" message. |
key in "Attribute" message with name.Returns the value of an attribute key in an "Attribute" message with the specified name as a string. If the attribute or the key was not found then return an empty string.
If several "Attribute" messages have the same name and p@ key, the first corresponding value is returned.
Definition at line 4319 of file GHdf5.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), and GXmlElement::has_attribute().
| int gammalib::hdf5::xml_msg_attributes | ( | const GXmlElement * | header, |
| const std::string & | name = "" ) |
Return number of "Attribute" messages in header.
| [in] | header | Pointer to XML header element. |
| [in] | name | Name of "Attribute" message. |
Returns the number of message elements of type "Attribute" in the specified header element. If name is not empty, the method will only count the attributes of which the "name" attribute equals to name.
Definition at line 4138 of file GHdf5.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), GXmlElement::has_attribute(), and gammalib::number().
|
inline |
Return "DataStorageFilterPipeline" message XML element.
| [in] | header | Pointer to XML header element. |
Returns a XML pointer to the first header message of type "DataStorageFilterPipeline". If no "DataStorageFilterPipeline" header message exists a NULL pointer is returned.
Definition at line 319 of file GHdf5.hpp.
References xml_has_msg_type(), and xml_msg_type().
|
inline |
Return "DataStorageLayout" message XML element.
| [in] | header | Pointer to XML header element. |
Returns a XML pointer to the first header message of type "DataStorageLayout". If no "DataStorageLayout" header message exists a NULL pointer is returned.
Definition at line 298 of file GHdf5.hpp.
References xml_has_msg_type(), and xml_msg_type().
|
inline |
Return "Dataspace" message XML element.
| [in] | header | Pointer to XML header element. |
Returns a XML pointer to the first header message of type "Dataspace". If no "Dataspace" header message exists a NULL pointer is returned.
Definition at line 257 of file GHdf5.hpp.
References xml_has_msg_type(), and xml_msg_type().
|
inline |
Return "Datatype" message XML element.
| [in] | header | Pointer to XML header element. |
Returns a XML pointer to the first header message of type "Datatype". If no "Datatype" header message exists a NULL pointer is returned.
Definition at line 277 of file GHdf5.hpp.
References xml_has_msg_type(), and xml_msg_type().
| const GXmlElement * gammalib::hdf5::xml_msg_type | ( | const GXmlElement * | header, |
| const std::string & | type, | ||
| const int & | number = 0 ) |
Return specific occurence of header message of given type.
| [in] | header | Pointer to XML header element. |
| [in] | type | Message type. |
| [in] | number | Occurence of message. |
GException::invalid_value No type message found in header.
Returns a XML pointer to the ocurrence number of a message of specified type.
Definition at line 4026 of file GHdf5.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_XML_MSG_TYPE, GXmlElement::has_attribute(), gammalib::number(), and gammalib::order().
Referenced by xml_msg_datafilter(), xml_msg_datalayout(), xml_msg_dataspace(), and xml_msg_datatype().