Handle complex options with Boost's program_options
Posted
by R S
on Stack Overflow
See other posts from Stack Overflow
or by R S
Published on 2010-05-29T15:15:52Z
Indexed on
2010/05/29
15:22 UTC
Read the original article
Hit count: 181
I have a program that generates graphs using different multi-level models. Each multi-level model consists of a generation of a smaller seed graph (say, 50 nodes) which can be created from several models (for example - for each possible edge, choose to include it with probability p).
After the seed graph generation, the graph is expanded into a larger one (say 1000 nodes), using one of another set of models.
In each of the two stages, each model require a different number of parameters.
I would like to be have program_options parse the different possible parameters, according to the names of the models.
For example, say I have two seed graphs models: SA, which has 1 parameters, and SB, which has two. Also for the expansion part, I have two models: A and B, again with 1 and 2 parameters, respectively. I would like to be able do something like:
./graph_generator --seed=SA 0.1 --expansion=A 0.2
./graph_generator --seed=SB 0.1 3 --expansion=A 0.2
./graph_generator --seed=SA 0.1 --expansion=B 10 20
./graph_generator --seed=SB 0.1 3 --expansion=B 10 20
and have the parameters parsed correctly. Is that even possible?
© Stack Overflow or respective owner