-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArgumentParser.hpp
50 lines (36 loc) · 888 Bytes
/
ArgumentParser.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __ARGUMENTPARSER__H__
#define __ARGUMENTPARSER__H__
#define INVALID_ARUMENT_ERROR 2
#define MISSING_ARGUMENT_ERROR 3
struct Arguments
{
int dieselTruckCount;
int electricTruckCount;
int dieselFuelCapacity;
int electricFuelCapacity;
int dieselFuelConsumption;
int electricFuelConsumption;
int packageManufacturingTime;
int simulationDuration;
};
class ArgumentParser
{
private:
// Argument count
int argc;
// Argument values
char **argv;
// Helper function to check for arguments in an optional argument
bool optionalArgumentIsPresent();
// Get the value of the argument
std::string getArgument();
// Get the value of the argument as a number
int getNumericArgument();
// Print help
void printHelp();
public:
ArgumentParser(int argc, char **argv);
// Parse the arguments
Arguments parse(Arguments &arguments);
};
#endif //!__ARGUMENTPARSER__H__