|
YASK
Yet Another Stencil Kit: a software framework for creating HPC stencil code. Copyright 2014-2023 Intel Corporation.
|
Base class for a command-line option. More...
#include <yask_common_api.hpp>
Inheritance diagram for yask::command_line_parser::option_base:Public Member Functions | |
| option_base (const std::string &name, const std::string &help_msg, const std::string ¤t_value_prefix=std::string("Current value = "), const std::string &help_line_prefix=std::string(" ")) | |
| Constructor. | |
| virtual const std::string & | get_name () const |
| Get the current option name. | |
| virtual const std::string & | get_help () const |
| Get the unformatted help string. | |
| virtual void | print_help (std::ostream &os, int width) const |
| Print help on this option. | |
| virtual std::ostream & | print_value (std::ostream &os) const =0 |
| Print current value of this option. | |
| virtual bool | check_arg (const string_vec &args, int &argi)=0 |
| Check for matching option and any needed args at args[argi]. | |
Protected Member Functions | |
| virtual void | _print_help (std::ostream &os, const std::string &display_name, int width) const |
Format and print help for option named display_name to os. | |
| virtual bool | _is_opt (const string_vec &args, int &argi, const std::string &str) const |
Check for matching option to str at args[argi]. | |
| virtual double | _double_val (const string_vec &args, int &argi) |
Get one double value from args[argi++]. | |
| virtual idx_t | _idx_val (const string_vec &args, int &argi) |
| Get one idx_t value from args[argi++]. | |
| virtual std::string | _string_val (const string_vec &args, int &argi) |
| Get one string value from args[argi++]. | |
Base class for a command-line option.
The API programmer can extend this class to add new option types.
|
protectedvirtual |
Check for matching option to str at args[argi].
true and increments argi if match, false if not a match.
|
protectedvirtual |
Get one double value from args[argi++].
args[argi] and increments argi.| yask_exception | if args[argi] is not a double. |
|
protectedvirtual |
Get one idx_t value from args[argi++].
args[argi] and increments argi.| yask_exception | if args[argi] is not an integer. |
|
protectedvirtual |
Get one string value from args[argi++].
args[argi] and increments argi.| yask_exception | if args[argi] does not exist. |
|
inlinevirtual |
|
pure virtual |
Print current value of this option.
Implemented in yask::command_line_parser::bool_option, yask::command_line_parser::int_option, yask::command_line_parser::double_option, yask::command_line_parser::idx_option, yask::command_line_parser::string_option, and yask::command_line_parser::string_list_option.
|
pure virtual |
Check for matching option and any needed args at args[argi].
true, sets value of option, and increments argi if match; false if no match, and doesn't modify argi. Implemented in yask::command_line_parser::bool_option, yask::command_line_parser::int_option, yask::command_line_parser::double_option, yask::command_line_parser::idx_option, yask::command_line_parser::string_option, and yask::command_line_parser::string_list_option.