13 #include <lal/LALStdio.h>
14 #include <lal/LALStdlib.h>
15 #include <lal/LALString.h>
16 #include <lal/AVFactories.h>
17 #include <lal/H5FileIO.h>
22 #define UNUSED __attribute__ ((unused))
28 #pragma GCC diagnostic ignored "-Wunused-parameter"
34 #define LAL_H5_FILE_MODE_READ H5F_ACC_RDONLY
35 #define LAL_H5_FILE_MODE_WRITE H5F_ACC_TRUNC
37 struct tagLALH5Object {
45 char fname[FILENAME_MAX];
48 struct tagLALH5Dataset {
57 static hid_t XLALH5TypeEnum(
const char *
names[],
const int values[],
size_t length)
61 dtype_id = threadsafe_H5Tenum_create(H5T_NATIVE_INT);
64 for (i = 0; i < length; ++i) {
65 herr_t
status = threadsafe_H5Tenum_insert(dtype_id,
names[i], values + i);
67 threadsafe_H5Tclose(dtype_id);
75 typedef struct {
float re;
float im; } internal_float_complex_type;
76 static hid_t XLALH5TypeNativeFloatComplex(
void)
79 dtype_id = threadsafe_H5Tcreate(H5T_COMPOUND,
sizeof(internal_float_complex_type));
80 threadsafe_H5Tinsert(dtype_id,
"r", HOFFSET(internal_float_complex_type, re), H5T_NATIVE_FLOAT);
81 threadsafe_H5Tinsert(dtype_id,
"i", HOFFSET(internal_float_complex_type, im), H5T_NATIVE_FLOAT);
86 typedef struct {
double re;
double im; } internal_double_complex_type;
87 static hid_t XLALH5TypeNativeDoubleComplex(
void)
90 dtype_id = threadsafe_H5Tcreate(H5T_COMPOUND,
sizeof(internal_double_complex_type));
91 threadsafe_H5Tinsert(dtype_id,
"r", HOFFSET(internal_double_complex_type, re), H5T_NATIVE_DOUBLE);
92 threadsafe_H5Tinsert(dtype_id,
"i", HOFFSET(internal_double_complex_type, im), H5T_NATIVE_DOUBLE);
97 static hid_t XLALH5TypeNativeLIGOTimeGPS(
void)
100 hid_t int32_dtype_id;
101 int32_dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_INT);
102 threadsafe_H5Tset_size(int32_dtype_id, 4);
103 dtype_id = threadsafe_H5Tcreate(H5T_COMPOUND,
sizeof(
LIGOTimeGPS));
106 threadsafe_H5Tclose(int32_dtype_id);
111 static hid_t XLALH5TypeFromLALType(
LALTYPECODE dtype)
141 dtype_id = XLALH5TypeNativeFloatComplex();
144 dtype_id = XLALH5TypeNativeDoubleComplex();
154 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_FLOAT);
157 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_DOUBLE);
167 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_UCHAR);
170 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_UINT16);
173 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_UINT32);
176 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_UINT64);
185 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_SCHAR);
188 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_INT16);
191 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_INT32);
194 dtype_id = threadsafe_H5Tcopy(H5T_NATIVE_INT64);
206 static LALTYPECODE XLALTypeFromH5Type(hid_t dtype_id)
209 switch (threadsafe_H5Tget_class(dtype_id)) {
211 switch (threadsafe_H5Tget_sign(dtype_id)) {
219 switch (threadsafe_H5Tget_size(dtype_id)) {
239 switch (threadsafe_H5Tget_size(dtype_id)) {
258 if (threadsafe_H5Tget_nmembers(dtype_id) != 2)
262 if (threadsafe_H5Tget_member_class(dtype_id, 0) != H5T_FLOAT)
264 if (threadsafe_H5Tget_member_class(dtype_id, 1) != H5T_FLOAT)
268 s = threadsafe_H5Tget_member_name(dtype_id, 0);
276 s = threadsafe_H5Tget_member_name(dtype_id, 1);
284 switch (threadsafe_H5Tget_size(dtype_id)) {
310 char tmpfname[FILENAME_MAX];
312 if (snprintf(tmpfname,
sizeof(tmpfname),
"%s.tmp",
path) < 0)
318 file->file_id = threadsafe_H5Fcreate(tmpfname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
319 if (
file->file_id < 0) {
323 file->mode = LAL_H5_FILE_MODE_WRITE;
334 file->file_id = threadsafe_H5Fopen(
path, H5F_ACC_RDONLY, H5P_DEFAULT);
335 if (
file->file_id < 0) {
339 file->mode = LAL_H5_FILE_MODE_READ;
344 static hid_t XLALGetObjectIdentifier(
const void *ptr)
351 union {
const void *ptr;
const hid_t *hid; }
id = {ptr};
392 if (
file->is_a_group)
393 threadsafe_H5Gclose(
file->file_id);
395 if (
file->mode == LAL_H5_FILE_MODE_WRITE) {
396 char tmpfname[FILENAME_MAX];
398 namelen = threadsafe_H5Fget_name(
file->file_id, NULL, 0);
399 if (
sizeof(tmpfname) <= namelen) {
400 threadsafe_H5Fclose(
file->file_id);
404 threadsafe_H5Fget_name(
file->file_id, tmpfname,
sizeof(tmpfname));
405 threadsafe_H5Fflush(
file->file_id , H5F_SCOPE_GLOBAL);
406 if (rename(tmpfname,
file->fname) < 0) {
407 threadsafe_H5Fclose(
file->file_id);
412 threadsafe_H5Fclose(
file->file_id);
449 if (
path == NULL || mode == NULL)
451 if (strcmp(mode,
"r") == 0)
452 return XLALH5FileOpenRead(
path);
453 else if (strcmp(mode,
"w") == 0)
454 return XLALH5FileCreate(
path);
485 group->is_a_group = 1;
486 group->mode =
file->mode;
488 group->file_id =
file->file_id;
489 else if (group->mode == LAL_H5_FILE_MODE_READ)
490 group->file_id = threadsafe_H5Gopen2(
file->file_id,
name, H5P_DEFAULT);
491 else if (group->mode == LAL_H5_FILE_MODE_WRITE) {
493 gcpl = threadsafe_H5Pcreate(H5P_LINK_CREATE);
494 if (gcpl < 0 || threadsafe_H5Pset_create_intermediate_group(gcpl, 1) < 0) {
498 group->file_id = threadsafe_H5Gcreate2(
file->file_id,
name, gcpl, H5P_DEFAULT, H5P_DEFAULT);
499 threadsafe_H5Pclose(gcpl);
502 if (group->file_id < 0) {
532 if (threadsafe_H5Gget_info_by_name(
file->file_id,
name, &info, H5P_DEFAULT) < 0)
557 H5G_info_t group_info;
563 if (threadsafe_H5Gget_info(
file->file_id, &group_info) < 0)
566 for (i = 0; i < group_info.nlinks; ++i) {
568 if (threadsafe_H5Oget_info_by_idx(
file->file_id,
".", H5_INDEX_NAME, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0)
570 if (obj_info.type == H5O_TYPE_DATASET) {
574 obj_id = threadsafe_H5Oopen_by_addr(
file->file_id, obj_info.addr);
577 n = threadsafe_H5Iget_name(obj_id, NULL, 0);
579 threadsafe_H5Oclose(obj_id);
582 char dset_name[n + 1];
583 n = threadsafe_H5Iget_name(obj_id, dset_name, n + 1);
584 threadsafe_H5Oclose(obj_id);
588 if ((base = strrchr(dset_name,
'/')))
593 if (strcmp(
name, base) == 0)
623 if (threadsafe_H5Gget_objinfo(
file->file_id,
name, 0, NULL))
651 H5G_info_t group_info;
658 if (threadsafe_H5Gget_info(
file->file_id, &group_info) < 0)
661 for (i = 0; i < group_info.nlinks; ++i) {
663 if (threadsafe_H5Oget_info_by_idx(
file->file_id,
".", H5_INDEX_NAME, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0)
665 if (obj_info.type == H5O_TYPE_GROUP)
703 H5G_info_t group_info;
710 if (threadsafe_H5Gget_info(
file->file_id, &group_info) < 0)
713 for (i = 0; i < group_info.nlinks; ++i) {
715 if (threadsafe_H5Oget_info_by_idx(
file->file_id,
".", H5_INDEX_NAME, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0)
717 if (obj_info.type == H5O_TYPE_GROUP) {
718 if (num == (
size_t)pos) {
721 obj_id = threadsafe_H5Oopen_by_addr(
file->file_id, obj_info.addr);
724 n = threadsafe_H5Iget_name(obj_id,
name, size);
725 threadsafe_H5Oclose(obj_id);
754 H5G_info_t group_info;
761 if (threadsafe_H5Gget_info(
file->file_id, &group_info) < 0)
764 for (i = 0; i < group_info.nlinks; ++i) {
766 if (threadsafe_H5Oget_info_by_idx(
file->file_id,
".", H5_INDEX_NAME, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0)
768 if (obj_info.type == H5O_TYPE_DATASET)
806 H5G_info_t group_info;
813 if (threadsafe_H5Gget_info(
file->file_id, &group_info) < 0)
816 for (i = 0; i < group_info.nlinks; ++i) {
818 if (threadsafe_H5Oget_info_by_idx(
file->file_id,
".", H5_INDEX_NAME, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0)
820 if (obj_info.type == H5O_TYPE_DATASET) {
821 if (num == (
size_t)pos) {
824 obj_id = threadsafe_H5Oopen_by_addr(
file->file_id, obj_info.addr);
827 n = threadsafe_H5Iget_name(obj_id,
name, size);
828 threadsafe_H5Oclose(obj_id);
874 threadsafe_H5Gget_num_objs(
file->file_id, &ng);
880 for (i = 0; i < (int)ng; i++) {
881 otype = threadsafe_H5Gget_objtype_by_idx(
file->file_id, (
size_t)i);
882 if (otype != H5G_DATASET) {
886 char ** namelist = (
char**)
XLALMalloc((*
N) *
sizeof(*names));
888 for (i = 0; i < (int)ng; i++) {
889 otype = threadsafe_H5Gget_objtype_by_idx(
file->file_id, (
size_t)i);
890 if (otype != H5G_DATASET) {
894 ns = threadsafe_H5Gget_objname_by_idx(
file->file_id, (
size_t)i, NULL, 0) + 1;
895 namelist[i] = (
char*)
XLALMalloc(ns *
sizeof(namelist[i]));
896 threadsafe_H5Gget_objname_by_idx(
file->file_id, (
size_t)i, namelist[i], ns);
924 threadsafe_H5Tclose(dset->dtype_id);
925 threadsafe_H5Sclose(dset->space_id);
926 threadsafe_H5Dclose(dset->dataset_id);
965 if (
name == NULL ||
file == NULL || dimLength == NULL)
967 if (
file->mode != LAL_H5_FILE_MODE_WRITE)
970 namelen = strlen(
name);
971 dset =
LALCalloc(1,
sizeof(*dset) + namelen + 1);
976 dset->dtype_id = XLALH5TypeFromLALType(dtype);
977 if (dset->dtype_id < 0) {
983 dims =
LALCalloc(dimLength->length,
sizeof(*dims));
985 threadsafe_H5Tclose(dset->dtype_id);
989 for (dim = 0; dim < dimLength->length; ++dim)
990 dims[dim] = dimLength->data[dim];
993 dset->space_id = threadsafe_H5Screate_simple(dimLength->length, dims, NULL);
995 if (dset->space_id < 0) {
996 threadsafe_H5Tclose(dset->dtype_id);
1002 dset->dataset_id = threadsafe_H5Dcreate2(
file->file_id,
name, dset->dtype_id, dset->space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
1003 if (dset->dataset_id < 0) {
1004 threadsafe_H5Tclose(dset->dtype_id);
1005 threadsafe_H5Sclose(dset->space_id);
1011 snprintf(dset->name, namelen + 1,
"%s",
name);
1012 dset->parent_id =
file->file_id;
1045 hsize_t npoints = length;
1050 if (
file->mode != LAL_H5_FILE_MODE_WRITE)
1053 namelen = strlen(
name);
1054 dset =
LALCalloc(1,
sizeof(*dset) + namelen + 1);
1059 dset->dtype_id = XLALH5TypeFromLALType(dtype);
1060 if (dset->dtype_id < 0) {
1066 dset->space_id = threadsafe_H5Screate_simple(1, &npoints, NULL);
1067 if (dset->space_id < 0) {
1068 threadsafe_H5Tclose(dset->dtype_id);
1074 dset->dataset_id = threadsafe_H5Dcreate2(
file->file_id,
name, dset->dtype_id, dset->space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
1075 if (dset->dataset_id < 0) {
1076 threadsafe_H5Tclose(dset->dtype_id);
1077 threadsafe_H5Sclose(dset->space_id);
1083 snprintf(dset->name, namelen + 1,
"%s",
name);
1084 dset->parent_id =
file->file_id;
1116 hsize_t npoints = length;
1121 if (
file->mode != LAL_H5_FILE_MODE_WRITE)
1124 namelen = strlen(
name);
1125 dset =
LALCalloc(1,
sizeof(*dset) + namelen + 1);
1130 dset->dtype_id = threadsafe_H5Tcopy(H5T_C_S1);
1131 if (dset->dtype_id < 0) {
1135 if (threadsafe_H5Tset_size(dset->dtype_id, H5T_VARIABLE) < 0) {
1136 threadsafe_H5Tclose(dset->dtype_id);
1142 dset->space_id = threadsafe_H5Screate_simple(1, &npoints, NULL);
1143 if (dset->space_id < 0) {
1144 threadsafe_H5Tclose(dset->dtype_id);
1150 dset->dataset_id = threadsafe_H5Dcreate2(
file->file_id,
name, dset->dtype_id, dset->space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
1151 if (dset->dataset_id < 0) {
1152 threadsafe_H5Tclose(dset->dtype_id);
1153 threadsafe_H5Sclose(dset->space_id);
1159 snprintf(dset->name, namelen + 1,
"%s",
name);
1160 dset->parent_id =
file->file_id;
1181 if (dset == NULL || data == NULL)
1183 if (threadsafe_H5Dwrite(dset->dataset_id, dset->dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
1216 if (
file->mode != LAL_H5_FILE_MODE_READ)
1219 namelen = strlen(
name);
1220 dset =
LALCalloc(1,
sizeof(*dset) + namelen + 1);
1224 dset->dataset_id = threadsafe_H5Dopen2(
file->file_id,
name, H5P_DEFAULT);
1225 if (dset->dataset_id < 0) {
1230 dset->space_id = threadsafe_H5Dget_space(dset->dataset_id);
1231 if (dset->space_id < 0) {
1236 dtype_id = threadsafe_H5Dget_type(dset->dataset_id);
1238 threadsafe_H5Sclose(dset->space_id);
1244 dset->dtype_id = threadsafe_H5Tget_native_type(dtype_id, H5T_DIR_ASCEND);
1245 threadsafe_H5Tclose(dtype_id);
1246 if (dset->dtype_id < 0) {
1247 threadsafe_H5Sclose(dset->space_id);
1253 snprintf(dset->name, namelen + 1,
"%s",
name);
1254 dset->parent_id =
file->file_id;
1271 return threadsafe_H5Tget_class(dset->dtype_id) == H5T_STRING;
1290 npoints = threadsafe_H5Sget_simple_extent_npoints(dset->space_id);
1314 size = threadsafe_H5Tget_size(dset->dtype_id);
1318 if (npoints == (
size_t)(-1))
1320 return size * npoints;
1339 dtype = XLALTypeFromH5Type(dset->dtype_id);
1361 rank = threadsafe_H5Sget_simple_extent_ndims(dset->space_id);
1394 if (threadsafe_H5Sget_simple_extent_dims(dset->space_id, dims, NULL) < 0) {
1400 if (dimLength == NULL) {
1405 for (dim = 0; dim < rank; ++dim)
1406 dimLength->
data[dim] = dims[dim];
1415 static void *lal_malloc_hook(
size_t size,
void UNUSED *alloc_info)
1419 static void lal_free_hook(
void *mem,
void UNUSED *free_info)
1451 if (data == NULL || dset == NULL)
1458 plist = threadsafe_H5Pcreate(H5P_DATASET_XFER);
1461 if (threadsafe_H5Pset_vlen_mem_manager(plist, lal_malloc_hook, NULL, lal_free_hook, NULL) < 0) {
1462 threadsafe_H5Pclose(plist);
1466 plist = threadsafe_H5Pcopy(H5P_DEFAULT);
1470 if (threadsafe_H5Dread(dset->dataset_id, dset->dtype_id, H5S_ALL, H5S_ALL, plist, data) < 0) {
1471 threadsafe_H5Pclose(plist);
1474 threadsafe_H5Pclose(plist);
1524 H5O_info_t obj_info;
1527 obj_id =
object.generic->object_id;
1531 if (threadsafe_H5Oget_info(obj_id, &obj_info) < 0)
1534 for (i = 0; i < obj_info.num_attrs; ++i) {
1538 attr_id = threadsafe_H5Aopen_idx(obj_id, i);
1542 n = threadsafe_H5Aget_name(attr_id, 0, NULL);
1544 threadsafe_H5Aclose(attr_id);
1547 char attr_name[n + 1];
1548 n = threadsafe_H5Aget_name(attr_id, n + 1, attr_name);
1549 threadsafe_H5Aclose(attr_id);
1552 if (strcmp(
name, attr_name) == 0)
1580 H5O_info_t obj_info;
1582 obj_id =
object.generic->object_id;
1586 if (threadsafe_H5Oget_info(obj_id, &obj_info) < 0)
1589 return obj_info.num_attrs;
1628 H5O_info_t obj_info;
1631 obj_id =
object.generic->object_id;
1635 if (threadsafe_H5Oget_info(obj_id, &obj_info) < 0)
1638 if ((hsize_t)pos >= obj_info.num_attrs)
1641 attr_id = threadsafe_H5Aopen_idx(obj_id, pos);
1645 n = threadsafe_H5Aget_name(attr_id, size,
name);
1646 threadsafe_H5Aclose(attr_id);
1681 obj_id =
object.generic->object_id;
1685 dtype_id = XLALH5TypeFromLALType(dtype);
1689 space_id = threadsafe_H5Screate(H5S_SCALAR);
1691 threadsafe_H5Tclose(dtype_id);
1695 attr_id = threadsafe_H5Acreate2(obj_id, key, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1696 threadsafe_H5Sclose(space_id);
1698 threadsafe_H5Tclose(dtype_id);
1702 if (threadsafe_H5Awrite(attr_id, dtype_id, value) < 0) {
1703 threadsafe_H5Aclose(attr_id);
1704 threadsafe_H5Tclose(dtype_id);
1708 threadsafe_H5Aclose(attr_id);
1709 threadsafe_H5Tclose(dtype_id);
1737 obj_id =
object.generic->object_id;
1741 dtype_id = threadsafe_H5Tcopy(H5T_C_S1);
1744 if (threadsafe_H5Tset_size(dtype_id, H5T_VARIABLE) < 0)
1746 threadsafe_H5Tclose(dtype_id);
1750 space_id = threadsafe_H5Screate(H5S_SCALAR);
1752 threadsafe_H5Tclose(dtype_id);
1756 attr_id = threadsafe_H5Acreate2(obj_id, key, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1757 threadsafe_H5Sclose(space_id);
1759 threadsafe_H5Tclose(dtype_id);
1763 if (threadsafe_H5Awrite(attr_id, dtype_id, &value) < 0) {
1764 threadsafe_H5Aclose(attr_id);
1765 threadsafe_H5Tclose(dtype_id);
1769 threadsafe_H5Aclose(attr_id);
1770 threadsafe_H5Tclose(dtype_id);
1798 obj_id =
object.generic->object_id;
1802 dtype_id = XLALH5TypeNativeLIGOTimeGPS();
1806 space_id = threadsafe_H5Screate(H5S_SCALAR);
1808 threadsafe_H5Tclose(dtype_id);
1812 attr_id = threadsafe_H5Acreate2(obj_id, key, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1813 threadsafe_H5Sclose(space_id);
1815 threadsafe_H5Tclose(dtype_id);
1819 if (threadsafe_H5Awrite(attr_id, dtype_id, value) < 0) {
1820 threadsafe_H5Aclose(attr_id);
1821 threadsafe_H5Tclose(dtype_id);
1825 threadsafe_H5Aclose(attr_id);
1826 threadsafe_H5Tclose(dtype_id);
1856 hsize_t dims[] = {length};
1863 obj_id =
object.generic->object_id;
1867 edtype_id = XLALH5TypeEnum(enumnames, enumvals, nenum);
1871 adtype_id = threadsafe_H5Tarray_create2(edtype_id, 1, dims);
1872 threadsafe_H5Tclose(edtype_id);
1876 space_id = threadsafe_H5Screate(H5S_SCALAR);
1878 threadsafe_H5Tclose(adtype_id);
1882 attr_id = threadsafe_H5Acreate2(obj_id, key, adtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1883 threadsafe_H5Sclose(space_id);
1885 threadsafe_H5Tclose(adtype_id);
1889 if (threadsafe_H5Awrite(attr_id, adtype_id, value) < 0) {
1890 threadsafe_H5Aclose(attr_id);
1891 threadsafe_H5Tclose(adtype_id);
1895 threadsafe_H5Aclose(attr_id);
1896 threadsafe_H5Tclose(adtype_id);
1924 obj_id =
object.generic->object_id;
1928 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
1933 space_id = threadsafe_H5Aget_space(attr_id);
1935 threadsafe_H5Aclose(attr_id);
1938 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0 || threadsafe_H5Sget_simple_extent_npoints(space_id) != 1) {
1939 threadsafe_H5Sclose(space_id);
1940 threadsafe_H5Aclose(attr_id);
1944 dtype_id = threadsafe_H5Aget_type(attr_id);
1945 threadsafe_H5Aclose(attr_id);
1949 memtype_id = threadsafe_H5Tget_native_type(dtype_id, H5T_DIR_ASCEND);
1950 threadsafe_H5Tclose(dtype_id);
1954 dtype = XLALTypeFromH5Type(memtype_id);
1955 threadsafe_H5Tclose(memtype_id);
1993 obj_id =
object.generic->object_id;
1997 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2002 space_id = threadsafe_H5Aget_space(attr_id);
2004 threadsafe_H5Aclose(attr_id);
2007 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0 || threadsafe_H5Sget_simple_extent_npoints(space_id) != 1) {
2008 threadsafe_H5Sclose(space_id);
2009 threadsafe_H5Aclose(attr_id);
2012 threadsafe_H5Sclose(space_id);
2014 dtype_id = threadsafe_H5Aget_type(attr_id);
2016 threadsafe_H5Aclose(attr_id);
2020 memtype_id = threadsafe_H5Tget_native_type(dtype_id, H5T_DIR_ASCEND);
2021 threadsafe_H5Tclose(dtype_id);
2022 if (memtype_id < 0) {
2023 threadsafe_H5Aclose(attr_id);
2027 if (threadsafe_H5Aread(attr_id, memtype_id, value) < 0) {
2028 threadsafe_H5Tclose(memtype_id);
2029 threadsafe_H5Aclose(attr_id);
2033 threadsafe_H5Tclose(memtype_id);
2034 threadsafe_H5Aclose(attr_id);
2078 obj_id =
object.generic->object_id;
2082 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2087 space_id = threadsafe_H5Aget_space(attr_id);
2089 threadsafe_H5Aclose(attr_id);
2092 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0) {
2093 threadsafe_H5Sclose(space_id);
2094 threadsafe_H5Aclose(attr_id);
2098 dtype_id = threadsafe_H5Aget_type(attr_id);
2100 threadsafe_H5Sclose(space_id);
2101 threadsafe_H5Aclose(attr_id);
2104 threadsafe_H5Tclose(dtype_id);
2106 memtype_id = threadsafe_H5Tcopy(H5T_C_S1);
2107 if (memtype_id < 0 || threadsafe_H5Tset_size(memtype_id, H5T_VARIABLE)) {
2108 threadsafe_H5Sclose(space_id);
2109 threadsafe_H5Aclose(attr_id);
2113 if (threadsafe_H5Aread(attr_id, memtype_id, &str) < 0) {
2114 threadsafe_H5Tclose(memtype_id);
2115 threadsafe_H5Sclose(space_id);
2116 threadsafe_H5Aclose(attr_id);
2120 n = snprintf(value, value == NULL ? 0 : size,
"%s", str);
2122 threadsafe_H5Dvlen_reclaim(memtype_id, space_id, H5P_DEFAULT, &str);
2124 threadsafe_H5Tclose(memtype_id);
2125 threadsafe_H5Sclose(space_id);
2126 threadsafe_H5Aclose(attr_id);
2157 obj_id =
object.generic->object_id;
2161 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2166 space_id = threadsafe_H5Aget_space(attr_id);
2168 threadsafe_H5Aclose(attr_id);
2171 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0 || threadsafe_H5Sget_simple_extent_npoints(space_id) != 1) {
2172 threadsafe_H5Sclose(space_id);
2173 threadsafe_H5Aclose(attr_id);
2176 threadsafe_H5Sclose(space_id);
2180 dtype_id = threadsafe_H5Aget_type(attr_id);
2182 threadsafe_H5Aclose(attr_id);
2187 if (threadsafe_H5Tget_class(dtype_id) != H5T_COMPOUND) {
2188 threadsafe_H5Tclose(dtype_id);
2189 threadsafe_H5Aclose(attr_id);
2194 if (threadsafe_H5Tget_nmembers(dtype_id) != 2) {
2195 threadsafe_H5Tclose(dtype_id);
2196 threadsafe_H5Aclose(attr_id);
2201 if (threadsafe_H5Tget_member_class(dtype_id, 0) != H5T_INTEGER) {
2202 threadsafe_H5Tclose(dtype_id);
2203 threadsafe_H5Aclose(attr_id);
2206 if (threadsafe_H5Tget_member_class(dtype_id, 1) != H5T_INTEGER) {
2207 threadsafe_H5Tclose(dtype_id);
2208 threadsafe_H5Aclose(attr_id);
2215 s = threadsafe_H5Tget_member_name(dtype_id, 0);
2216 if (strcmp(s,
"gpsSeconds") != 0) {
2218 threadsafe_H5Tclose(dtype_id);
2219 threadsafe_H5Aclose(attr_id);
2225 s = threadsafe_H5Tget_member_name(dtype_id, 1);
2226 if (strcmp(s,
"gpsNanoSeconds") != 0) {
2228 threadsafe_H5Tclose(dtype_id);
2229 threadsafe_H5Aclose(attr_id);
2234 threadsafe_H5Tclose(dtype_id);
2236 memtype_id = XLALH5TypeNativeLIGOTimeGPS();
2237 if (memtype_id < 0) {
2238 threadsafe_H5Aclose(attr_id);
2242 if (threadsafe_H5Aread(attr_id, memtype_id, value) < 0) {
2243 threadsafe_H5Tclose(memtype_id);
2244 threadsafe_H5Aclose(attr_id);
2248 threadsafe_H5Tclose(memtype_id);
2249 threadsafe_H5Aclose(attr_id);
2270 hsize_t dims[] = {-1};
2275 obj_id =
object.generic->object_id;
2279 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2283 dtype_id = threadsafe_H5Aget_type(attr_id);
2285 threadsafe_H5Aclose(attr_id);
2290 if (threadsafe_H5Tget_class(dtype_id) != H5T_ARRAY) {
2291 threadsafe_H5Tclose(dtype_id);
2292 threadsafe_H5Aclose(attr_id);
2297 if (threadsafe_H5Tget_array_ndims(dtype_id) != 1) {
2298 threadsafe_H5Tclose(dtype_id);
2299 threadsafe_H5Aclose(attr_id);
2303 if (threadsafe_H5Tget_array_dims2(dtype_id, dims) < 0) {
2304 threadsafe_H5Tclose(dtype_id);
2305 threadsafe_H5Aclose(attr_id);
2309 threadsafe_H5Tclose(dtype_id);
2310 threadsafe_H5Aclose(attr_id);
2345 obj_id =
object.generic->object_id;
2349 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2353 dtype_id = threadsafe_H5Aget_type(attr_id);
2355 threadsafe_H5Aclose(attr_id);
2360 if (threadsafe_H5Tget_class(dtype_id) != H5T_ARRAY) {
2361 threadsafe_H5Tclose(dtype_id);
2362 threadsafe_H5Aclose(attr_id);
2367 if (threadsafe_H5Tget_array_ndims(dtype_id) != 1) {
2368 threadsafe_H5Tclose(dtype_id);
2369 threadsafe_H5Aclose(attr_id);
2373 if (threadsafe_H5Aread(attr_id, dtype_id, value) < 0) {
2374 threadsafe_H5Tclose(dtype_id);
2375 threadsafe_H5Aclose(attr_id);
2379 threadsafe_H5Tclose(dtype_id);
2380 threadsafe_H5Aclose(attr_id);
2405 H5T_class_t dtype_class;
2408 obj_id =
object.generic->object_id;
2412 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2416 dtype_id = threadsafe_H5Aget_type(attr_id);
2418 threadsafe_H5Aclose(attr_id);
2422 dtype_class = threadsafe_H5Tget_class(dtype_id);
2423 if (dtype_class == H5T_ARRAY) {
2426 super_id = threadsafe_H5Tget_super(dtype_id);
2427 threadsafe_H5Tclose(dtype_id);
2428 dtype_id = super_id;
2429 dtype_class = threadsafe_H5Tget_class(dtype_id);
2431 if (dtype_class == H5T_NO_CLASS) {
2432 threadsafe_H5Tclose(dtype_id);
2433 threadsafe_H5Aclose(attr_id);
2436 if (dtype_class != H5T_ENUM) {
2437 threadsafe_H5Tclose(dtype_id);
2438 threadsafe_H5Aclose(attr_id);
2442 nenum = threadsafe_H5Tget_nmembers(dtype_id);
2444 threadsafe_H5Tclose(dtype_id);
2445 threadsafe_H5Aclose(attr_id);
2446 XLAL_ERROR(
XLAL_EIO,
"Could not read number of enum constants of attribute `%s'", key);
2449 threadsafe_H5Tclose(dtype_id);
2450 threadsafe_H5Aclose(attr_id);
2492 H5T_class_t dtype_class;
2497 obj_id =
object.generic->object_id;
2501 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2505 dtype_id = threadsafe_H5Aget_type(attr_id);
2507 threadsafe_H5Aclose(attr_id);
2511 dtype_class = threadsafe_H5Tget_class(dtype_id);
2512 if (dtype_class == H5T_ARRAY) {
2515 super_id = threadsafe_H5Tget_super(dtype_id);
2516 threadsafe_H5Tclose(dtype_id);
2517 dtype_id = super_id;
2518 dtype_class = threadsafe_H5Tget_class(dtype_id);
2520 if (dtype_class == H5T_NO_CLASS) {
2521 threadsafe_H5Tclose(dtype_id);
2522 threadsafe_H5Aclose(attr_id);
2525 if (dtype_class != H5T_ENUM) {
2526 threadsafe_H5Tclose(dtype_id);
2527 threadsafe_H5Aclose(attr_id);
2531 nenum = threadsafe_H5Tget_nmembers(dtype_id);
2533 threadsafe_H5Tclose(dtype_id);
2534 threadsafe_H5Aclose(attr_id);
2535 XLAL_ERROR(
XLAL_EIO,
"Could not read number of enum constants of attribute `%s'", key);
2538 threadsafe_H5Tclose(dtype_id);
2539 threadsafe_H5Aclose(attr_id);
2543 s = threadsafe_H5Tget_member_name(dtype_id, pos);
2545 threadsafe_H5Tclose(dtype_id);
2546 threadsafe_H5Aclose(attr_id);
2550 n = snprintf(
name,
name == NULL ? 0 : size,
"%s", s);
2553 threadsafe_H5Tclose(dtype_id);
2554 threadsafe_H5Aclose(attr_id);
2581 H5T_class_t dtype_class;
2585 obj_id =
object.generic->object_id;
2589 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2593 dtype_id = threadsafe_H5Aget_type(attr_id);
2595 threadsafe_H5Aclose(attr_id);
2599 dtype_class = threadsafe_H5Tget_class(dtype_id);
2600 if (dtype_class == H5T_ARRAY) {
2603 super_id = threadsafe_H5Tget_super(dtype_id);
2604 threadsafe_H5Tclose(dtype_id);
2605 dtype_id = super_id;
2606 dtype_class = threadsafe_H5Tget_class(dtype_id);
2608 if (dtype_class == H5T_NO_CLASS) {
2609 threadsafe_H5Tclose(dtype_id);
2610 threadsafe_H5Aclose(attr_id);
2613 if (dtype_class != H5T_ENUM) {
2614 threadsafe_H5Tclose(dtype_id);
2615 threadsafe_H5Aclose(attr_id);
2619 nenum = threadsafe_H5Tget_nmembers(dtype_id);
2621 threadsafe_H5Tclose(dtype_id);
2622 threadsafe_H5Aclose(attr_id);
2623 XLAL_ERROR(
XLAL_EIO,
"Could not read number of enum constants of attribute `%s'", key);
2626 threadsafe_H5Tclose(dtype_id);
2627 threadsafe_H5Aclose(attr_id);
2631 if (threadsafe_H5Tget_member_value(dtype_id, pos, &val) < 0)
2633 threadsafe_H5Tclose(dtype_id);
2634 threadsafe_H5Aclose(attr_id);
2638 threadsafe_H5Tclose(dtype_id);
2639 threadsafe_H5Aclose(attr_id);
2718 na = threadsafe_H5Aget_num_attrs(
file->file_id);
2721 for (i = 0; i <na; i++) {
2722 aid = threadsafe_H5Aopen_idx(
file->file_id, (
unsigned int)i);
2723 ns = threadsafe_H5Aget_name(aid, 0, NULL) + 1;
2724 namelist[i] = (
char*)
XLALMalloc(ns *
sizeof(namelist[i]));
2725 threadsafe_H5Aget_name(aid, ns, namelist[i]);
2726 threadsafe_H5Aclose(aid);
2815 if ((
int)(dtype) < 0)
3051 if ((
int)(dtype) < 0)
3230 const size_t chunk_size = 32;
3231 hid_t dtype_id[ncols];
3238 if (
file == NULL || cols == NULL || types == NULL || offsets == NULL)
3241 if (
file->mode != LAL_H5_FILE_MODE_WRITE)
3245 for (col = 0; col < ncols; ++col) {
3246 dtype_id[col] = XLALH5TypeFromLALType(types[col]);
3247 if (dtype_id[col] < 0)
3253 status = threadsafe_H5TBmake_table(
name,
file->file_id,
name, ncols, 0, rowsz, cols, offsets, dtype_id, chunk_size, NULL, 0, NULL);
3254 for (col = 0; col < ncols; ++col)
3255 threadsafe_H5Tclose(dtype_id[col]);
3262 namelen = strlen(
name);
3263 dset =
LALCalloc(1,
sizeof(*dset) + namelen + 1);
3267 dset->dataset_id = threadsafe_H5Dopen2(
file->file_id,
name, H5P_DEFAULT);
3268 if (dset->dataset_id < 0) {
3273 dset->space_id = threadsafe_H5Dget_space(dset->dataset_id);
3274 if (dset->space_id < 0) {
3279 tdtype_id = threadsafe_H5Dget_type(dset->dataset_id);
3280 if (tdtype_id < 0) {
3281 threadsafe_H5Sclose(dset->space_id);
3287 dset->dtype_id = threadsafe_H5Tget_native_type(tdtype_id, H5T_DIR_ASCEND);
3288 threadsafe_H5Tclose(tdtype_id);
3289 if (dset->dtype_id < 0) {
3290 threadsafe_H5Sclose(dset->space_id);
3296 snprintf(dset->name, namelen + 1,
"%s",
name);
3297 dset->parent_id =
file->file_id;
3350 int XLALH5TableAppend(
LALH5Dataset UNUSED *dset,
const size_t UNUSED *offsets,
const size_t UNUSED *colsz,
size_t UNUSED nrows,
size_t UNUSED rowsz,
const void UNUSED *data)
3355 if (dset == NULL || offsets == NULL || colsz == NULL)
3358 if (threadsafe_H5TBappend_records(dset->parent_id, dset->name, nrows, rowsz, offsets, colsz, data) < 0)
3404 int XLALH5TableRead(
void UNUSED *data,
const LALH5Dataset UNUSED *dset,
const size_t UNUSED *offsets,
const size_t UNUSED *colsz,
size_t UNUSED rowsz)
3409 if (data == NULL || dset == NULL || offsets == NULL || colsz == NULL)
3412 if (threadsafe_H5TBread_table(dset->parent_id, dset->name, rowsz, offsets, colsz, data) < 0)
3461 int XLALH5TableReadRows(
void UNUSED *data,
const LALH5Dataset UNUSED *dset,
const size_t UNUSED *offsets,
const size_t UNUSED *colsz,
size_t UNUSED row0,
size_t UNUSED nrows,
size_t UNUSED rowsz)
3466 if (data == NULL || dset == NULL || offsets == NULL || colsz == NULL)
3469 if (threadsafe_H5TBread_records(dset->parent_id, dset->name, row0, nrows, rowsz, offsets, colsz, data) < 0)
3519 int XLALH5TableReadColumns(
void UNUSED *data,
const LALH5Dataset UNUSED *dset,
const char UNUSED *cols,
const size_t UNUSED *offsets,
const size_t UNUSED *colsz,
size_t UNUSED row0,
size_t UNUSED nrows,
size_t UNUSED rowsz)
3524 if (data == NULL || dset == NULL || offsets == NULL || colsz == NULL)
3527 if (threadsafe_H5TBread_fields_name(dset->parent_id, dset->name, cols, row0, nrows, rowsz, offsets, colsz, data) < 0)
3551 if (threadsafe_H5TBget_table_info(dset->parent_id, dset->name, NULL, &nrows) < 0)
3575 if (threadsafe_H5TBget_table_info(dset->parent_id, dset->name, &ncols, NULL) < 0)
3600 if (threadsafe_H5TBget_field_info(dset->parent_id, dset->name, NULL, NULL, NULL, &rowsz) < 0)
3646 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3653 col = threadsafe_H5Tget_member_name(dset->dtype_id, pos);
3657 n = snprintf(
name,
name == NULL ? 0 : size,
"%s", col);
3678 hid_t member_type_id;
3679 hid_t native_member_type_id;
3686 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3693 member_type_id = threadsafe_H5Tget_member_type(dset->dtype_id, pos);
3694 if (member_type_id < 0)
3697 native_member_type_id = threadsafe_H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT);
3698 if (native_member_type_id < 0) {
3699 threadsafe_H5Tclose(member_type_id);
3703 size = threadsafe_H5Tget_size(native_member_type_id);
3705 threadsafe_H5Tclose(native_member_type_id);
3706 threadsafe_H5Tclose(member_type_id);
3710 threadsafe_H5Tclose(native_member_type_id);
3711 threadsafe_H5Tclose(member_type_id);
3732 hid_t member_type_id;
3739 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3746 member_type_id = threadsafe_H5Tget_member_type(dset->dtype_id, pos);
3747 if (member_type_id < 0)
3750 type = XLALTypeFromH5Type(member_type_id);
3751 threadsafe_H5Tclose(member_type_id);
3780 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3788 if (threadsafe_H5Tget_member_class(dset->dtype_id, pos) < 0)
3791 offset = threadsafe_H5Tget_member_offset(dset->dtype_id, pos);
struct tagLALH5File LALH5File
Incomplete type for a HDF5 file.
struct tagLALH5Dataset LALH5Dataset
Incomplete type for a HDF5 dataset.
void XLALH5FileClose(LALH5File UNUSED *file)
Closes a LALH5File.
LALTYPECODE XLALH5AttributeQueryScalarType(const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the datatype of an attribute in a LALH5File or LALH5Dataset.
int XLALH5FileQueryGroupName(char UNUSED *name, size_t UNUSED size, const LALH5File UNUSED *file, int UNUSED pos)
Gets the name of a group contained in a LALH5File.
size_t XLALH5DatasetQueryNPoints(LALH5Dataset UNUSED *dset)
Gets the number of points in a LALH5Dataset.
void XLALH5DatasetFree(LALH5Dataset UNUSED *dset)
Frees a LALH5Dataset.
int XLALH5AttributeQueryName(char UNUSED *name, size_t UNUSED size, const LALH5Generic UNUSED object, int UNUSED pos)
Gets the name of an attribute associated with a LALH5File or LALH5Dataset.
int XLALH5CheckGroupExists(LALH5File UNUSED *file, const char UNUSED *name)
DEPRECATED: Checks for existence of a Group in a LALH5File object LALH5File.
size_t XLALH5FileQueryNDatasets(const LALH5File UNUSED *file)
Gets the number of datasets contained in a LALH5File.
LALH5Dataset * XLALH5DatasetAllocStringData(LALH5File UNUSED *file, const char UNUSED *name, size_t UNUSED length)
Allocates a variable-length string LALH5Dataset.
size_t XLALH5DatasetQueryNBytes(LALH5Dataset UNUSED *dset)
Gets the number of bytes in a LALH5Dataset.
LALH5Dataset * XLALH5DatasetAlloc(LALH5File UNUSED *file, const char UNUSED *name, LALTYPECODE UNUSED dtype, UINT4Vector UNUSED *dimLength)
Allocates a multi-dimensional LALH5Dataset.
int XLALH5AttributeAddString(LALH5Generic UNUSED object, const char UNUSED *key, const char UNUSED *value)
Adds a string attribute to a LALH5File or LALH5Dataset.
LALH5Dataset * XLALH5DatasetAlloc1D(LALH5File UNUSED *file, const char UNUSED *name, LALTYPECODE UNUSED dtype, size_t UNUSED length)
Allocates a 1-dimensional LALH5Dataset.
int XLALH5AttributeQueryEnumName(char UNUSED *name, size_t UNUSED size, const LALH5Generic UNUSED object, const char UNUSED *key, int UNUSED pos)
Gets the name of a constants in an enum type associated with an attribute in a LALH5File or LALH5Data...
UINT4Vector * XLALH5DatasetQueryDims(LALH5Dataset UNUSED *dset)
Gets the dimensions of the dataspace in a LALH5Dataset.
size_t XLALH5AttributeQueryEnumArray1DLength(const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the length of a 1D enum array attribute in a LALH5File or LALH5Dataset.
int XLALH5DatasetQueryScalarAttributeValue(void UNUSED *value, LALH5Dataset UNUSED *dset, const char UNUSED *key)
DEPRECATED: Gets the value of a scalar attribute in a LALH5Dataset.
LIGOTimeGPS * XLALH5FileQueryLIGOTimeGPSAttributeValue(LIGOTimeGPS UNUSED *value, LALH5File UNUSED *file, const char UNUSED *key)
DEPRECATED: Gets the value of a LIGOTimeGPS attribute in a LALH5File.
LALH5File * XLALH5GroupOpen(LALH5File UNUSED *file, const char UNUSED *name)
Opens a group in a LALH5File.
int XLALH5FileQueryScalarAttributeValue(void UNUSED *value, LALH5File UNUSED *file, const char UNUSED *key)
DEPRECATED: Gets the value of a scalar attribute in a LALH5File.
int XLALH5AttributeQueryStringValue(char UNUSED *value, size_t UNUSED size, const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the value of a string attribute in a LALH5File or LALH5Dataset.
int XLALH5AttributeAddLIGOTimeGPS(LALH5Generic UNUSED object, const char UNUSED *key, const LIGOTimeGPS UNUSED *value)
Adds a LIGOTimeGPS attribute to a LALH5File or LALH5Dataset.
LALTYPECODE XLALH5DatasetQueryScalarAttributeType(LALH5Dataset UNUSED *dset, const char UNUSED *key)
DEPRECATED: Gets the datatype of an attribute in a LALH5Dataset.
int XLALH5FileAddLIGOTimeGPSAttribute(LALH5File UNUSED *file, const char UNUSED *key, const LIGOTimeGPS UNUSED *value)
DEPRECATED: Adds a LIGOTimeGPS attribute to a LALH5File.
int XLALH5DatasetAddLIGOTimeGPSAttribute(LALH5Dataset UNUSED *dset, const char UNUSED *key, const LIGOTimeGPS UNUSED *value)
DEPRECATED: Adds a LIGOTimeGPS attribute to a LALH5Dataset.
int XLALH5AttributeAddEnumArray1D(LALH5Generic UNUSED object, const char UNUSED *enumnames[], const int UNUSED enumvals[], size_t UNUSED nenum, const char UNUSED *key, const int UNUSED value[], size_t UNUSED length)
Adds a 1d enum array attribute to a LALH5File or LALH5Dataset.
int XLALH5FileQueryDatasetName(char UNUSED *name, size_t UNUSED size, const LALH5File UNUSED *file, int UNUSED pos)
Gets the name of a dataset contained in a LALH5File.
LALTYPECODE XLALH5FileQueryScalarAttributeType(LALH5File UNUSED *file, const char UNUSED *key)
DEPRECATED: Gets the datatype of an attribute in a LALH5File.
int XLALH5DatasetCheckStringData(LALH5Dataset UNUSED *dset)
Checks if a LALH5Dataset contains variable length string data.
LIGOTimeGPS * XLALH5AttributeQueryLIGOTimeGPSValue(LIGOTimeGPS UNUSED *value, const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the value of a LIGOTimeGPS attribute in a LALH5File or LALH5Dataset.
int XLALH5AttributeQueryEnumValue(const LALH5Generic UNUSED object, const char UNUSED *key, int UNUSED pos)
Gets the value of a constants in an enum type associated with an attribute in a LALH5File or LALH5Dat...
int XLALH5DatasetAddStringAttribute(LALH5Dataset UNUSED *dset, const char UNUSED *key, const char UNUSED *value)
DEPRECATED: Adds a string attribute to a LALH5Dataset.
LALTYPECODE XLALH5DatasetQueryType(LALH5Dataset UNUSED *dset)
Gets the type of data in a LALH5Dataset.
int XLALH5DatasetQueryStringAttributeValue(char UNUSED *value, size_t UNUSED size, LALH5Dataset UNUSED *dset, const char UNUSED *key)
DEPRECATED: Gets the value of a string attribute in a LALH5Dataset.
int XLALH5FileAddScalarAttribute(LALH5File UNUSED *file, const char UNUSED *key, const void UNUSED *value, LALTYPECODE UNUSED dtype)
DEPRECATED: Adds a scalar attribute to a LALH5File.
int XLALH5FileCheckDatasetExists(const LALH5File UNUSED *file, const char UNUSED *name)
Checks for existence of a dataset in a LALH5File.
LALH5File * XLALH5FileOpen(const char UNUSED *path, const char UNUSED *mode)
Opens a LALH5File.
int XLALH5AttributeAddScalar(LALH5Generic UNUSED object, const char UNUSED *key, const void UNUSED *value, LALTYPECODE UNUSED dtype)
Adds a scalar attribute to a LALH5File or LALH5Dataset.
int XLALH5FileGetDatasetNames(LALH5File UNUSED *file, char UNUSED ***names, UINT4 UNUSED *N)
DEPRECATED: Gets dataset names from a LALH5File.
int XLALH5FileAddStringAttribute(LALH5File UNUSED *file, const char UNUSED *key, const char UNUSED *value)
DEPRECATED: Adds a string attribute to a LALH5File.
size_t XLALH5AttributeQueryNEnum(const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the number of constants in an enum type associated with an attribute in a LALH5File or LALH5Data...
size_t XLALH5AttributeCheckExists(const LALH5Generic UNUSED object, const char UNUSED *name)
Checks for existence of an attribute associated with a LALH5File or LALH5Dataset.
int XLALH5AttributeQueryScalarValue(void UNUSED *value, const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the value of a scalar attribute in a LALH5File or LALH5Dataset.
LALH5Dataset * XLALH5DatasetRead(LALH5File UNUSED *file, const char UNUSED *name)
Reads a LALH5Dataset.
int XLALH5FileGetAttributeNames(LALH5File UNUSED *file, char UNUSED ***names, UINT4 UNUSED *N)
DEPRECATED: Gets attribute names from a LALH5File.
int XLALH5FileCheckGroupExists(const LALH5File UNUSED *file, const char UNUSED *name)
Checks for existence of a group in a LALH5File.
int XLALH5DatasetQueryData(void UNUSED *data, LALH5Dataset UNUSED *dset)
Gets the data contained in a LALH5Dataset.
int XLALH5DatasetWrite(LALH5Dataset UNUSED *dset, void UNUSED *data)
Writes data to a LALH5Dataset.
LIGOTimeGPS * XLALH5DatasetQueryLIGOTimeGPSAttributeValue(LIGOTimeGPS UNUSED *value, LALH5Dataset UNUSED *dset, const char UNUSED *key)
DEPRECATED: Gets the value of a LIGOTimeGPS attribute in a LALH5Dataset.
size_t XLALH5AttributeQueryN(const LALH5Generic UNUSED object)
Gets the number of attributes associated with a LALH5File or LALH5Dataset.
int XLALH5DatasetQueryNDim(LALH5Dataset UNUSED *dset)
Gets the number of dimensions of the dataspace in a LALH5Dataset.
int XLALH5FileQueryStringAttributeValue(char UNUSED *value, size_t UNUSED size, LALH5File UNUSED *file, const char UNUSED *key)
DEPRECATED: Gets the value of a string attribute in a LALH5File.
int XLALH5DatasetAddScalarAttribute(LALH5Dataset UNUSED *dset, const char UNUSED *key, const void UNUSED *value, LALTYPECODE UNUSED dtype)
DEPRECATED: Adds a scalar attribute to a LALH5Dataset.
int XLALH5AttributeQueryEnumArray1DValue(int UNUSED value[], const LALH5Generic UNUSED object, const char UNUSED *key)
Gets the values in a 1D enum array attribute in a LALH5File or LALH5Dataset.
size_t XLALH5FileQueryNGroups(const LALH5File UNUSED *file)
Gets the number of groups contained in a LALH5File.
int XLALH5TableRead(void UNUSED *data, const LALH5Dataset UNUSED *dset, const size_t UNUSED *offsets, const size_t UNUSED *colsz, size_t UNUSED rowsz)
Reads table data from a LALH5Dataset.
LALTYPECODE XLALH5TableQueryColumnType(const LALH5Dataset UNUSED *dset, int UNUSED pos)
Gets the type of data stored in a column in a LALH5Dataset containing table data.
int XLALH5TableReadColumns(void UNUSED *data, const LALH5Dataset UNUSED *dset, const char UNUSED *cols, const size_t UNUSED *offsets, const size_t UNUSED *colsz, size_t UNUSED row0, size_t UNUSED nrows, size_t UNUSED rowsz)
Reads certain columns of table data from a LALH5Dataset.
size_t XLALH5TableQueryRowSize(const LALH5Dataset UNUSED *dset)
Gets the number of bytes in a row in a LALH5Dataset containing table data.
size_t XLALH5TableQueryNColumns(const LALH5Dataset UNUSED *dset)
Gets the number of columns in a LALH5Dataset containing table data.
size_t XLALH5TableQueryNRows(const LALH5Dataset UNUSED *dset)
Gets the number of rows in a LALH5Dataset containing table data.
int XLALH5TableQueryColumnName(char UNUSED *name, size_t UNUSED size, const LALH5Dataset UNUSED *dset, int UNUSED pos)
Gets the name of a column in a LALH5Dataset containing table data.
int XLALH5TableAppend(LALH5Dataset UNUSED *dset, const size_t UNUSED *offsets, const size_t UNUSED *colsz, size_t UNUSED nrows, size_t UNUSED rowsz, const void UNUSED *data)
Appends rows of data to a LALH5Dataset dataset holding a table.
int XLALH5TableReadRows(void UNUSED *data, const LALH5Dataset UNUSED *dset, const size_t UNUSED *offsets, const size_t UNUSED *colsz, size_t UNUSED row0, size_t UNUSED nrows, size_t UNUSED rowsz)
Reads certain rows of table data from a LALH5Dataset.
LALH5Dataset * XLALH5TableAlloc(LALH5File UNUSED *file, const char UNUSED *name, size_t UNUSED ncols, const char UNUSED **cols, const LALTYPECODE UNUSED *types, const size_t UNUSED *offsets, size_t UNUSED rowsz)
Allocates a LALH5Dataset dataset to hold a table.
size_t XLALH5TableQueryColumnSize(const LALH5Dataset UNUSED *dset, int UNUSED pos)
Gets the size in bytes of a column in a LALH5Dataset containing table data.
size_t XLALH5TableQueryColumnOffset(const LALH5Dataset UNUSED *dset, int UNUSED pos)
Gets the offset of the data in a column in a LALH5Dataset containing table data.
LALTYPECODE
Type codes: use these type codes to identify a LAL atomic data type, see Headers LAL(Atomic)Datatypes...
uint32_t UINT4
Four-byte unsigned integer.
@ LAL_UNSGN_TYPE_FLAG
Unsigned (vs signed) type 0100000 = 32.
@ LAL_FLTPT_TYPE_FLAG
Floating-point (vs integer) type 01000 = 8.
@ LAL_CMPLX_TYPE_FLAG
Complex (vs real) type 010000 = 16.
@ LAL_C_TYPE_CODE
COMPLEX8 type code (27)
@ LAL_CHAR_TYPE_CODE
CHAR type code (0)
@ LAL_U2_TYPE_CODE
UINT2 type code (33)
@ LAL_Z_TYPE_CODE
COMPLEX16 type code (28)
@ LAL_S_TYPE_CODE
REAL4 type code (18)
@ LAL_I2_TYPE_CODE
INT2 type code (1)
@ LAL_I8_TYPE_CODE
INT8 type code (3)
@ LAL_D_TYPE_CODE
REAL8 type code (19)
@ LAL_I4_TYPE_CODE
INT4 type code (2)
@ LAL_UCHAR_TYPE_CODE
UCHAR type code (32)
@ LAL_U8_TYPE_CODE
UINT8 type code (35)
@ LAL_U4_TYPE_CODE
UINT4 type code (34)
@ LAL_4_BYTE_TYPE_SIZE
Four byte size 010 = 2.
@ LAL_2_BYTE_TYPE_SIZE
Two byte size 01 = 1.
@ LAL_8_BYTE_TYPE_SIZE
Eight byte size 011 = 3.
@ LAL_16_BYTE_TYPE_SIZE
Sixteen byte size 0100 = 4.
@ LAL_1_BYTE_TYPE_SIZE
One byte size 00 = 0.
@ LAL_TYPE_SIZE_MASK
Type size mask 0111 = 7.
size_t XLALStringCopy(char *dst, const char *src, size_t size)
Copy sources string src to destination string dst.
int XLALStringNCaseCompare(const char *s1, const char *s2, size_t n)
Compare the first N characters of two strings, ignoring case and without using locale-dependent funct...
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
#define XLAL_ERROR_VOID(...)
Macro to invoke a failure from a XLAL routine returning void.
#define XLAL_ERROR_VAL(val,...)
Macro to invoke the XLALError() function and return with code val (it should not really be used itsel...
#define XLAL_ERROR_NULL(...)
Macro to invoke a failure from a XLAL routine returning a pointer.
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
#define XLAL_PRINT_DEPRECATION_WARNING(replacement)
Prints a deprecation warning at the "warning" verbosity level.
@ XLAL_ENOMEM
Memory allocation error.
@ XLAL_SUCCESS
Success return value (not an error number)
@ XLAL_EFAULT
Invalid pointer.
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
@ XLAL_ETYPE
Wrong or unknown type.
@ XLAL_EINVAL
Invalid argument.
@ XLAL_EFAILED
Generic failure.
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.
Vector of type UINT4, see DATATYPE-Vector types for more details.
UINT4 * data
Pointer to the data array.
Incomplete type for a pointer to an HDF5 file or group or dataset.