Boost logo

Boost :

From: Maurizio Vitale (vze2ydmt_at_[hidden])
Date: 2004-09-22 09:46:34


Hi all,
   I'm trying to somewhat abuse the boost program_options library for
configuring large simulations of digital systems.
One feature that I need is the initialization of arrays (and any object
supporting an operator []).

For instance for a block containing a register file I'd like to be able to
say things like:

  [block]
  regs[10] = 0

even nicer if the index was not contrained to be an integer. For instance

  [block]
  regs[0..5] = 1

would be an handy way for initializing a range of locations.

Now, as far as I can tell, both these uses are not supported by the library.

Having to modify the library itself, a quick (and obviously dirty)
change would be to check for [] when parsing the option name and stuffing it
as prefix to the value so that user defined parsers can take care of it.
Just for clarity, what I mean is to turn:

  [block]
  regs[0..5] = 1

into:

  [block]
  regs = [0..5]1

With an appropriate type declaration for regs we can cause the appropriate user
defined parser for doing the validation.

So I guess I have three questions:

   - would be an extension to program_options to take care of the
     initialization of array-like object considered of general enough interest
     to deserve a place in the library?

   - if not, does the quick-and-dirty approach outlines seem viable to people
     familiar with the program_options library?

   - any other suggestions for a cleaner/more general implementation?

Thanks a lot for any suggestions.
Best regards,

     Maurizio


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk