GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
ArgParser Class Reference

Definition at line 297 of file ArgParser.h.

Public Member Functions

 ArgParser ()
 
 ~ArgParser ()
 
template<typename T >
ArgParseConfigT< std::vector< T > > & default_option (std::vector< T > *output_location, bool firstPass)
 
template<typename T >
ArgParseConfigT< T > & option (const std::string flag, T *output_location, bool firstPass)
 
void parse (int argc, char **argv, bool firstPass)
 
void parse_file (std::string &filename)
 
void print (std::ostream &out) const
 

Private Member Functions

std::vector< std::string > argument_list (int argc, char **argv, int &iarg, int max_args)
 
ArgParseItemget_item (const std::string &flag)
 
void handle_default_option (int, char **argv, int &iarg, bool firstPass)
 
void handle_long_flag (int argc, char **argv, int &iarg, bool firstPass)
 
void handle_short_flag (int argc, char **argv, int &iarg, bool firstPass)
 

Private Attributes

std::vector< ArgParseItem * > values
 

#include <ArgParser.h>

+ Collaboration diagram for ArgParser:

Constructor & Destructor Documentation

◆ ArgParser()

ArgParser::ArgParser ( )
inline

Definition at line 299 of file ArgParser.h.

◆ ~ArgParser()

ArgParser::~ArgParser ( )
inline

Definition at line 301 of file ArgParser.h.

References values.

Member Function Documentation

◆ argument_list()

std::vector<std::string> ArgParser::argument_list ( int  argc,
char **  argv,
int &  iarg,
int  max_args 
)
inlineprivate

Reads arguments into a list until finding one that begins with '-'.

Definition at line 480 of file ArgParser.h.

References pygui.grut-view::argv.

Referenced by handle_long_flag(), and handle_short_flag().

◆ default_option()

template<typename T >
ArgParseConfigT<std::vector<T> >& ArgParser::default_option ( std::vector< T > *  output_location,
bool  firstPass 
)
inline

Definition at line 395 of file ArgParser.h.

References option().

Referenced by TGRSIOptions::Load().

◆ get_item()

ArgParseItem& ArgParser::get_item ( const std::string &  flag)
inlineprivate

Definition at line 499 of file ArgParser.h.

References values.

Referenced by handle_default_option(), handle_long_flag(), handle_short_flag(), and parse_file().

◆ handle_default_option()

void ArgParser::handle_default_option ( int  ,
char **  argv,
int &  iarg,
bool  firstPass 
)
inlineprivate

Definition at line 470 of file ArgParser.h.

References pygui.grut-view::argv, get_item(), and ArgParseItem::parse().

Referenced by parse().

◆ handle_long_flag()

void ArgParser::handle_long_flag ( int  argc,
char **  argv,
int &  iarg,
bool  firstPass 
)
inlineprivate

◆ handle_short_flag()

void ArgParser::handle_short_flag ( int  argc,
char **  argv,
int &  iarg,
bool  firstPass 
)
inlineprivate

◆ option()

template<typename T >
ArgParseConfigT<T>& ArgParser::option ( const std::string  flag,
T *  output_location,
bool  firstPass 
)
inline

Definition at line 387 of file ArgParser.h.

References values.

Referenced by default_option(), and TGRSIOptions::Load().

◆ parse()

void ArgParser::parse ( int  argc,
char **  argv,
bool  firstPass 
)
inline

this version takes argc and argv, parses them, and sets only those that have the matching firstPass flag set this allows us to parse command line arguments in two stages, one to get the normal options and file names (from which the run info and analysis options are read), and a second stage where only the run info and analysis option flags are parsed

Definition at line 308 of file ArgParser.h.

References pygui.grut-view::argv, handle_default_option(), handle_long_flag(), handle_short_flag(), and values.

Referenced by TGRSIOptions::Load().

◆ parse_file()

void ArgParser::parse_file ( std::string &  filename)
inline

Definition at line 340 of file ArgParser.h.

References get_item(), and ArgParseItem::parse().

Referenced by TGRSIOptions::Load().

◆ print()

void ArgParser::print ( std::ostream &  out) const
inline

Definition at line 400 of file ArgParser.h.

References ArgParseItem::printable(), and values.

Referenced by operator<<().

Member Data Documentation

◆ values

std::vector<ArgParseItem*> ArgParser::values
private

Definition at line 516 of file ArgParser.h.

Referenced by get_item(), option(), parse(), print(), and ~ArgParser().