diff options
-rw-r--r-- | doc/man/indexamajig.1 | 5 | ||||
-rw-r--r-- | src/indexamajig.c | 19 | ||||
-rw-r--r-- | src/process_image.c | 2 | ||||
-rw-r--r-- | src/process_image.h | 2 |
4 files changed, 27 insertions, 1 deletions
diff --git a/doc/man/indexamajig.1 b/doc/man/indexamajig.1 index 4e67f234..b8fed6d4 100644 --- a/doc/man/indexamajig.1 +++ b/doc/man/indexamajig.1 @@ -186,6 +186,11 @@ Subscribe to ZeroMQ message type \fItag\fR. You can use this option multiple ti Request new data over ZeroMQ by sending string \fImsg\fR. This will cause indexamajig's ZeroMQ socket to use REQ mode instead of SUB. This option and \fB--zmq-subscribe\fR are mutually exclusive. .PD 0 +.IP \fB--data-format=\fIformat\fR +.PD +Specify the data format for data received over ZeroMQ. Possible values in this version are \fBmsgpack\fR and \fBhdf5\fR. + +.PD 0 .IP \fB--basename\fR .PD Remove the directory parts of the filenames taken from the input file. If \fB--prefix\fR or \fB-x\fR is also given, the directory parts of the filename will be removed \fIbefore\fR adding the prefix. 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; |