LAL  7.5.0.1-b72065a
H5FileIOScalar_source.c
Go to the documentation of this file.
1 #define CONCAT2x(a,b) a##b
2 #define CONCAT2(a,b) CONCAT2x(a,b)
3 #define CONCAT3x(a,b,c) a##b##c
4 #define CONCAT3(a,b,c) CONCAT3x(a,b,c)
5 
6 #define TCODE CONCAT3(LAL_,TYPECODE,_TYPE_CODE)
7 #define ADDFUNC CONCAT3(XLALH5DatasetAdd,TYPE,Attribute)
8 #define QUERYFUNC CONCAT3(XLALH5DatasetQuery,TYPE,AttributeValue)
9 
10 
11 int ADDFUNC(LALH5Dataset *dset, const char *key, TYPE value)
12 {
13  if (!dset || !key)
15  return XLALH5AttributeAddScalar((LALH5Generic)dset, key, &value, TCODE);
16 }
17 
18 TYPE QUERYFUNC(LALH5Dataset *dset, const char *key)
19 {
20  LALTYPECODE type;
21  TYPE value;
22  if (!dset || !key)
25  if (type != TCODE)
27  if (XLALH5AttributeQueryScalarValue(&value, (LALH5Generic)dset, key) < 0)
29  return value;
30 }
31 
32 #undef CONCAT2x
33 #undef CONCAT2
34 #undef CONCAT3x
35 #undef CONCAT3
36 
37 #undef TCODE
38 
39 #undef ADDFUNC
40 #undef QUERYFUNC
#define TYPE
int XLALH5AttributeQueryScalarValue(void *value, const LALH5Generic object, const char *key)
struct tagLALH5Dataset LALH5Dataset
Incomplete type for a HDF5 dataset.
Definition: H5FileIO.h:102
int XLALH5AttributeAddScalar(LALH5Generic object, const char *key, const void *value, LALTYPECODE dtype)
LALTYPECODE XLALH5AttributeQueryScalarType(const LALH5Generic object, const char *key)
#define FAILVAL
#define TCODE
#define QUERYFUNC
#define ADDFUNC
LALTYPECODE
Type codes: use these type codes to identify a LAL atomic data type, see Headers LAL(Atomic)Datatypes...
Definition: LALDatatypes.h:49
#define XLAL_ERROR_VAL(val,...)
Macro to invoke the XLALError() function and return with code val (it should not really be used itsel...
Definition: XLALError.h:687
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
Definition: XLALError.h:700
@ XLAL_EFAULT
Invalid pointer.
Definition: XLALError.h:408
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
Definition: XLALError.h:462
@ XLAL_ETYPE
Wrong or unknown type.
Definition: XLALError.h:422
Incomplete type for a pointer to an HDF5 file or group or dataset.
Definition: H5FileIO.h:110