CUTLASS
CUDA Templates for Linear Algebra Subroutines and Solvers
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cutlass::CommandLine Struct Reference

#include <command_line.h>

Collaboration diagram for cutlass::CommandLine:
Collaboration graph
[legend]

Public Member Functions

 CommandLine (int argc, const char **argv)
 
bool check_cmd_line_flag (const char *arg_name) const
 
template<typename value_t >
int num_naked_args () const
 
template<typename value_t >
void get_cmd_line_argument (int index, value_t &val) const
 
void get_cmd_line_argument (const char *arg_name, bool &val, bool _default=true) const
 
template<typename value_t >
void get_cmd_line_argument (const char *arg_name, value_t &val, value_t const &_default=value_t()) const
 
template<typename value_t >
void get_cmd_line_arguments (const char *arg_name, std::vector< value_t > &vals, char sep= ',') const
 
void get_cmd_line_argument_pairs (const char *arg_name, std::vector< std::pair< std::string, std::string > > &tokens, char delim= ',', char sep= ':') const
 
void get_cmd_line_argument_ranges (const char *arg_name, std::vector< std::vector< std::string > > &vals, char delim= ',', char sep= ':') const
 
int parsed_argc () const
 

Static Public Member Functions

static void tokenize (std::vector< std::pair< std::string, std::string > > &tokens, std::string const &str, char delim= ',', char sep= ':')
 Tokenizes a comma-delimited list of string pairs delimited by ':'. More...
 
static void tokenize (std::vector< std::string > &tokens, std::string const &str, char delim= ',', char sep= ':')
 Tokenizes a comma-delimited list of string pairs delimited by ':'. More...
 
template<typename value_t >
static void separate_string (std::string const &str, std::vector< value_t > &vals, char sep= ',')
 

Public Attributes

std::vector< std::string > keys
 
std::vector< std::string > values
 
std::vector< std::string > args
 

Detailed Description

Utility for parsing command line arguments

Constructor & Destructor Documentation

cutlass::CommandLine::CommandLine ( int  argc,
const char **  argv 
)
inline

Constructor

Member Function Documentation

bool cutlass::CommandLine::check_cmd_line_flag ( const char *  arg_name) const
inline

Checks whether a flag "--<flag>" is present in the commandline

template<typename value_t >
void cutlass::CommandLine::get_cmd_line_argument ( int  index,
value_t &  val 
) const
inline

Returns the commandline parameter for a given index (not including flags)

void cutlass::CommandLine::get_cmd_line_argument ( const char *  arg_name,
bool &  val,
bool  _default = true 
) const
inline

Obtains the boolean value specified for a given commandline parameter –<flag>=<bool>

template<typename value_t >
void cutlass::CommandLine::get_cmd_line_argument ( const char *  arg_name,
value_t &  val,
value_t const &  _default = value_t() 
) const
inline

Obtains the value specified for a given commandline parameter –<flag>=

void cutlass::CommandLine::get_cmd_line_argument_pairs ( const char *  arg_name,
std::vector< std::pair< std::string, std::string > > &  tokens,
char  delim = ',',
char  sep = ':' 
) const
inline

Returns the values specified for a given commandline parameter –<flag>=

,<value_start:value_end>*

void cutlass::CommandLine::get_cmd_line_argument_ranges ( const char *  arg_name,
std::vector< std::vector< std::string > > &  vals,
char  delim = ',',
char  sep = ':' 
) const
inline

Returns a list of ranges specified for a given commandline parameter –<flag>=<key:value>,<key:value>*

template<typename value_t >
void cutlass::CommandLine::get_cmd_line_arguments ( const char *  arg_name,
std::vector< value_t > &  vals,
char  sep = ',' 
) const
inline

Returns the values specified for a given commandline parameter –<flag>=

,

*

template<typename value_t >
int cutlass::CommandLine::num_naked_args ( ) const
inline

Returns number of naked (non-flag and non-key-value) commandline parameters

int cutlass::CommandLine::parsed_argc ( ) const
inline

The number of pairs parsed

template<typename value_t >
static void cutlass::CommandLine::separate_string ( std::string const &  str,
std::vector< value_t > &  vals,
char  sep = ',' 
)
inlinestatic
static void cutlass::CommandLine::tokenize ( std::vector< std::pair< std::string, std::string > > &  tokens,
std::string const &  str,
char  delim = ',',
char  sep = ':' 
)
inlinestatic
static void cutlass::CommandLine::tokenize ( std::vector< std::string > &  tokens,
std::string const &  str,
char  delim = ',',
char  sep = ':' 
)
inlinestatic

Member Data Documentation

std::vector<std::string> cutlass::CommandLine::args
std::vector<std::string> cutlass::CommandLine::keys
std::vector<std::string> cutlass::CommandLine::values

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