ATLAS Offline Software
Loading...
Searching...
No Matches
cmdline.h File Reference

The header file for the command line option parser generated by GNU Gengetopt version 2.22.4 http://www.gnu.org/software/gengetopt. More...

#include <stdio.h>
Include dependency graph for cmdline.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gengetopt_args_info
 Where the command line options are stored. More...
struct  cmdline_parser_params
 The additional parameters to pass to parser functions. More...

Macros

#define CMDLINE_PARSER_PACKAGE   "iLumiCalc.exe"
 the program name (used for printing errors)
#define CMDLINE_PARSER_PACKAGE_NAME   "iLumiCalc.exe"
 the complete program name (used for help and version)
#define CMDLINE_PARSER_VERSION   "00-00-00"
 the program version

Functions

int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
 The command line parser.
int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
 The command line parser (version with additional parameters - deprecated)
int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params)
 The command line parser (version with additional parameters)
int cmdline_parser_dump (FILE *outfile, struct gengetopt_args_info *args_info)
 Save the contents of the option struct into an already open FILE stream.
int cmdline_parser_file_save (const char *filename, struct gengetopt_args_info *args_info)
 Save the contents of the option struct into a (text) file.
void cmdline_parser_print_help (void)
 Print the help.
void cmdline_parser_print_version (void)
 Print the version.
void cmdline_parser_params_init (struct cmdline_parser_params *params)
 Initializes all the fields a cmdline_parser_params structure to their default values.
struct cmdline_parser_paramscmdline_parser_params_create (void)
 Allocates dynamically a cmdline_parser_params structure and initializes all its fields to their default values.
void cmdline_parser_init (struct gengetopt_args_info *args_info)
 Initializes the passed gengetopt_args_info structure's fields (also set default values for options that have a default)
void cmdline_parser_free (struct gengetopt_args_info *args_info)
 Deallocates the string fields of the gengetopt_args_info structure (but does not deallocate the structure itself)
int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
 Checks that all the required options were specified.

Variables

const char * gengetopt_args_info_purpose
 the purpose string of the program
const char * gengetopt_args_info_usage
 the usage string of the program
const char * gengetopt_args_info_help []
 all the lines making the help output

Detailed Description

The header file for the command line option parser generated by GNU Gengetopt version 2.22.4 http://www.gnu.org/software/gengetopt.

DO NOT modify this file, since it can be overwritten

Author
GNU Gengetopt by Lorenzo Bettini

Definition in file cmdline.h.

Macro Definition Documentation

◆ CMDLINE_PARSER_PACKAGE

#define CMDLINE_PARSER_PACKAGE   "iLumiCalc.exe"

the program name (used for printing errors)

Definition at line 28 of file cmdline.h.

◆ CMDLINE_PARSER_PACKAGE_NAME

#define CMDLINE_PARSER_PACKAGE_NAME   "iLumiCalc.exe"

the complete program name (used for help and version)

Definition at line 33 of file cmdline.h.

◆ CMDLINE_PARSER_VERSION

#define CMDLINE_PARSER_VERSION   "00-00-00"

the program version

Definition at line 38 of file cmdline.h.

Function Documentation

◆ cmdline_parser()

int cmdline_parser ( int argc,
char ** argv,
struct gengetopt_args_info * args_info )

The command line parser.

Parameters
argcthe number of command line options
argvthe command line options
args_infothe structure where option information will be stored
Returns
0 if everything went fine, NON 0 if an error took place

Definition at line 659 of file cmdline.cxx.

660{
661 return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
662}
int cmdline_parser2(int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
The command line parser (version with additional parameters - deprecated)
Definition cmdline.cxx:681

◆ cmdline_parser2()

int cmdline_parser2 ( int argc,
char ** argv,
struct gengetopt_args_info * args_info,
int override,
int initialize,
int check_required )

The command line parser (version with additional parameters - deprecated)

Parameters
argcthe number of command line options
argvthe command line options
args_infothe structure where option information will be stored
overridewhether to override possibly already present options
initializewhether to initialize the option structure my_args_info
check_requiredwhether to check that all required options were provided
Returns
0 if everything went fine, NON 0 if an error took place
Deprecated
use cmdline_parser_ext() instead

Definition at line 681 of file cmdline.cxx.

682{
683 int result;
685
686 params.override = override;
687 params.initialize = initialize;
688 params.check_required = check_required;
689 params.check_ambiguity = 0;
690 params.print_errors = 1;
691
692 result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
693
694 if (result == EXIT_FAILURE)
695 {
696 cmdline_parser_free (args_info);
697 exit (EXIT_FAILURE);
698 }
699
700 return result;
701}
static int cmdline_parser_internal(int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error)
Definition cmdline.cxx:1025
void cmdline_parser_free(struct gengetopt_args_info *args_info)
Deallocates the string fields of the gengetopt_args_info structure (but does not deallocate the struc...
Definition cmdline.cxx:502
void initialize()
The additional parameters to pass to parser functions.
Definition cmdline.h:161
int check_required
whether to check that all required options were provided (default 1)
Definition cmdline.h:164

◆ cmdline_parser_dump()

int cmdline_parser_dump ( FILE * outfile,
struct gengetopt_args_info * args_info )

Save the contents of the option struct into an already open FILE stream.

Parameters
outfilethe stream where to dump options
args_infothe option struct to dump
Returns
0 if everything went fine, NON 0 if an error took place

Definition at line 418 of file cmdline.cxx.

419{
420 int i = 0;
421
422 if (!outfile)
423 {
424 fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
425 return EXIT_FAILURE;
426 }
427
428 if (args_info->help_given)
429 write_into_file(outfile, "help", 0, 0 );
430 if (args_info->version_given)
431 write_into_file(outfile, "version", 0, 0 );
432 write_multiple_into_file(outfile, args_info->runnumber_given, "runnumber", args_info->runnumber_orig, 0);
433 write_multiple_into_file(outfile, args_info->lbstart_given, "lbstart", args_info->lbstart_orig, 0);
434 write_multiple_into_file(outfile, args_info->lbend_given, "lbend", args_info->lbend_orig, 0);
435 write_multiple_into_file(outfile, args_info->xml_given, "xml", args_info->xml_orig, 0);
436 if (args_info->xml_blacklist_given)
437 write_into_file(outfile, "xml_blacklist", args_info->xml_blacklist_orig, 0);
438 write_multiple_into_file(outfile, args_info->tag_given, "tag", args_info->tag_orig, 0);
439 write_multiple_into_file(outfile, args_info->root_given, "root", args_info->root_orig, 0);
440 if (args_info->tree_given)
441 write_into_file(outfile, "tree", args_info->tree_orig, 0);
442 if (args_info->d3pd_dir_given)
443 write_into_file(outfile, "d3pd_dir", args_info->d3pd_dir_orig, 0);
444 if (args_info->lumitag_given)
445 write_into_file(outfile, "lumitag", args_info->lumitag_orig, 0);
446 if (args_info->online_given)
447 write_into_file(outfile, "online", 0, 0 );
448 if (args_info->lumichannel_given)
449 write_into_file(outfile, "lumichannel", args_info->lumichannel_orig, 0);
450 if (args_info->lumimethod_given)
451 write_into_file(outfile, "lumimethod", args_info->lumimethod_orig, 0);
452 write_multiple_into_file(outfile, args_info->trigger_given, "trigger", args_info->trigger_orig, 0);
453 if (args_info->livetrigger_given)
454 write_into_file(outfile, "livetrigger", args_info->livetrigger_orig, 0);
455 if (args_info->lar_given)
456 write_into_file(outfile, "lar", 0, 0 );
457 if (args_info->lartag_given)
458 write_into_file(outfile, "lartag", args_info->lartag_orig, 0);
459 if (args_info->beamspot_given)
460 write_into_file(outfile, "beamspot", 0, 0 );
461 if (args_info->beamspottag_given)
462 write_into_file(outfile, "beamspottag", args_info->beamspottag_orig, 0);
463 if (args_info->scale_lumi_given)
464 write_into_file(outfile, "scale_lumi", args_info->scale_lumi_orig, 0);
465 if (args_info->xml_out_given)
466 write_into_file(outfile, "xml_out", args_info->xml_out_orig, 0);
467 if (args_info->xml_collisionlist_given)
468 write_into_file(outfile, "xml_collisionlist", 0, 0 );
469 if (args_info->plots_given)
470 write_into_file(outfile, "plots", 0, 0 );
471 if (args_info->verbose_given)
472 write_into_file(outfile, "verbose", 0, 0 );
473 if (args_info->quiet_given)
474 write_into_file(outfile, "quiet", 0, 0 );
475
476
477 i = EXIT_SUCCESS;
478 return i;
479}
static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[])
Definition cmdline.cxx:409
static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *[])
Definition cmdline.cxx:399
#define CMDLINE_PARSER_PACKAGE
the program name (used for printing errors)
Definition cmdline.h:28
char * lumichannel_orig
Luminosity estimate method by value original value given at command line.
Definition cmdline.h:91
char * lumitag_orig
Offline luminosity database tag original value given at command line.
Definition cmdline.h:86
char ** lbend_orig
LumiBlock number end original value given at command line.
Definition cmdline.h:57
char * lartag_orig
LAr noise burst database tag original value given at command line.
Definition cmdline.h:107
char * tree_orig
Name of TTree in input ROOT file to which Lumi string is attached original value given at command lin...
Definition cmdline.h:80
char * livetrigger_orig
L1 Trigger used for livetime calculation original value given at command line.
Definition cmdline.h:102
char * lumimethod_orig
Luminosity estimate method by string original value given at command line.
Definition cmdline.h:94
unsigned int lar_given
Whether lar was given.
Definition cmdline.h:146
unsigned int root_given
Whether root was given.
Definition cmdline.h:137
unsigned int xml_out_given
Whether xml_out was given.
Definition cmdline.h:151
unsigned int tree_given
Whether tree was given.
Definition cmdline.h:138
char ** lbstart_orig
LumiBlock number begin original value given at command line.
Definition cmdline.h:52
unsigned int beamspottag_given
Whether beamspottag was given.
Definition cmdline.h:149
unsigned int lbend_given
Whether lbend was given.
Definition cmdline.h:133
unsigned int livetrigger_given
Whether livetrigger was given.
Definition cmdline.h:145
unsigned int xml_given
Whether xml was given.
Definition cmdline.h:134
unsigned int lumimethod_given
Whether lumimethod was given.
Definition cmdline.h:143
unsigned int scale_lumi_given
Whether scale_lumi was given.
Definition cmdline.h:150
unsigned int plots_given
Whether plots was given.
Definition cmdline.h:153
unsigned int xml_collisionlist_given
Whether xml_collisionlist was given.
Definition cmdline.h:152
char ** runnumber_orig
Run number, range, or comma separated list, e.g.
Definition cmdline.h:47
char * xml_out_orig
Output XML file name original value given at command line.
Definition cmdline.h:118
unsigned int xml_blacklist_given
Whether xml_blacklist was given.
Definition cmdline.h:135
unsigned int lumichannel_given
Whether lumichannel was given.
Definition cmdline.h:142
unsigned int trigger_given
Whether trigger was given.
Definition cmdline.h:144
unsigned int lbstart_given
Whether lbstart was given.
Definition cmdline.h:132
unsigned int runnumber_given
Whether runnumber was given.
Definition cmdline.h:131
unsigned int help_given
Whether help was given.
Definition cmdline.h:129
char ** root_orig
Input ROOT file name original value given at command line.
Definition cmdline.h:75
unsigned int lartag_given
Whether lartag was given.
Definition cmdline.h:147
unsigned int quiet_given
Whether quiet was given.
Definition cmdline.h:155
unsigned int tag_given
Whether tag was given.
Definition cmdline.h:136
unsigned int d3pd_dir_given
Whether d3pd_dir was given.
Definition cmdline.h:139
char * d3pd_dir_orig
Name of TDirectory in input ROOT file where Lumi string is stored original value given at command lin...
Definition cmdline.h:83
unsigned int version_given
Whether version was given.
Definition cmdline.h:130
unsigned int lumitag_given
Whether lumitag was given.
Definition cmdline.h:140
char * scale_lumi_orig
Scale luminosity with a constant value original value given at command line.
Definition cmdline.h:115
char ** tag_orig
Input TAG file name original value given at command line.
Definition cmdline.h:70
char ** xml_orig
Input XML file name original value given at command line.
Definition cmdline.h:62
unsigned int verbose_given
Whether verbose was given.
Definition cmdline.h:154
char ** trigger_orig
Trigger chain name used for prescale calculation original value given at command line.
Definition cmdline.h:97
char * xml_blacklist_orig
Input XML file of blacklist original value given at command line.
Definition cmdline.h:67
unsigned int beamspot_given
Whether beamspot was given.
Definition cmdline.h:148
unsigned int online_given
Whether online was given.
Definition cmdline.h:141
char * beamspottag_orig
Online beamspot database tag original value given at command line.
Definition cmdline.h:112

◆ cmdline_parser_ext()

int cmdline_parser_ext ( int argc,
char ** argv,
struct gengetopt_args_info * args_info,
struct cmdline_parser_params * params )

The command line parser (version with additional parameters)

Parameters
argcthe number of command line options
argvthe command line options
args_infothe structure where option information will be stored
paramsadditional parameters for the parser
Returns
0 if everything went fine, NON 0 if an error took place

Definition at line 665 of file cmdline.cxx.

667{
668 int result;
669 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
670
671 if (result == EXIT_FAILURE)
672 {
673 cmdline_parser_free (args_info);
674 exit (EXIT_FAILURE);
675 }
676
677 return result;
678}

◆ cmdline_parser_file_save()

int cmdline_parser_file_save ( const char * filename,
struct gengetopt_args_info * args_info )

Save the contents of the option struct into a (text) file.

This file can be read by the config file parser (if generated by gengetopt)

Parameters
filenamethe file where to save
args_infothe option struct to save
Returns
0 if everything went fine, NON 0 if an error took place

Definition at line 482 of file cmdline.cxx.

483{
484 FILE *outfile;
485 int i = 0;
486
487 outfile = fopen(filename, "w");
488
489 if (!outfile)
490 {
491 fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
492 return EXIT_FAILURE;
493 }
494
495 i = cmdline_parser_dump(outfile, args_info);
496 fclose (outfile);
497
498 return i;
499}
int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
Save the contents of the option struct into an already open FILE stream.
Definition cmdline.cxx:418

◆ cmdline_parser_free()

void cmdline_parser_free ( struct gengetopt_args_info * args_info)

Deallocates the string fields of the gengetopt_args_info structure (but does not deallocate the structure itself)

Parameters
args_infothe structure to deallocate

Definition at line 502 of file cmdline.cxx.

503{
504 cmdline_parser_release (args_info);
505}
static void cmdline_parser_release(struct gengetopt_args_info *args_info)
Definition cmdline.cxx:359

◆ cmdline_parser_init()

void cmdline_parser_init ( struct gengetopt_args_info * args_info)

Initializes the passed gengetopt_args_info structure's fields (also set default values for options that have a default)

Parameters
args_infothe structure to initialize

Definition at line 252 of file cmdline.cxx.

253{
254 clear_given (args_info);
255 clear_args (args_info);
256 init_args_info (args_info);
257}
static void clear_given(struct gengetopt_args_info *args_info)
Definition cmdline.cxx:90
static void clear_args(struct gengetopt_args_info *args_info)
Definition cmdline.cxx:122
static void init_args_info(struct gengetopt_args_info *args_info)
Definition cmdline.cxx:171

◆ cmdline_parser_params_create()

struct cmdline_parser_params * cmdline_parser_params_create ( void )

Allocates dynamically a cmdline_parser_params structure and initializes all its fields to their default values.

Returns
the created and initialized cmdline_parser_params structure

Definition at line 273 of file cmdline.cxx.

274{
276 (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
278 return params;
279}
void cmdline_parser_params_init(struct cmdline_parser_params *params)
Initializes all the fields a cmdline_parser_params structure to their default values.
Definition cmdline.cxx:260

◆ cmdline_parser_params_init()

void cmdline_parser_params_init ( struct cmdline_parser_params * params)

Initializes all the fields a cmdline_parser_params structure to their default values.

Parameters
paramsthe structure to initialize

Definition at line 260 of file cmdline.cxx.

261{
262 if (params)
263 {
264 params->override = 0;
265 params->initialize = 1;
266 params->check_required = 1;
267 params->check_ambiguity = 0;
268 params->print_errors = 1;
269 }
270}

◆ cmdline_parser_print_help()

void cmdline_parser_print_help ( void )

Print the help.

Definition at line 243 of file cmdline.cxx.

244{
245 int i = 0;
247 while (gengetopt_args_info_help[i])
248 printf("%s\n", gengetopt_args_info_help[i++]);
249}
const char * gengetopt_args_info_help[]
all the lines making the help output
Definition cmdline.cxx:33
static void print_help_common(void)
Definition cmdline.cxx:227

◆ cmdline_parser_print_version()

void cmdline_parser_print_version ( void )

Print the version.

Definition at line 220 of file cmdline.cxx.

221{
222 printf ("%s %s\n",
225}
#define CMDLINE_PARSER_VERSION
the program version
Definition cmdline.h:38
#define CMDLINE_PARSER_PACKAGE_NAME
the complete program name (used for help and version)
Definition cmdline.h:33

◆ cmdline_parser_required()

int cmdline_parser_required ( struct gengetopt_args_info * args_info,
const char * prog_name )

Checks that all the required options were specified.

Parameters
args_infothe structure to check
prog_namethe name of the program that will be used to print possible errors
Returns

Definition at line 704 of file cmdline.cxx.

705{
706 int result = EXIT_SUCCESS;
707
708 if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
709 result = EXIT_FAILURE;
710
711 if (result == EXIT_FAILURE)
712 {
713 cmdline_parser_free (args_info);
714 exit (EXIT_FAILURE);
715 }
716
717 return result;
718}
static int cmdline_parser_required2(struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
Definition cmdline.cxx:721

Variable Documentation

◆ gengetopt_args_info_help

const char* gengetopt_args_info_help[]
extern

all the lines making the help output

Definition at line 33 of file cmdline.cxx.

33 {
34 " -h, --help Print help and exit",
35 " --version Print version and exit",
36 "\nFlags to specify data sample:",
37 " -r, --runnumber=STRING Run number, range, or comma separated list, e.g. \n 177986-178109,179710",
38 " --lbstart=INT LumiBlock number begin",
39 " --lbend=INT LumiBlock number end",
40 " -x, --xml=STRING Input XML file name",
41 " --xml_blacklist=STRING Input XML file of blacklist",
42 " -T, --tag=STRING Input TAG file name",
43 " --root=STRING Input ROOT file name",
44 " --tree=STRING Name of TTree in input ROOT file to which Lumi \n string is attached",
45 " --d3pd_dir=STRING Name of TDirectory in input ROOT file where Lumi \n string is stored",
46 "\nFlags to control luminosity calculation:",
47 " --lumitag=STRING Offline luminosity database tag \n (default=`OflLumi-8TeV-002')",
48 " --online Use online luminosity estimates instead of \n offline database (default=off)",
49 " --lumichannel=INT Luminosity estimate method by value \n (default=`0')",
50 " --lumimethod=STRING Luminosity estimate method by string \n (default=`ATLAS_PREFERRED')",
51 " -t, --trigger=STRING Trigger chain name used for prescale calculation",
52 " --livetrigger=STRING L1 Trigger used for livetime calculation \n (default=`L1_EM30')",
53 " --lar Calculate LAr defect fraction (default=off)",
54 " --lartag=STRING LAr noise burst database tag \n (default=`LARBadChannelsOflEventVeto-UPD4-01')",
55 " --beamspot Require online beamspot valid in trigger \n livefraction (default=off)",
56 " --beamspottag=STRING Online beamspot database tag \n (default=`IndetBeamposOnl-HLT-UPD1-001-00')",
57 " --scale_lumi=DOUBLE Scale luminosity with a constant value \n (default=`1.0')",
58 "\nFlags to control output:",
59 " --xml_out=STRING Output XML file name",
60 " --xml_collisionlist Output XML file of lists of collision candidates \n (default=off)",
61 " --plots Create some plots on demand (default=off)",
62 " -V, --verbose Verbose output level (default=off)",
63 " --quiet Quiet output level (default=off)",
64 0
65};

◆ gengetopt_args_info_purpose

const char* gengetopt_args_info_purpose
extern

the purpose string of the program

Definition at line 27 of file cmdline.cxx.

◆ gengetopt_args_info_usage

const char* gengetopt_args_info_usage
extern

the usage string of the program

Definition at line 29 of file cmdline.cxx.