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
37struct tagLALH5Object {
45 char fname[FILENAME_MAX];
48struct tagLALH5Dataset {
57static 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);
75typedef struct {
float re;
float im; } internal_float_complex_type;
76static 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);
86typedef struct {
double re;
double im; } internal_double_complex_type;
87static 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);
97static 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);
111static 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);
206static 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;
344static 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;
1272 retval = threadsafe_H5Tget_class(dset->dtype_id);
1274 if (retval == H5T_STRING) {
1275 retval = threadsafe_H5Tis_variable_str(dset->dtype_id);
1278 retval = threadsafe_H5Tget_strpad(dset->dtype_id);
1280 if (retval == H5T_STR_NULLTERM)
1301 retval = threadsafe_H5Tget_class(dset->dtype_id);
1303 if (retval == H5T_STRING) {
1304 retval = threadsafe_H5Tis_variable_str(dset->dtype_id);
1307 retval = threadsafe_H5Tget_strpad(dset->dtype_id);
1310 case H5T_STR_NULLTERM:
1311 case H5T_STR_NULLPAD:
1337 npoints = threadsafe_H5Sget_simple_extent_npoints(dset->space_id);
1361 size = threadsafe_H5Tget_size(dset->dtype_id);
1365 if (npoints == (
size_t)(-1))
1367 return size * npoints;
1386 dtype = XLALTypeFromH5Type(dset->dtype_id);
1408 rank = threadsafe_H5Sget_simple_extent_ndims(dset->space_id);
1441 if (threadsafe_H5Sget_simple_extent_dims(dset->space_id, dims, NULL) < 0) {
1447 if (dimLength == NULL) {
1452 for (dim = 0; dim < rank; ++dim)
1453 dimLength->
data[dim] = dims[dim];
1462static void *lal_malloc_hook(
size_t size,
void UNUSED *alloc_info)
1466static void lal_free_hook(
void *mem,
void UNUSED *free_info)
1498 if (data == NULL || dset == NULL)
1505 plist = threadsafe_H5Pcreate(H5P_DATASET_XFER);
1508 if (threadsafe_H5Pset_vlen_mem_manager(plist, lal_malloc_hook, NULL, lal_free_hook, NULL) < 0) {
1509 threadsafe_H5Pclose(plist);
1513 plist = threadsafe_H5Pcopy(H5P_DEFAULT);
1517 if (threadsafe_H5Dread(dset->dataset_id, dset->dtype_id, H5S_ALL, H5S_ALL, plist, data) < 0) {
1518 threadsafe_H5Pclose(plist);
1521 threadsafe_H5Pclose(plist);
1571 H5O_info_t obj_info;
1574 obj_id =
object.generic->object_id;
1578 if (threadsafe_H5Oget_info(obj_id, &obj_info) < 0)
1581 for (i = 0; i < obj_info.num_attrs; ++i) {
1585 attr_id = threadsafe_H5Aopen_idx(obj_id, i);
1589 n = threadsafe_H5Aget_name(attr_id, 0, NULL);
1591 threadsafe_H5Aclose(attr_id);
1594 char attr_name[n + 1];
1595 n = threadsafe_H5Aget_name(attr_id, n + 1, attr_name);
1596 threadsafe_H5Aclose(attr_id);
1599 if (strcmp(
name, attr_name) == 0)
1627 H5O_info_t obj_info;
1629 obj_id =
object.generic->object_id;
1633 if (threadsafe_H5Oget_info(obj_id, &obj_info) < 0)
1636 return obj_info.num_attrs;
1675 H5O_info_t obj_info;
1678 obj_id =
object.generic->object_id;
1682 if (threadsafe_H5Oget_info(obj_id, &obj_info) < 0)
1685 if ((hsize_t)pos >= obj_info.num_attrs)
1688 attr_id = threadsafe_H5Aopen_idx(obj_id, pos);
1692 n = threadsafe_H5Aget_name(attr_id, size,
name);
1693 threadsafe_H5Aclose(attr_id);
1728 obj_id =
object.generic->object_id;
1732 dtype_id = XLALH5TypeFromLALType(dtype);
1736 space_id = threadsafe_H5Screate(H5S_SCALAR);
1738 threadsafe_H5Tclose(dtype_id);
1742 attr_id = threadsafe_H5Acreate2(obj_id, key, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1743 threadsafe_H5Sclose(space_id);
1745 threadsafe_H5Tclose(dtype_id);
1749 if (threadsafe_H5Awrite(attr_id, dtype_id, value) < 0) {
1750 threadsafe_H5Aclose(attr_id);
1751 threadsafe_H5Tclose(dtype_id);
1755 threadsafe_H5Aclose(attr_id);
1756 threadsafe_H5Tclose(dtype_id);
1784 obj_id =
object.generic->object_id;
1788 dtype_id = threadsafe_H5Tcopy(H5T_C_S1);
1791 if (threadsafe_H5Tset_size(dtype_id, H5T_VARIABLE) < 0)
1793 threadsafe_H5Tclose(dtype_id);
1797 space_id = threadsafe_H5Screate(H5S_SCALAR);
1799 threadsafe_H5Tclose(dtype_id);
1803 attr_id = threadsafe_H5Acreate2(obj_id, key, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1804 threadsafe_H5Sclose(space_id);
1806 threadsafe_H5Tclose(dtype_id);
1810 if (threadsafe_H5Awrite(attr_id, dtype_id, &value) < 0) {
1811 threadsafe_H5Aclose(attr_id);
1812 threadsafe_H5Tclose(dtype_id);
1816 threadsafe_H5Aclose(attr_id);
1817 threadsafe_H5Tclose(dtype_id);
1845 obj_id =
object.generic->object_id;
1849 dtype_id = XLALH5TypeNativeLIGOTimeGPS();
1853 space_id = threadsafe_H5Screate(H5S_SCALAR);
1855 threadsafe_H5Tclose(dtype_id);
1859 attr_id = threadsafe_H5Acreate2(obj_id, key, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1860 threadsafe_H5Sclose(space_id);
1862 threadsafe_H5Tclose(dtype_id);
1866 if (threadsafe_H5Awrite(attr_id, dtype_id, value) < 0) {
1867 threadsafe_H5Aclose(attr_id);
1868 threadsafe_H5Tclose(dtype_id);
1872 threadsafe_H5Aclose(attr_id);
1873 threadsafe_H5Tclose(dtype_id);
1903 hsize_t dims[] = {length};
1910 obj_id =
object.generic->object_id;
1914 edtype_id = XLALH5TypeEnum(enumnames, enumvals, nenum);
1918 adtype_id = threadsafe_H5Tarray_create2(edtype_id, 1, dims);
1919 threadsafe_H5Tclose(edtype_id);
1923 space_id = threadsafe_H5Screate(H5S_SCALAR);
1925 threadsafe_H5Tclose(adtype_id);
1929 attr_id = threadsafe_H5Acreate2(obj_id, key, adtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
1930 threadsafe_H5Sclose(space_id);
1932 threadsafe_H5Tclose(adtype_id);
1936 if (threadsafe_H5Awrite(attr_id, adtype_id, value) < 0) {
1937 threadsafe_H5Aclose(attr_id);
1938 threadsafe_H5Tclose(adtype_id);
1942 threadsafe_H5Aclose(attr_id);
1943 threadsafe_H5Tclose(adtype_id);
1971 obj_id =
object.generic->object_id;
1975 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
1980 space_id = threadsafe_H5Aget_space(attr_id);
1982 threadsafe_H5Aclose(attr_id);
1985 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0 || threadsafe_H5Sget_simple_extent_npoints(space_id) != 1) {
1986 threadsafe_H5Sclose(space_id);
1987 threadsafe_H5Aclose(attr_id);
1991 dtype_id = threadsafe_H5Aget_type(attr_id);
1992 threadsafe_H5Aclose(attr_id);
1996 memtype_id = threadsafe_H5Tget_native_type(dtype_id, H5T_DIR_ASCEND);
1997 threadsafe_H5Tclose(dtype_id);
2001 dtype = XLALTypeFromH5Type(memtype_id);
2002 threadsafe_H5Tclose(memtype_id);
2040 obj_id =
object.generic->object_id;
2044 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2049 space_id = threadsafe_H5Aget_space(attr_id);
2051 threadsafe_H5Aclose(attr_id);
2054 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0 || threadsafe_H5Sget_simple_extent_npoints(space_id) != 1) {
2055 threadsafe_H5Sclose(space_id);
2056 threadsafe_H5Aclose(attr_id);
2059 threadsafe_H5Sclose(space_id);
2061 dtype_id = threadsafe_H5Aget_type(attr_id);
2063 threadsafe_H5Aclose(attr_id);
2067 memtype_id = threadsafe_H5Tget_native_type(dtype_id, H5T_DIR_ASCEND);
2068 threadsafe_H5Tclose(dtype_id);
2069 if (memtype_id < 0) {
2070 threadsafe_H5Aclose(attr_id);
2074 if (threadsafe_H5Aread(attr_id, memtype_id, value) < 0) {
2075 threadsafe_H5Tclose(memtype_id);
2076 threadsafe_H5Aclose(attr_id);
2080 threadsafe_H5Tclose(memtype_id);
2081 threadsafe_H5Aclose(attr_id);
2128 obj_id =
object.generic->object_id;
2132 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2137 space_id = threadsafe_H5Aget_space(attr_id);
2139 threadsafe_H5Aclose(attr_id);
2142 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0) {
2143 threadsafe_H5Sclose(space_id);
2144 threadsafe_H5Aclose(attr_id);
2148 dtype_id = threadsafe_H5Aget_type(attr_id);
2150 threadsafe_H5Sclose(space_id);
2151 threadsafe_H5Aclose(attr_id);
2155 if (threadsafe_H5Tget_class(dtype_id) != H5T_STRING) {
2156 threadsafe_H5Tclose(dtype_id);
2157 threadsafe_H5Sclose(space_id);
2158 threadsafe_H5Aclose(attr_id);
2163 cset = threadsafe_H5Tget_cset(dtype_id);
2165 threadsafe_H5Tclose(dtype_id);
2166 threadsafe_H5Sclose(space_id);
2167 threadsafe_H5Aclose(attr_id);
2171 vlen = threadsafe_H5Tis_variable_str(dtype_id);
2173 threadsafe_H5Tclose(dtype_id);
2174 threadsafe_H5Sclose(space_id);
2175 threadsafe_H5Aclose(attr_id);
2176 XLAL_ERROR(
XLAL_EIO,
"Could not determine if attribute `%s' is a variable length string", key);
2180 dtype_size = H5T_VARIABLE;
2182 dtype_size = H5Tget_size(dtype_id);
2186 threadsafe_H5Tclose(dtype_id);
2188 memtype_id = threadsafe_H5Tcopy(H5T_C_S1);
2189 if (memtype_id < 0 || threadsafe_H5Tset_size(memtype_id, dtype_size)) {
2190 threadsafe_H5Sclose(space_id);
2191 threadsafe_H5Aclose(attr_id);
2196 if (threadsafe_H5Tset_cset(memtype_id, cset) < 0) {
2197 threadsafe_H5Tclose(memtype_id);
2198 threadsafe_H5Sclose(space_id);
2199 threadsafe_H5Aclose(attr_id);
2204 if (threadsafe_H5Aread(attr_id, memtype_id, &str) < 0) {
2205 threadsafe_H5Tclose(memtype_id);
2206 threadsafe_H5Sclose(space_id);
2207 threadsafe_H5Aclose(attr_id);
2210 n = snprintf(value, value == NULL ? 0 : size,
"%s", str);
2211 threadsafe_H5Dvlen_reclaim(memtype_id, space_id, H5P_DEFAULT, &str);
2214 if (threadsafe_H5Aread(attr_id, memtype_id, str) < 0) {
2216 threadsafe_H5Tclose(memtype_id);
2217 threadsafe_H5Sclose(space_id);
2218 threadsafe_H5Aclose(attr_id);
2221 n = snprintf(value, value == NULL ? 0 : size,
"%s", str);
2225 threadsafe_H5Tclose(memtype_id);
2226 threadsafe_H5Sclose(space_id);
2227 threadsafe_H5Aclose(attr_id);
2258 obj_id =
object.generic->object_id;
2262 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2267 space_id = threadsafe_H5Aget_space(attr_id);
2269 threadsafe_H5Aclose(attr_id);
2272 if (threadsafe_H5Sget_simple_extent_ndims(space_id) != 0 || threadsafe_H5Sget_simple_extent_npoints(space_id) != 1) {
2273 threadsafe_H5Sclose(space_id);
2274 threadsafe_H5Aclose(attr_id);
2277 threadsafe_H5Sclose(space_id);
2281 dtype_id = threadsafe_H5Aget_type(attr_id);
2283 threadsafe_H5Aclose(attr_id);
2288 if (threadsafe_H5Tget_class(dtype_id) != H5T_COMPOUND) {
2289 threadsafe_H5Tclose(dtype_id);
2290 threadsafe_H5Aclose(attr_id);
2295 if (threadsafe_H5Tget_nmembers(dtype_id) != 2) {
2296 threadsafe_H5Tclose(dtype_id);
2297 threadsafe_H5Aclose(attr_id);
2302 if (threadsafe_H5Tget_member_class(dtype_id, 0) != H5T_INTEGER) {
2303 threadsafe_H5Tclose(dtype_id);
2304 threadsafe_H5Aclose(attr_id);
2307 if (threadsafe_H5Tget_member_class(dtype_id, 1) != H5T_INTEGER) {
2308 threadsafe_H5Tclose(dtype_id);
2309 threadsafe_H5Aclose(attr_id);
2316 s = threadsafe_H5Tget_member_name(dtype_id, 0);
2317 if (strcmp(s,
"gpsSeconds") != 0) {
2319 threadsafe_H5Tclose(dtype_id);
2320 threadsafe_H5Aclose(attr_id);
2326 s = threadsafe_H5Tget_member_name(dtype_id, 1);
2327 if (strcmp(s,
"gpsNanoSeconds") != 0) {
2329 threadsafe_H5Tclose(dtype_id);
2330 threadsafe_H5Aclose(attr_id);
2335 threadsafe_H5Tclose(dtype_id);
2337 memtype_id = XLALH5TypeNativeLIGOTimeGPS();
2338 if (memtype_id < 0) {
2339 threadsafe_H5Aclose(attr_id);
2343 if (threadsafe_H5Aread(attr_id, memtype_id, value) < 0) {
2344 threadsafe_H5Tclose(memtype_id);
2345 threadsafe_H5Aclose(attr_id);
2349 threadsafe_H5Tclose(memtype_id);
2350 threadsafe_H5Aclose(attr_id);
2371 hsize_t dims[] = {-1};
2376 obj_id =
object.generic->object_id;
2380 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2384 dtype_id = threadsafe_H5Aget_type(attr_id);
2386 threadsafe_H5Aclose(attr_id);
2391 if (threadsafe_H5Tget_class(dtype_id) != H5T_ARRAY) {
2392 threadsafe_H5Tclose(dtype_id);
2393 threadsafe_H5Aclose(attr_id);
2398 if (threadsafe_H5Tget_array_ndims(dtype_id) != 1) {
2399 threadsafe_H5Tclose(dtype_id);
2400 threadsafe_H5Aclose(attr_id);
2404 if (threadsafe_H5Tget_array_dims2(dtype_id, dims) < 0) {
2405 threadsafe_H5Tclose(dtype_id);
2406 threadsafe_H5Aclose(attr_id);
2410 threadsafe_H5Tclose(dtype_id);
2411 threadsafe_H5Aclose(attr_id);
2446 obj_id =
object.generic->object_id;
2450 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2454 dtype_id = threadsafe_H5Aget_type(attr_id);
2456 threadsafe_H5Aclose(attr_id);
2461 if (threadsafe_H5Tget_class(dtype_id) != H5T_ARRAY) {
2462 threadsafe_H5Tclose(dtype_id);
2463 threadsafe_H5Aclose(attr_id);
2468 if (threadsafe_H5Tget_array_ndims(dtype_id) != 1) {
2469 threadsafe_H5Tclose(dtype_id);
2470 threadsafe_H5Aclose(attr_id);
2474 if (threadsafe_H5Aread(attr_id, dtype_id, value) < 0) {
2475 threadsafe_H5Tclose(dtype_id);
2476 threadsafe_H5Aclose(attr_id);
2480 threadsafe_H5Tclose(dtype_id);
2481 threadsafe_H5Aclose(attr_id);
2506 H5T_class_t dtype_class;
2509 obj_id =
object.generic->object_id;
2513 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2517 dtype_id = threadsafe_H5Aget_type(attr_id);
2519 threadsafe_H5Aclose(attr_id);
2523 dtype_class = threadsafe_H5Tget_class(dtype_id);
2524 if (dtype_class == H5T_ARRAY) {
2527 super_id = threadsafe_H5Tget_super(dtype_id);
2528 threadsafe_H5Tclose(dtype_id);
2529 dtype_id = super_id;
2530 dtype_class = threadsafe_H5Tget_class(dtype_id);
2532 if (dtype_class == H5T_NO_CLASS) {
2533 threadsafe_H5Tclose(dtype_id);
2534 threadsafe_H5Aclose(attr_id);
2537 if (dtype_class != H5T_ENUM) {
2538 threadsafe_H5Tclose(dtype_id);
2539 threadsafe_H5Aclose(attr_id);
2543 nenum = threadsafe_H5Tget_nmembers(dtype_id);
2545 threadsafe_H5Tclose(dtype_id);
2546 threadsafe_H5Aclose(attr_id);
2547 XLAL_ERROR(
XLAL_EIO,
"Could not read number of enum constants of attribute `%s'", key);
2550 threadsafe_H5Tclose(dtype_id);
2551 threadsafe_H5Aclose(attr_id);
2593 H5T_class_t dtype_class;
2598 obj_id =
object.generic->object_id;
2602 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2606 dtype_id = threadsafe_H5Aget_type(attr_id);
2608 threadsafe_H5Aclose(attr_id);
2612 dtype_class = threadsafe_H5Tget_class(dtype_id);
2613 if (dtype_class == H5T_ARRAY) {
2616 super_id = threadsafe_H5Tget_super(dtype_id);
2617 threadsafe_H5Tclose(dtype_id);
2618 dtype_id = super_id;
2619 dtype_class = threadsafe_H5Tget_class(dtype_id);
2621 if (dtype_class == H5T_NO_CLASS) {
2622 threadsafe_H5Tclose(dtype_id);
2623 threadsafe_H5Aclose(attr_id);
2626 if (dtype_class != H5T_ENUM) {
2627 threadsafe_H5Tclose(dtype_id);
2628 threadsafe_H5Aclose(attr_id);
2632 nenum = threadsafe_H5Tget_nmembers(dtype_id);
2634 threadsafe_H5Tclose(dtype_id);
2635 threadsafe_H5Aclose(attr_id);
2636 XLAL_ERROR(
XLAL_EIO,
"Could not read number of enum constants of attribute `%s'", key);
2639 threadsafe_H5Tclose(dtype_id);
2640 threadsafe_H5Aclose(attr_id);
2644 s = threadsafe_H5Tget_member_name(dtype_id, pos);
2646 threadsafe_H5Tclose(dtype_id);
2647 threadsafe_H5Aclose(attr_id);
2651 n = snprintf(
name,
name == NULL ? 0 : size,
"%s", s);
2654 threadsafe_H5Tclose(dtype_id);
2655 threadsafe_H5Aclose(attr_id);
2682 H5T_class_t dtype_class;
2686 obj_id =
object.generic->object_id;
2690 attr_id = threadsafe_H5Aopen(obj_id, key, H5P_DEFAULT);
2694 dtype_id = threadsafe_H5Aget_type(attr_id);
2696 threadsafe_H5Aclose(attr_id);
2700 dtype_class = threadsafe_H5Tget_class(dtype_id);
2701 if (dtype_class == H5T_ARRAY) {
2704 super_id = threadsafe_H5Tget_super(dtype_id);
2705 threadsafe_H5Tclose(dtype_id);
2706 dtype_id = super_id;
2707 dtype_class = threadsafe_H5Tget_class(dtype_id);
2709 if (dtype_class == H5T_NO_CLASS) {
2710 threadsafe_H5Tclose(dtype_id);
2711 threadsafe_H5Aclose(attr_id);
2714 if (dtype_class != H5T_ENUM) {
2715 threadsafe_H5Tclose(dtype_id);
2716 threadsafe_H5Aclose(attr_id);
2720 nenum = threadsafe_H5Tget_nmembers(dtype_id);
2722 threadsafe_H5Tclose(dtype_id);
2723 threadsafe_H5Aclose(attr_id);
2724 XLAL_ERROR(
XLAL_EIO,
"Could not read number of enum constants of attribute `%s'", key);
2727 threadsafe_H5Tclose(dtype_id);
2728 threadsafe_H5Aclose(attr_id);
2732 if (threadsafe_H5Tget_member_value(dtype_id, pos, &val) < 0)
2734 threadsafe_H5Tclose(dtype_id);
2735 threadsafe_H5Aclose(attr_id);
2739 threadsafe_H5Tclose(dtype_id);
2740 threadsafe_H5Aclose(attr_id);
2819 na = threadsafe_H5Aget_num_attrs(
file->file_id);
2822 for (i = 0; i <na; i++) {
2823 aid = threadsafe_H5Aopen_idx(
file->file_id, (
unsigned int)i);
2824 ns = threadsafe_H5Aget_name(aid, 0, NULL) + 1;
2825 namelist[i] = (
char*)
XLALMalloc(ns *
sizeof(namelist[i]));
2826 threadsafe_H5Aget_name(aid, ns, namelist[i]);
2827 threadsafe_H5Aclose(aid);
2916 if ((
int)(dtype) < 0)
3152 if ((
int)(dtype) < 0)
3331 const size_t chunk_size = 32;
3332 hid_t dtype_id[ncols];
3339 if (
file == NULL || cols == NULL || types == NULL || offsets == NULL)
3342 if (
file->mode != LAL_H5_FILE_MODE_WRITE)
3346 for (col = 0; col < ncols; ++col) {
3347 dtype_id[col] = XLALH5TypeFromLALType(types[col]);
3348 if (dtype_id[col] < 0)
3354 status = threadsafe_H5TBmake_table(
name,
file->file_id,
name, ncols, 0, rowsz, cols, offsets, dtype_id, chunk_size, NULL, 0, NULL);
3355 for (col = 0; col < ncols; ++col)
3356 threadsafe_H5Tclose(dtype_id[col]);
3363 namelen = strlen(
name);
3364 dset =
LALCalloc(1,
sizeof(*dset) + namelen + 1);
3368 dset->dataset_id = threadsafe_H5Dopen2(
file->file_id,
name, H5P_DEFAULT);
3369 if (dset->dataset_id < 0) {
3374 dset->space_id = threadsafe_H5Dget_space(dset->dataset_id);
3375 if (dset->space_id < 0) {
3380 tdtype_id = threadsafe_H5Dget_type(dset->dataset_id);
3381 if (tdtype_id < 0) {
3382 threadsafe_H5Sclose(dset->space_id);
3388 dset->dtype_id = threadsafe_H5Tget_native_type(tdtype_id, H5T_DIR_ASCEND);
3389 threadsafe_H5Tclose(tdtype_id);
3390 if (dset->dtype_id < 0) {
3391 threadsafe_H5Sclose(dset->space_id);
3397 snprintf(dset->name, namelen + 1,
"%s",
name);
3398 dset->parent_id =
file->file_id;
3451int 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)
3456 if (dset == NULL || offsets == NULL || colsz == NULL)
3459 if (threadsafe_H5TBappend_records(dset->parent_id, dset->name, nrows, rowsz, offsets, colsz, data) < 0)
3510 if (data == NULL || dset == NULL || offsets == NULL || colsz == NULL)
3513 if (threadsafe_H5TBread_table(dset->parent_id, dset->name, rowsz, offsets, colsz, data) < 0)
3562int 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)
3567 if (data == NULL || dset == NULL || offsets == NULL || colsz == NULL)
3570 if (threadsafe_H5TBread_records(dset->parent_id, dset->name, row0, nrows, rowsz, offsets, colsz, data) < 0)
3620int 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)
3625 if (data == NULL || dset == NULL || offsets == NULL || colsz == NULL)
3628 if (threadsafe_H5TBread_fields_name(dset->parent_id, dset->name, cols, row0, nrows, rowsz, offsets, colsz, data) < 0)
3652 if (threadsafe_H5TBget_table_info(dset->parent_id, dset->name, NULL, &nrows) < 0)
3676 if (threadsafe_H5TBget_table_info(dset->parent_id, dset->name, &ncols, NULL) < 0)
3701 if (threadsafe_H5TBget_field_info(dset->parent_id, dset->name, NULL, NULL, NULL, &rowsz) < 0)
3747 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3754 col = threadsafe_H5Tget_member_name(dset->dtype_id, pos);
3758 n = snprintf(
name,
name == NULL ? 0 : size,
"%s", col);
3779 hid_t member_type_id;
3780 hid_t native_member_type_id;
3787 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3794 member_type_id = threadsafe_H5Tget_member_type(dset->dtype_id, pos);
3795 if (member_type_id < 0)
3798 native_member_type_id = threadsafe_H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT);
3799 if (native_member_type_id < 0) {
3800 threadsafe_H5Tclose(member_type_id);
3804 size = threadsafe_H5Tget_size(native_member_type_id);
3806 threadsafe_H5Tclose(native_member_type_id);
3807 threadsafe_H5Tclose(member_type_id);
3811 threadsafe_H5Tclose(native_member_type_id);
3812 threadsafe_H5Tclose(member_type_id);
3833 hid_t member_type_id;
3840 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3847 member_type_id = threadsafe_H5Tget_member_type(dset->dtype_id, pos);
3848 if (member_type_id < 0)
3851 type = XLALTypeFromH5Type(member_type_id);
3852 threadsafe_H5Tclose(member_type_id);
3881 ncols = threadsafe_H5Tget_nmembers(dset->dtype_id);
3889 if (threadsafe_H5Tget_member_class(dset->dtype_id, pos) < 0)
3892 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.
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.
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.
LIGOTimeGPS * XLALH5FileQueryLIGOTimeGPSAttributeValue(LIGOTimeGPS UNUSED *value, LALH5File UNUSED *file, const char UNUSED *key)
DEPRECATED: Gets the value of a LIGOTimeGPS attribute in a LALH5File.
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.
size_t XLALH5DatasetQueryNBytes(LALH5Dataset UNUSED *dset)
Gets the number of bytes in a LALH5Dataset.
int XLALH5DatasetCheckFixedLengthStringData(LALH5Dataset UNUSED *dset)
Checks if a LALH5Dataset contains fixed length string data.
int XLALH5AttributeAddString(LALH5Generic UNUSED object, const char UNUSED *key, const char UNUSED *value)
Adds a string attribute to a LALH5File or 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...
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.
LALH5File * XLALH5GroupOpen(LALH5File UNUSED *file, const char UNUSED *name)
Opens a group in a LALH5File.
LALH5Dataset * XLALH5DatasetAlloc(LALH5File UNUSED *file, const char UNUSED *name, LALTYPECODE UNUSED dtype, UINT4Vector UNUSED *dimLength)
Allocates a multi-dimensional LALH5Dataset.
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.
LIGOTimeGPS * XLALH5DatasetQueryLIGOTimeGPSAttributeValue(LIGOTimeGPS UNUSED *value, LALH5Dataset UNUSED *dset, const char UNUSED *key)
DEPRECATED: Gets the value of a LIGOTimeGPS attribute in a LALH5Dataset.
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.
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.
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.
LALH5Dataset * XLALH5DatasetAlloc1D(LALH5File UNUSED *file, const char UNUSED *name, LALTYPECODE UNUSED dtype, size_t UNUSED length)
Allocates a 1-dimensional LALH5Dataset.
int XLALH5FileGetDatasetNames(LALH5File UNUSED *file, char UNUSED ***names, UINT4 UNUSED *N)
DEPRECATED: Gets dataset names from a LALH5File.
LALH5File * XLALH5FileOpen(const char UNUSED *path, const char UNUSED *mode)
Opens 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.
int XLALH5FileGetAttributeNames(LALH5File UNUSED *file, char UNUSED ***names, UINT4 UNUSED *N)
DEPRECATED: Gets attribute names from a LALH5File.
LALH5Dataset * XLALH5DatasetRead(LALH5File UNUSED *file, const char UNUSED *name)
Reads a LALH5Dataset.
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.
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.
LALH5Dataset * XLALH5DatasetAllocStringData(LALH5File UNUSED *file, const char UNUSED *name, size_t UNUSED length)
Allocates a variable-length string LALH5Dataset.
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.
UINT4Vector * XLALH5DatasetQueryDims(LALH5Dataset UNUSED *dset)
Gets the dimensions of the dataspace in a LALH5Dataset.
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.
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.
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.
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_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.
@ 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.
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_CHECK(assertion,...)
Macro to test an assertion and invoke a failure if it is not true in a function that returns an integ...
#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.