LAL  7.5.0.1-b72065a
H5FileIOArrayHL_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 
4 #define ATYPE CONCAT2(TYPE,Array)
5 
6 #define WRITEFUNC CONCAT2(XLALH5FileWrite,ATYPE)
7 #define READFUNC CONCAT2(XLALH5FileRead,ATYPE)
8 #define DSETALLOCFUNC CONCAT2(XLALH5DatasetAlloc,ATYPE)
9 #define DSETREADFUNC CONCAT2(XLALH5DatasetRead,ATYPE)
10 
11 int WRITEFUNC(LALH5File *file, const char *name, ATYPE *array)
12 {
13  LALH5Dataset *dataset;
14  if (!file || !name || !array)
16  if (!array->data || !array->dimLength || !array->dimLength->length || !array->dimLength->data)
18  dataset = DSETALLOCFUNC(file, name, array);
19  if (!dataset)
21  XLALH5DatasetFree(dataset);
22  return 0;
23 }
24 
25 ATYPE *READFUNC(LALH5File *file, const char *dset)
26 {
27  ATYPE *array;
28  LALH5Dataset *dataset;
29  if (!file || !dset)
31  dataset = XLALH5DatasetRead(file, dset);
32  if (!dataset)
34  array = DSETREADFUNC(dataset);
35  XLALH5DatasetFree(dataset);
36  if (!array)
38  return array;
39 }
40 
41 #undef WRITEFUNC
42 #undef READFUNC
43 #undef DSETALLOCFUNC
44 #undef DSETREADFUNC
45 
46 #undef CONCAT2x
47 #undef CONCAT2
48 
49 #undef ATYPE
LALH5Dataset * XLALH5DatasetRead(LALH5File *file, const char *name)
struct tagLALH5File LALH5File
Incomplete type for a HDF5 file.
Definition: H5FileIO.h:93
struct tagLALH5Dataset LALH5Dataset
Incomplete type for a HDF5 dataset.
Definition: H5FileIO.h:102
void XLALH5DatasetFree(LALH5Dataset *dset)
#define DSETREADFUNC
#define WRITEFUNC
#define ATYPE
#define READFUNC
#define DSETALLOCFUNC
const char *const name
type name
Definition: UserInput.c:193
#define XLAL_ERROR_NULL(...)
Macro to invoke a failure from a XLAL routine returning a pointer.
Definition: XLALError.h:713
#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_EINVAL
Invalid argument.
Definition: XLALError.h:409