Logo ROOT  
Reference Guide
ROOT::option::Stats Struct Reference

Determines the minimum lengths of the buffer and options arrays used for Parser.

Because Parser doesn't use dynamic memory its output arrays have to be pre-allocated. If you don't want to use fixed size arrays (which may turn out too small, causing command line arguments to be dropped), you can use Stats to determine the correct sizes. Stats work cumulative. You can first pass in your default options and then the real options and afterwards the counts will reflect the union.

Definition at line 931 of file OptionParser.h.

Classes

class  CountOptionsAction
 

Public Member Functions

 Stats ()
 Creates a Stats object with counts set to 1 (for the sentinel element). More...
 
 Stats (bool gnu, const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 Stats(...) with non-const argv. More...
 
 Stats (bool gnu, const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 Creates a new Stats object and immediately updates it for the given usage and argument vector. More...
 
 Stats (const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 POSIX Stats(...) (gnu==false) with non-const argv. More...
 
 Stats (const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 POSIX Stats(...) (gnu==false). More...
 
void add (bool gnu, const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 add() with non-const argv. More...
 
void add (bool gnu, const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 Updates this Stats object for the given usage and argument vector. More...
 
void add (const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 POSIX add() (gnu==false) with non-const argv. More...
 
void add (const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
 POSIX add() (gnu==false). More...
 

Public Attributes

unsigned buffer_max
 Number of elements needed for a buffer[] array to be used for parsing the same argument vectors that were fed into this Stats object. More...
 
unsigned options_max
 Number of elements needed for an options[] array to be used for parsing the same argument vectors that were fed into this Stats object. More...
 

#include </home/sftnight/build/workspace/root-makedoc-v622/rootspi/rdoc/src/v6-22-00-patches/core/dictgen/res/OptionParser.h>

Constructor & Destructor Documentation

◆ Stats() [1/5]

ROOT::option::Stats::Stats ( )
inline

Creates a Stats object with counts set to 1 (for the sentinel element).

Definition at line 960 of file OptionParser.h.

◆ Stats() [2/5]

ROOT::option::Stats::Stats ( bool  gnu,
const Descriptor  usage[],
int  argc,
const char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

Creates a new Stats object and immediately updates it for the given usage and argument vector.

You may pass 0 for argc and/or argv, if you just want to update options_max.

Note
The calls to Stats methods must match the later calls to Parser methods. See Parser::parse() for the meaning of the arguments.

Definition at line 974 of file OptionParser.h.

◆ Stats() [3/5]

ROOT::option::Stats::Stats ( bool  gnu,
const Descriptor  usage[],
int  argc,
char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

Stats(...) with non-const argv.

Definition at line 982 of file OptionParser.h.

◆ Stats() [4/5]

ROOT::option::Stats::Stats ( const Descriptor  usage[],
int  argc,
const char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

POSIX Stats(...) (gnu==false).

Definition at line 990 of file OptionParser.h.

◆ Stats() [5/5]

ROOT::option::Stats::Stats ( const Descriptor  usage[],
int  argc,
char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

POSIX Stats(...) (gnu==false) with non-const argv.

Definition at line 998 of file OptionParser.h.

Member Function Documentation

◆ add() [1/4]

void ROOT::option::Stats::add ( bool  gnu,
const Descriptor  usage[],
int  argc,
char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

add() with non-const argv.

Definition at line 1018 of file OptionParser.h.

◆ add() [2/4]

void ROOT::option::Stats::add ( bool  gnu,
const Descriptor  usage[],
int  argc,
const char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

Updates this Stats object for the given usage and argument vector.

You may pass 0 for argc and/or argv, if you just want to update options_max.

Note
The calls to Stats methods must match the later calls to Parser methods. See Parser::parse() for the meaning of the arguments.

Definition at line 1507 of file OptionParser.h.

◆ add() [3/4]

void ROOT::option::Stats::add ( const Descriptor  usage[],
int  argc,
char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

POSIX add() (gnu==false) with non-const argv.

Definition at line 1032 of file OptionParser.h.

◆ add() [4/4]

void ROOT::option::Stats::add ( const Descriptor  usage[],
int  argc,
const char **  argv,
int  min_abbr_len = 0,
bool  single_minus_longopt = false 
)
inline

POSIX add() (gnu==false).

Definition at line 1025 of file OptionParser.h.

Member Data Documentation

◆ buffer_max

unsigned ROOT::option::Stats::buffer_max

Number of elements needed for a buffer[] array to be used for parsing the same argument vectors that were fed into this Stats object.

Note
This number is always 1 greater than the actual number needed, to give you a sentinel element.

Definition at line 942 of file OptionParser.h.

◆ options_max

unsigned ROOT::option::Stats::options_max

Number of elements needed for an options[] array to be used for parsing the same argument vectors that were fed into this Stats object.

Note
  • This number is always 1 greater than the actual number needed, to give you a sentinel element.
  • This number depends only on the usage, not the argument vectors, because the options array needs exactly one slot for each possible Descriptor::index.

Definition at line 955 of file OptionParser.h.

Collaboration diagram for ROOT::option::Stats:
[legend]

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