Boost logo

Boost Users :

From: Steven Mackenzie (boost_at_[hidden])
Date: 2007-07-16 16:43:09


Hello,

I am writing an application that moves some data through a sequence of possibly
optional processing steps, for instance (simplified)

1/ Read and Export Data, optionally exporting it to a text or binary file.
2/ Optionally Normalise the data, optionally exporting to file.
3/ Optionally reduce the size of the data set, optionally exporting the result.
4/ Create a score for the data set, and write the score to a file or socket.

Each processing step 1-4 has a set of options, for example step 1 might export
the data as a text file or as a binary, and might transpose the data (rows and
columns) to make it easier to plot in a spreadsheet.

Data output at each processing step 1-3 is optional, and processing steps 1-2
are optional.

As described, this sounds like a pipeline of processes, but the customers
expectations (and my ability) suggest that this should be a single application*,
but with a consequently complicated set of options.

I'd like to be able to use program_options to help me parse the command line or
config file, and so my plan for the command line is that it would support 4
options (one for each step), for instance with <required options> and [optional
options]:

app <--export [optional file name [binary|text [transpose]]>
    [--normalize [optional file name]]
    [--reduce [optional file name]]
    <--score <file name or server address> [optional treshold number]>
    <input file name>

I want to allow each option to be given more than once, so that for instance
data could be exported as text and binary with

app --export file1.bin binary --export file2.txt text transposed ...

In another case the command line might be simply

app --export --normalize --score file://score.txt input.bin

where --export and --normalize are given as boolean switches, and --score has
used a default value for the threshold number.

In another case, I would like all of the options in a configuration file, and
only the input file name would be given on the command line.

So my questions:

1/ Could I make my command line simpler?

2/ Will boost::program_options be helpful in this case - I've only used it once
before in a much simpler scenario?

3/ What program_options methods should I be looking at? Although the
documentation has an excellent set of examples, I'm finding the reference
section something of a maze.

All sugestions will be gratefully received!
Steven

* The data set is large, and some processing steps might transform the data
in-place. Other steps might depend on the output of more than one steps (for
instance step 4 might depend on the results of steps 2 and 3). I hope to make
much of the process multi-threaded.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net