Jetson Inference
DNN Vision Library
|
Command line parser class. More...
#include <commandLine.h>
Public Member Functions | |
commandLine (const int argc, char **argv) | |
Constructor, takes the command line from main() More... | |
bool | GetFlag (const char *argName) |
Checks to see whether the specified flag was included on the command line. More... | |
float | GetFloat (const char *argName, float defaultValue=0.0f) |
Get float argument. More... | |
int | GetInt (const char *argName, int defaultValue=0) |
Get integer argument. More... | |
const char * | GetString (const char *argName, const char *defaultValue=NULL) |
Get string argument. More... | |
const char * | GetPosition (unsigned int position, const char *defaultValue=NULL) |
Get positional string argument. More... | |
unsigned int | GetPositionArgs () |
Get the number of positional arguments in the command line. More... | |
Protected Attributes | |
int | argc |
char ** | argv |
Command line parser class.
commandLine::commandLine | ( | const int | argc, |
char ** | argv | ||
) |
Constructor, takes the command line from main()
bool commandLine::GetFlag | ( | const char * | argName | ) |
Checks to see whether the specified flag was included on the command line.
For example, if argv contained --foo
, then GetFlag("foo")
would return true
true
, if the flag with argName was found false
, if the flag with argName was not found float commandLine::GetFloat | ( | const char * | argName, |
float | defaultValue = 0.0f |
||
) |
Get float argument.
For example if argv contained --foo=3.14159
, then GetInt("foo")
would return 3.14159f
defaultValue
if the argument couldn't be found. (0.0
by default). Otherwise, returns the value of the argument. int commandLine::GetInt | ( | const char * | argName, |
int | defaultValue = 0 |
||
) |
Get integer argument.
For example if argv contained --foo=100
, then GetInt("foo")
would return 100
defaultValue
if the argument couldn't be found (0
by default). Otherwise, returns the value of the argument. const char* commandLine::GetPosition | ( | unsigned int | position, |
const char * | defaultValue = NULL |
||
) |
Get positional string argument.
Positional arguments aren't named, but rather referenced by their index in the list. For example if the command line contained my-program --foo=bar /path/to/my_file.txt
, then GetString(0)
would return `"/path/to/my_file.txt"
defaultValue
if the argument couldn't be found (NULL
by default). Otherwise, returns a pointer to the argument value string from the argv
array. unsigned int commandLine::GetPositionArgs | ( | ) |
Get the number of positional arguments in the command line.
Positional arguments are those that don't have a name.
const char* commandLine::GetString | ( | const char * | argName, |
const char * | defaultValue = NULL |
||
) |
Get string argument.
For example if argv contained --foo=bar
, then GetString("foo")
would return "bar"
defaultValue
if the argument couldn't be found (NULL
by default). Otherwise, returns a pointer to the argument value string from the argv
array.
|
protected |
|
protected |