aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image-hdf5.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-03-09 10:32:48 +0100
committerThomas White <taw@physics.org>2022-03-09 10:51:38 +0100
commitfa397e933d2ba0ecdfb94e6a9d876886598be9f5 (patch)
tree29ea8fed5cb0522f2e706fe20d6c7117225e5da9 /libcrystfel/src/image-hdf5.c
parent54752e2ce0a0d5c9ea0e8b6832affb4bc5ef6554 (diff)
Meson: enable building without HDF5
Diffstat (limited to 'libcrystfel/src/image-hdf5.c')
-rw-r--r--libcrystfel/src/image-hdf5.c66
1 files changed, 37 insertions, 29 deletions
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c
index 702c1392..7023e811 100644
--- a/libcrystfel/src/image-hdf5.c
+++ b/libcrystfel/src/image-hdf5.c
@@ -33,9 +33,11 @@
#include <assert.h>
#include <math.h>
#include <stdio.h>
+#include <unistd.h>
+#ifdef HAVE_HDF5
#include <hdf5.h>
#include <hdf5_hl.h>
-#include <unistd.h>
+#endif
#include "image.h"
#include "utils.h"
@@ -45,34 +47,6 @@
#include "datatemplate_priv.h"
-static void close_hdf5(hid_t fh)
-{
- int n_ids, i;
- hid_t ids[2048];
-
- n_ids = H5Fget_obj_ids(fh, H5F_OBJ_ALL, 2048, ids);
-
- for ( i=0; i<n_ids; i++ ) {
-
- hid_t id;
- H5I_type_t type;
-
- id = ids[i];
-
- type = H5Iget_type(id);
-
- if ( type == H5I_GROUP ) H5Gclose(id);
- if ( type == H5I_DATASET ) H5Dclose(id);
- if ( type == H5I_DATATYPE ) H5Tclose(id);
- if ( type == H5I_DATASPACE ) H5Sclose(id);
- if ( type == H5I_ATTR ) H5Aclose(id);
-
- }
-
- H5Fclose(fh);
-}
-
-
/* Get the path parts of the event ID
* e.g. ev_orig = abc/def/ghi//5/2/7
* -> [abc, def, ghi], with *pn_plvals=3.
@@ -320,6 +294,8 @@ char *substitute_path(const char *ev, const char *pattern, int skip_ok)
}
+#ifdef HAVE_HDF5
+
static void make_placeholder_skip(signed int *dt_dims,
signed int *panel_dims)
{
@@ -355,6 +331,36 @@ static int total_dimensions(const struct panel_template *p)
}
+static void close_hdf5(hid_t fh)
+{
+ int n_ids, i;
+ hid_t ids[2048];
+
+ n_ids = H5Fget_obj_ids(fh, H5F_OBJ_ALL, 2048, ids);
+
+ for ( i=0; i<n_ids; i++ ) {
+
+ hid_t id;
+ H5I_type_t type;
+
+ id = ids[i];
+
+ type = H5Iget_type(id);
+
+ if ( type == H5I_GROUP ) H5Gclose(id);
+ if ( type == H5I_DATASET ) H5Dclose(id);
+ if ( type == H5I_DATATYPE ) H5Tclose(id);
+ if ( type == H5I_DATASPACE ) H5Sclose(id);
+ if ( type == H5I_ATTR ) H5Aclose(id);
+
+ }
+
+ H5Fclose(fh);
+}
+
+
+
+
static int load_hdf5_hyperslab(struct panel_template *p,
hid_t fh,
const char *event,
@@ -2316,3 +2322,5 @@ int image_hdf5_write(const struct image *image,
free(locations);
return 0;
}
+
+#endif /* HAVE_HDF5 */