OpenCV  3.0.0-rc1
Open Source Computer Vision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cv::CommandLineParser Class Reference

designed for command line arguments parsing More...

#include "utility.hpp"

Public Member Functions

 CommandLineParser (int argc, const char *const argv[], const String &keys)
 CommandLineParser (const CommandLineParser &parser)
 ~CommandLineParser ()
void about (const String &message)
bool check () const
template<typename T >
get (const String &name, bool space_delete=true) const
template<typename T >
get (int index, bool space_delete=true) const
String getPathToApplication () const
bool has (const String &name) const
CommandLineParseroperator= (const CommandLineParser &parser)
void printErrors () const
void printMessage () const

Protected Member Functions

void getByIndex (int index, bool space_delete, int type, void *dst) const
void getByName (const String &name, bool space_delete, int type, void *dst) const

Protected Attributes

Impl * impl

Detailed Description

designed for command line arguments parsing

The sample below demonstrates how to use CommandLineParser:

CommandLineParser parser(argc, argv, keys);
parser.about("Application name v1.0.0");
if (parser.has("help"))
return 0;
int N = parser.get<int>("N");
double fps = parser.get<double>("fps");
String path = parser.get<String>("path");
use_time_stamp = parser.has("timestamp");
String img1 = parser.get<String>(0);
String img2 = parser.get<String>(1);
int repeat = parser.get<int>(2);
if (!parser.check())
return 0;


const String keys =
"{help h usage ? | | print this message }"
"{@image1 | | image1 for compare }"
"{@image2 | | image2 for compare }"
"{@repeat |1 | number }"
"{path |. | path to file }"
"{fps | -1.0 | fps for output video }"
"{N count |100 | count of objects }"
"{ts timestamp | | use time stamp }"


# ./app -N=200 1.png 2.jpg 19 -ts
# ./app -fps=aaa
Exception: can not convert: [aaa] to [double]
demhist.cpp, distrans.cpp, and edge.cpp.

Constructor & Destructor Documentation

cv::CommandLineParser::CommandLineParser ( int  argc,
const char *const  argv[],
const String keys 
cv::CommandLineParser::CommandLineParser ( const CommandLineParser parser)
cv::CommandLineParser::~CommandLineParser ( )

Member Function Documentation

void cv::CommandLineParser::about ( const String message)
bool cv::CommandLineParser::check ( ) const
template<typename T >
T cv::CommandLineParser::get ( const String name,
bool  space_delete = true 
) const
template<typename T >
T cv::CommandLineParser::get ( int  index,
bool  space_delete = true 
) const
void cv::CommandLineParser::getByIndex ( int  index,
bool  space_delete,
int  type,
void *  dst 
) const
void cv::CommandLineParser::getByName ( const String name,
bool  space_delete,
int  type,
void *  dst 
) const
String cv::CommandLineParser::getPathToApplication ( ) const
bool cv::CommandLineParser::has ( const String name) const
CommandLineParser& cv::CommandLineParser::operator= ( const CommandLineParser parser)
void cv::CommandLineParser::printErrors ( ) const
void cv::CommandLineParser::printMessage ( ) const

Member Data Documentation

Impl* cv::CommandLineParser::impl

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