Disclamer: I'm using C++11.
In this question I was asking how I could create objects from command line. A good solution was proposed here. Since then, I developed my system and multiple classes and arguments are created from command line. Just as an example:
./myprogram param1 1 param2 "hello" class1 3 8.8 "string_option" class2 1
What this execution does is:
- set the optional variable/parameter
int param1=1
- set the optional variable/parameter
std::string param2=hello
- create an object of
class1
with the constructorclass1(int first, float second)
- create an ojbect of
class2
with the constuctorclass2(int first)
Creating objects from class1
and class2
are mandatory, while setting param1
and/or param2
is optional.
So this calling is legal too (missing param1
):
./myprogram param2 "hello" class1 3 8.8 "string_option" class2 1
While this is not (missing class1
):
./myprogram param1 1 param2 "hello" class2 1
I'm doing this because I need to test several different configurations (i.e. tuning) and find the best one.
Finally, I need to write each configuration to a file/table with the correspondent result, so I can easily compare the results from different configurations.
My question is: is there any already implemented or better solutioin? Like using some configuration file (for exmample a .yml
file) or for example some cool library (boost
I'm looking at you :) ).