RAVE
|
Utilities for working with H5 files. More...
#include "rave_hlhdf_utilities.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include "rave_utilities.h"
#include "string.h"
#include "stdarg.h"
Classes | |
struct | RaveToHlhdfTypeMap |
Mapping between hlhdf format and rave data type. More... | |
struct | OdimVersionToStrTypeMap |
Type for keeping mapping. More... | |
Macros | |
#define | RAVEHL_GET_ATOMIC_NODEVALUE(vt, nn, ss, ot, ov) |
Quick access function for reading one atomic value from a HLHDF node. | |
#define | RAVEHL_GET_ARRAY_NODEVALUE(vt, nn, ss, ot, ov, dd) |
Quick access function for reading a simple array from a HLHDF node. | |
Functions | |
const char * | RaveHL_convertAttributeName (const char *name) |
Translates an attribute name from 2.0/2.1 ODIM into 2.2 ODIM. | |
const char * | RaveHL_convertQuantity (const char *name) |
Translates a quantity from 2.0/2.1 ODIM into 2.2 ODIM. | |
const char * | RaveHL_getOdimVersionString (RaveIO_ODIM_Version version) |
Returns the string representation of the specified odim version. | |
const char * | RaveHL_getH5RadVersionStringFromOdimVersion (RaveIO_ODIM_Version version) |
Returns the h5rad string representation of the specified odim version since we can assume that the h5rad and odim version will follow each other. | |
RaveIO_ODIM_Version | RaveHL_getOdimVersionFromString (const char *str) |
Returns the odim version for the string representation of the ODIM version. | |
RaveAttribute_t * | RaveHL_createAttribute (HL_Node *node) |
Creates a rave attribute from a HLHDF node value. | |
RaveAttribute_t * | RaveHL_getAttribute (HL_NodeList *nodelist, const char *fmt,...) |
Tries to find the node as defined by the varargs string and then create a rave attribute from it. | |
int | RaveHL_hasNodeByName (HL_NodeList *nodelist, const char *fmt,...) |
Verifies if the file contains a node with the name as specified by the variable argument list. | |
int | RaveHL_getStringValue (HL_NodeList *nodelist, char **value, const char *fmt,...) |
Gets a string value from a nodelist that is represented by a node named according to the varargs formatter string. | |
int | RaveHL_createGroup (HL_NodeList *nodelist, const char *fmt,...) |
Creates a group node in the node list. | |
int | RaveHL_createGroupUnlessExists (HL_NodeList *nodelist, const char *fmt,...) |
Creates a group node in the node list unless it already exists. | |
int | RaveHL_createStringValue (HL_NodeList *nodelist, const char *value, const char *fmt,...) |
Adds a string value to a nodelist. | |
int | RaveHL_addAttribute (HL_NodeList *nodelist, RaveAttribute_t *attribute, const char *fmt,...) |
Puts an attribute in the nodelist as a hlhdf node. | |
RaveList_t * | RaveHL_extractSubGroups (const char *attrname) |
int | RaveHL_addAttributes (HL_NodeList *nodelist, RaveObjectList_t *attributes, const char *name) |
Stores the attributes from the object into the nodelist name/how/..., name/where/... and name/what/... If the groups name/how, name/where, name/what does not exist they will be created for you. | |
int | RaveHL_createDataset (HL_NodeList *nodelist, void *data, long xsize, long ysize, RaveDataType dataType, const char *fmt,...) |
Creates a dataset with the provided 2-dimensional array. | |
int | RaveHL_addData (HL_NodeList *nodelist, void *data, long xsize, long ysize, RaveDataType dataType, const char *fmt,...) |
Adds a data field to the node list according to ODIM H5. | |
HL_FormatSpecifier | RaveHL_raveToHlhdfType (RaveDataType format) |
Translates a rave data type into a hlhdf format specifier. | |
RaveDataType | RaveHL_hlhdfToRaveType (HL_FormatSpecifier format) |
Translates a hlhdf format specified into a rave data type. | |
int | RaveHL_loadAttributesAndData (HL_NodeList *nodelist, void *object, RaveHL_attr_f attrf, RaveHL_data_f dataf, const char *fmt,...) |
Loads the attributes from the name into the RaveCoreObject. | |
Variables | |
const char * | ATTRIBUTE_NAMES_20_to_22 [][2] |
Attribute names that has to be translated when jumping from 2.0/2.1 up to 2.2. | |
const char * | QUANTITIES_20_to_22 [][2] |
Quantities that has to be translated when jumping from 2.0/2.1 to 2.2. | |
Utilities for working with H5 files.
#define RAVEHL_GET_ARRAY_NODEVALUE | ( | vt, | |
nn, | |||
ss, | |||
ot, | |||
ov, | |||
dd ) |
Quick access function for reading a simple array from a HLHDF node.
[in] | vt | - the type for the read data |
[in] | nn | - the node |
[in] | ss | - the size of the data type |
[in] | ot | - the type of the output value where assignment will be done. |
[in] | ov | - the output value |
[in] | dd | - the dimension |
#define RAVEHL_GET_ATOMIC_NODEVALUE | ( | vt, | |
nn, | |||
ss, | |||
ot, | |||
ov ) |
Quick access function for reading one atomic value from a HLHDF node.
[in] | vt | - the type for the read data |
[in] | nn | - the node |
[in] | ss | - the size of the data type |
[in] | ot | - the type of the output value where assignment will be done. |
[in] | ov | - the output value |
int RaveHL_addAttribute | ( | HL_NodeList * | nodelist, |
RaveAttribute_t * | attribute, | ||
const char * | fmt, | ||
... ) |
Puts an attribute in the nodelist as a hlhdf node.
[in] | nodelist | - the node list |
[in] | attribute | - the attribute, the name of the attribute will be used as attr-member |
[in] | fmt | - the root name, specified as a varargs |
[in] | ... | - the varargs list |
int RaveHL_addAttributes | ( | HL_NodeList * | nodelist, |
RaveObjectList_t * | attributes, | ||
const char * | name ) |
Stores the attributes from the object into the nodelist name/how/..., name/where/... and name/what/... If the groups name/how, name/where, name/what does not exist they will be created for you.
All other groups you will have to add your self.
[in] | nodelist | - the hlhdf list |
[in] | name | - the name of the object |
[in] | object | - the object to fill |
As of ODIM 2.3 we should support subgroups in how
int RaveHL_addData | ( | HL_NodeList * | nodelist, |
void * | data, | ||
long | xsize, | ||
long | ysize, | ||
RaveDataType | dataType, | ||
const char * | fmt, | ||
... ) |
Adds a data field to the node list according to ODIM H5.
If data type is UCHAR, the nessecary attributes for viewing in HdfView will also be added. The name will always be <root>/data since that is according to ODIM H5 as well.
[in] | nodelist | - the node list that should get nodes added |
[in] | data | - the array data |
[in] | xsize | - the xsize |
[in] | ysize | - the ysize |
[in] | dataType | - type of data |
[in] | fmt | - the varargs format |
[in] | ... | - the vararg list |
const char * RaveHL_convertAttributeName | ( | const char * | name | ) |
Translates an attribute name from 2.0/2.1 ODIM into 2.2 ODIM.
For example how/TXloss => how/TXlossH.
[in] | name | - name of current attribute |
const char * RaveHL_convertQuantity | ( | const char * | name | ) |
Translates a quantity from 2.0/2.1 ODIM into 2.2 ODIM.
For example VRAD => VRADH.
[in] | name | - name of current quantity |
RaveAttribute_t * RaveHL_createAttribute | ( | HL_Node * | node | ) |
Creates a rave attribute from a HLHDF node value.
Node must contain data that can be translated to long, double or strings otherwise NULL will be returned. Note, the name will not be set on the attribute and has to be set after this function has been called.
[in] | node | - the HLHDF node |
int RaveHL_createDataset | ( | HL_NodeList * | nodelist, |
void * | data, | ||
long | xsize, | ||
long | ysize, | ||
RaveDataType | dataType, | ||
const char * | fmt, | ||
... ) |
Creates a dataset with the provided 2-dimensional array.
[in] | nodelist | - the node list |
[in] | data | - the data |
[in] | xsize | - the xsize |
[in] | ysize | - the ysize |
[in] | dataType | - the type of data |
[in] | fmt | - the variable argument format |
[in] | ... | - the arguments. |
int RaveHL_createGroup | ( | HL_NodeList * | nodelist, |
const char * | fmt, | ||
... ) |
Creates a group node in the node list.
[in] | nodelist | - the node list |
[in] | fmt | - the variable argument format |
[in] | ... | - the arguments. |
int RaveHL_createGroupUnlessExists | ( | HL_NodeList * | nodelist, |
const char * | fmt, | ||
... ) |
Creates a group node in the node list unless it already exists.
[in] | nodelist | - the node list |
[in] | fmt | - the variable argument format |
[in] | ... | - the arguments. |
int RaveHL_createStringValue | ( | HL_NodeList * | nodelist, |
const char * | value, | ||
const char * | fmt, | ||
... ) |
Adds a string value to a nodelist.
[in] | nodelist | - the hlhdf node list |
[in] | value | - the string value |
[in] | fmt | - the varargs format string |
RaveAttribute_t * RaveHL_getAttribute | ( | HL_NodeList * | nodelist, |
const char * | fmt, | ||
... ) |
Tries to find the node as defined by the varargs string and then create a rave attribute from it.
[in] | nodelist | - the node list |
[in] | fmt | - the varargs format |
[in] | ... | - the varargs |
const char * RaveHL_getH5RadVersionStringFromOdimVersion | ( | RaveIO_ODIM_Version | version | ) |
Returns the h5rad string representation of the specified odim version since we can assume that the h5rad and odim version will follow each other.
[in] | version | - the ODIM version |
RaveIO_ODIM_Version RaveHL_getOdimVersionFromString | ( | const char * | str | ) |
Returns the odim version for the string representation of the ODIM version.
[in] | str | - the string representation |
const char * RaveHL_getOdimVersionString | ( | RaveIO_ODIM_Version | version | ) |
Returns the string representation of the specified odim version.
[in] | version | - the ODIM version |
int RaveHL_getStringValue | ( | HL_NodeList * | nodelist, |
char ** | value, | ||
const char * | fmt, | ||
... ) |
Gets a string value from a nodelist that is represented by a node named according to the varargs formatter string.
The returned string is pointing to internal memory in the nodelist so DO NOT FREE!!
[in] | nodelist | - the node list |
[in|out] | value - the value (Pointing to internal memory, DO NOT FREE) | |
[in] | fmt | - the varargs formatter string |
[in] | ... | - the varargs |
int RaveHL_hasNodeByName | ( | HL_NodeList * | nodelist, |
const char * | fmt, | ||
... ) |
Verifies if the file contains a node with the name as specified by the variable argument list.
[in] | nodelist | - the hlhdf nodelist |
[in] | fmt | - the variable argument format specifier |
[in] | ... | - the variable argument list |
RaveDataType RaveHL_hlhdfToRaveType | ( | HL_FormatSpecifier | format | ) |
Translates a hlhdf format specified into a rave data type.
[in] | format | - the hlhdf format specified |
int RaveHL_loadAttributesAndData | ( | HL_NodeList * | nodelist, |
void * | object, | ||
RaveHL_attr_f | attrf, | ||
RaveHL_data_f | dataf, | ||
const char * | fmt, | ||
... ) |
Loads the attributes from the name into the RaveCoreObject.
Loads the attributes from the nodelist name and calls the attrf and dataf respectively depending on what type is found.
I.e. name/how/..., name/where/... and name/what/...
[in] | nodelist | - the hlhdf list |
[in] | object | - the object to fill |
[in] | fmt | - the varargs name of the object |
[in] | ... | - the varargs |
HL_FormatSpecifier RaveHL_raveToHlhdfType | ( | RaveDataType | format | ) |
Translates a rave data type into a hlhdf format specifier.
[in] | format | - the rave data type |
const char* ATTRIBUTE_NAMES_20_to_22[][2] |
Attribute names that has to be translated when jumping from 2.0/2.1 up to 2.2.
const char* QUANTITIES_20_to_22[][2] |
Quantities that has to be translated when jumping from 2.0/2.1 to 2.2.