diff options
author | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2015-03-05 03:34:02 +0300 |
---|---|---|
committer | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2015-03-05 03:34:02 +0300 |
commit | 612e014e795fcd78a62bea60cc0bebc3c87ddaf5 (patch) | |
tree | 737ea05394b5c5a0c4b33d92287b0c28210fb87e /moses/Parameter.h | |
parent | 06e87d851e1f3546269a6db48fe1b4f8177f27a1 (diff) |
Organized command line options thematically.
This is the first step in migration to the use of boost::program_options for GNU/Linux-style handling of command line options.
Diffstat (limited to 'moses/Parameter.h')
-rw-r--r-- | moses/Parameter.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/moses/Parameter.h b/moses/Parameter.h index c6b08dd85..dd967e925 100644 --- a/moses/Parameter.h +++ b/moses/Parameter.h @@ -28,10 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include <vector> #include "TypeDef.h" #include "Util.h" +#include <boost/program_options.hpp> namespace Moses { - typedef std::vector<std::string> PARAM_VEC; typedef std::map<std::string, PARAM_VEC > PARAM_MAP; typedef std::map<std::string, bool> PARAM_BOOL; @@ -43,12 +43,17 @@ typedef std::map<std::string, std::string > PARAM_STRING; */ class Parameter { + typedef boost::program_options::options_description options_description; + typedef boost::program_options::value_semantic value_semantic; protected: PARAM_MAP m_setting; PARAM_BOOL m_valid; PARAM_STRING m_abbreviation; PARAM_STRING m_description; PARAM_STRING m_fullname; + // std::map<char,std::set<std::string> > m_confusable; + // stores long parameter names that start with a letter that is also a short option. + options_description m_options; std::map<std::string, std::vector<float> > m_weights; @@ -59,9 +64,30 @@ protected: bool isOption(const char* token); bool Validate(); - void AddParam(const std::string ¶mName, const std::string &description); - void AddParam(const std::string ¶mName, const std::string &abbrevName, const std::string &description); - + void + AddParam(options_description& optgroup, + value_semantic const* optvalue, + std::string const& paramName, + std::string const& description); + + void + AddParam(options_description& optgroup, + std::string const ¶mName, + std::string const &description); + + void + AddParam(options_description& optgroup, + value_semantic const* optvalue, + std::string const& paramName, + std::string const& abbrevName, + std::string const& description); + + void + AddParam(options_description& optgroup, + std::string const& paramName, + std::string const& abbrevName, + std::string const& description); + void PrintCredit(); void PrintFF() const; |