diff options
author | Thomas White <taw@physics.org> | 2021-09-17 10:35:22 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-09-17 11:09:02 +0200 |
commit | e2f451edadc9908ea3c3b97329bddaf3bd0b23a5 (patch) | |
tree | 5077109f1ab6a835c7208a795d0aea7de25ebb07 /src | |
parent | 2c4b899909982bcfabdbb45c6a0e8842b12c3434 (diff) |
indexamajig: Add --data-format
Diffstat (limited to 'src')
-rw-r--r-- | src/indexamajig.c | 19 | ||||
-rw-r--r-- | src/process_image.c | 2 | ||||
-rw-r--r-- | src/process_image.h | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c index 9bbf7e5d..75c7a2d5 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -288,6 +288,16 @@ static void add_copy_header(struct indexamajig_arguments *args, } +static DataSourceType parse_data_format(const char *str) +{ + if ( strcmp(str, "hdf5") == 0 ) return DATA_SOURCE_TYPE_HDF5; + if ( strcmp(str, "msgpack") == 0 ) return DATA_SOURCE_TYPE_MSGPACK; + /* CBF and CBFGZ should be added here once image-cbf.c supports + * in-memory access */ + return DATA_SOURCE_TYPE_UNKNOWN; +} + + static error_t parse_arg(int key, char *arg, struct argp_state *state) { float tmp; @@ -392,6 +402,14 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) args->zmq_request = strdup(arg); break; + case 219 : + args->iargs.data_format = parse_data_format(arg); + if ( args->iargs.data_format == DATA_SOURCE_TYPE_UNKNOWN ) { + ERROR("Unrecognised data format '%s'\n", arg); + return EINVAL; + } + break; + /* ---------- Peak search ---------- */ case 't' : @@ -916,6 +934,7 @@ int main(int argc, char *argv[]) "type"}, {"zmq-request", 212, "str", OPTION_NO_USAGE, "Request messages using" "this string."}, + {"data-format", 219, "str", OPTION_NO_USAGE, "Streamed data format"}, {NULL, 0, 0, OPTION_DOC, "Peak search options:", 3}, {"peaks", 301, "method", 0, "Peak search method. Default: zaef"}, diff --git a/src/process_image.c b/src/process_image.c index ced21911..f38e1d64 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -198,7 +198,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, image = image_read_data_block(iargs->dtempl, pargs->zmq_data, pargs->zmq_data_size, - DATA_SOURCE_TYPE_MSGPACK, + iargs->data_format, serial, iargs->no_image_data, iargs->no_mask_data); diff --git a/src/process_image.h b/src/process_image.h index cba6aa55..a52dd38a 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -45,6 +45,7 @@ struct index_args; #include "im-sandbox.h" #include "time-accounts.h" #include "peaks.h" +#include "image.h" /* Information about the indexing process which is common to all patterns */ @@ -56,6 +57,7 @@ struct index_args int no_image_data; int no_mask_data; float highres; + DataSourceType data_format; /* Peak search */ enum peak_search_method peaks; |