YASK
Yet Another Stencil Kit: a software framework for creating HPC stencil code. Copyright 2014-2023 Intel Corporation.
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
yask::command_line_parser Class Reference

A class to parse command-line arguments. More...

#include <yask_common_api.hpp>

Classes

class  bool_option
 A boolean option. More...
 
class  double_option
 A double option. More...
 
class  idx_option
 An idx_t option. More...
 
class  int_option
 An integer option. More...
 
class  option_base
 Base class for a command-line option. More...
 
class  string_list_option
 A list-of-strings option. More...
 
class  string_option
 A string option. More...
 

Public Types

typedef std::shared_ptr< option_baseoption_ptr
 Pointer to an option handler.
 

Public Member Functions

 command_line_parser ()
 Constructor.
 
virtual ~command_line_parser ()
 Destructor.
 
virtual void set_width (int width)
 Set help width.
 
virtual int get_width () const
 Get help width.
 
virtual void add_option (option_ptr opt)
 Add an allowed option to the parser.
 
virtual void print_help (std::ostream &os) const
 Print help info on all options to os.
 
virtual void print_values (std::ostream &os) const
 Print current settings of all options to os.
 
virtual std::string parse_args (const std::string &pgm_name, const string_vec &args)
 Parse options from 'args' and set corresponding vars.
 
virtual std::string parse_args (const std::string &pgm_name, const std::string &arg_string)
 Same as parse_args(), but splits 'arg_string' into tokens.
 
virtual std::string parse_args (int argc, char **argv)
 Same as parse_args(), but pgm_name is populated from argv[0] and rest of argv is parsed.
 

Static Public Member Functions

static string_vec set_args (const std::string &arg_string)
 Convenience funcion to tokenize args from a string.
 

Detailed Description

A class to parse command-line arguments.

This is the class used to parse command-line arguments for the YASK kernel and compiler libraries. It is provided as a convenience for API programmers who want to parse application options in a consistent manner.

Note
Not available in the Python API.

Member Function Documentation

◆ parse_args()

virtual std::string yask::command_line_parser::parse_args ( const std::string &  pgm_name,
const string_vec args 
)
virtual

Parse options from 'args' and set corresponding vars.

Recognized strings from args are consumed, and unused ones remain for further processing by the application.

Returns
string of unused args.

The documentation for this class was generated from the following file: