LAL  7.5.0.1-b72065a
H5FileIOVectorHL_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 TYPEV CONCAT2(TYPE,Vector)
5 #ifndef VTYPE
6 #define VTYPE TYPEV
7 #endif
8 
9 #define WRITEFUNC CONCAT2(XLALH5FileWrite,TYPEV)
10 #define READFUNC CONCAT2(XLALH5FileRead,TYPEV)
11 #define DSETALLOCFUNC CONCAT2(XLALH5DatasetAlloc,TYPEV)
12 #define DSETREADFUNC CONCAT2(XLALH5DatasetRead,TYPEV)
13 
14 int WRITEFUNC(LALH5File *file, const char *name, VTYPE *vector)
15 {
16  LALH5Dataset *dataset;
17  if (!file || !name || !vector)
19  if (!vector->length || !vector->data)
21  dataset = DSETALLOCFUNC(file, name, vector);
22  if (!dataset)
24  XLALH5DatasetFree(dataset);
25  return 0;
26 }
27 
28 VTYPE *READFUNC(LALH5File *file, const char *dset)
29 {
30  VTYPE *vector;
31  LALH5Dataset *dataset;
32  if (!file || !dset)
34  dataset = XLALH5DatasetRead(file, dset);
35  if (!dataset)
37  vector = DSETREADFUNC(dataset);
38  XLALH5DatasetFree(dataset);
39  if (!vector)
41  return vector;
42 }
43 
44 #undef WRITEFUNC
45 #undef READFUNC
46 #undef DSETALLOCFUNC
47 #undef DSETREADFUNC
48 
49 #undef CONCAT2x
50 #undef CONCAT2
51 
52 #undef VTYPE
53 #undef TYPEV
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 READFUNC
#define VTYPE
#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