6 #include <boost/program_options.hpp>
7 #include <boost/shared_ptr.hpp>
8 #include "utils/stl_to_string.hpp"
13 namespace po = boost::program_options;
18 ParameterBase(
const std::string& name,
const std::string& desc) : m_name(name), m_desc(desc) {}
19 virtual void addToBoost(po::options_description&) = 0;
22 typedef boost::shared_ptr<ParameterBase> ParameterBasePtr;
26 std::vector<T>* m_value;
27 ParameterVec(std::string name, std::vector<T>* value, std::string desc) :
30 void addToBoost(po::options_description& od) {
31 od.add_options()(m_name.c_str(), po::value(m_value)->default_value(*m_value, Str(*m_value))->multitoken(), m_desc.c_str());
38 Parameter(std::string name, T* value, std::string desc) :
41 void addToBoost(po::options_description& od) {
42 od.add_options()(m_name.c_str(), po::value(m_value)->default_value(*m_value, Str(*m_value)), m_desc.c_str());
47 std::vector< ParameterBasePtr > params;
48 void add(
ParameterBase* param) {params.push_back(ParameterBasePtr(param));}
52 std::vector<Config> configs;
53 void addGroup(
const Config& config) {
54 configs.push_back(config);
59 void read(
int argc,
char* argv[]);