FOUND
Loading...
Searching...
No Matches
parser.cpp File Reference
#include "command-line/parsing/parser.hpp"
#include <getopt.h>
#include <string>
#include <memory>
#include <iostream>
#include "common/logging.hpp"
#include "common/style.hpp"
#include "command-line/parsing/options.hpp"
Include dependency graph for parser.cpp:

Namespaces

namespace  found
 

Macros

#define OPTIONAL_OPTARG()
 Determines whether the current flag allows an optional argument AND if that argument exists To Fully Test this, you must:
 
#define REQ_ASSIGN(options, prop, value, default)    options.prop = (value);
 Assigns a flag with a required value.
 
#define OPT_ASSIGN(options, prop, value, default)
 Assigns a flag with an optional value.
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)    prop,
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)    prop,
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)    prop,
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)
 
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc)
 

Functions

CalibrationOptions found::ParseCalibrationOptions (int argc, char **argv)
 Parses the calibration options from the command line to run the calibration algorithm.
 
DistanceOptions found::ParseDistanceOptions (int argc, char **argv)
 Parses the distance options from the command line to run the distance determination algorithm.
 
OrbitOptions found::ParseOrbitOptions (int argc, char **argv)
 Parses the orbit options from the command line to run the orbit determination algorithm.
 

Variables

int optind = 2
 This defines the global variable optind, used for keeping track of parsing for command-line arguments.
 
const char found::kNoDefaultArgument = 0
 For macro processing.
 

Macro Definition Documentation

◆ FOUND_CLI_OPTION [1/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)     prop,

◆ FOUND_CLI_OPTION [2/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)
Value:
{name, \
defaultArg == kNoDefaultArgument ? required_argument : optional_argument, \
0, \
static_cast<int>(ClientOption::prop)},

◆ FOUND_CLI_OPTION [3/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)
Value:
case static_cast<int>(ClientOption::prop): \
ASSIGN(options, prop, converter, defaultArg) \
break;

◆ FOUND_CLI_OPTION [4/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)     prop,

◆ FOUND_CLI_OPTION [5/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)
Value:
{name, \
defaultArg == kNoDefaultArgument ? required_argument : optional_argument, \
0, \
static_cast<int>(ClientOption::prop)},

◆ FOUND_CLI_OPTION [6/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)
Value:
case static_cast<int>(ClientOption::prop): \
ASSIGN(options, prop, converter, defaultArg) \
break;

◆ FOUND_CLI_OPTION [7/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)     prop,

◆ FOUND_CLI_OPTION [8/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)
Value:
{name, \
defaultArg == kNoDefaultArgument ? required_argument : optional_argument, \
0, \
static_cast<int>(ClientOption::prop)},

◆ FOUND_CLI_OPTION [9/9]

#define FOUND_CLI_OPTION (   name,
  type,
  prop,
  defaultVal,
  converter,
  defaultArg,
  ASSIGN,
  doc 
)
Value:
case static_cast<int>(ClientOption::prop): \
ASSIGN(options, prop, converter, defaultArg) \
break;

◆ OPT_ASSIGN

#define OPT_ASSIGN (   options,
  prop,
  value,
  default 
)
Value:
if (OPTIONAL_OPTARG()) { \
options.prop = value; \
} else { \
options.prop = default; \
}
#define OPTIONAL_OPTARG()
Determines whether the current flag allows an optional argument AND if that argument exists To Fully ...
Definition parser.cpp:27

Assigns a flag with an optional value.

Parameters
optionsThe options object that has the flag
propThe name of the prop within options
valueThe value to assign
defaultThe default value
Precondition
Must be used with FOUND_CLI_OPTION

◆ OPTIONAL_OPTARG

#define OPTIONAL_OPTARG ( )
Value:
((optarg == NULL && optind < argc && argv[optind][0] != '-') \
? static_cast<bool>(optarg = argv[optind++]) \
: (optarg != NULL))
int optind
This defines the global variable optind, used for keeping track of parsing for command-line arguments...
Definition parser.cpp:16

Determines whether the current flag allows an optional argument AND if that argument exists To Fully Test this, you must:

  • Use the flag with an argument
  • Use the flag with no argument
  • Use the flag with an equals sign and value all in one token
  • Use the flag at the end of the command line

◆ REQ_ASSIGN

#define REQ_ASSIGN (   options,
  prop,
  value,
  default 
)     options.prop = (value);

Assigns a flag with a required value.

Parameters
optionsThe options object that has the flag
propThe name of the prop within options
valueThe value to assign
defaultNot used

Variable Documentation

◆ optind

int optind = 2

This defines the global variable optind, used for keeping track of parsing for command-line arguments.