|
Aggie Student Toolkit — Load Balancer CSCE 412 Project 4
Arnav Fotedar · Fall 2026 · C++ load balancer simulation
|
Implements command-line parsing, interactive prompts and validation for Config. More...
#include "Config.h"#include <istream>#include <ostream>#include <random>#include <sstream>#include <type_traits>#include "Firewall.h"Go to the source code of this file.
Functions | |
| void | printUsage (std::ostream &out, const std::string &program) |
| Prints the list of command-line options. | |
| bool | parseArguments (int argc, char *argv[], Config &config, std::string &error) |
| Reads command-line options into a Config. | |
| void | promptForSettings (Config &config, std::istream &in, std::ostream &out) |
| Asks the user for the main settings, keeping the current value when the answer is blank. | |
| bool | validateConfig (const Config &config, std::string &error) |
| Checks that the settings are consistent. | |
Implements command-line parsing, interactive prompts and validation for Config.
Definition in file Config.cpp.
| void printUsage | ( | std::ostream & | out, |
| const std::string & | program ) |
Prints the list of command-line options.
| out | Stream to write to. |
| program | Program name shown in the usage line. |
Definition at line 61 of file Config.cpp.
| bool parseArguments | ( | int | argc, |
| char * | argv[], | ||
| Config & | config, | ||
| std::string & | error ) |
Reads command-line options into a Config.
Running with no options (or only –no-color) turns on interactive mode so the user is asked for the main settings.
| argc | Argument count from main(). |
| argv | Argument values from main(). |
| config | Receives the parsed settings. |
| error | Receives a message when parsing fails. |
Definition at line 95 of file Config.cpp.
| void promptForSettings | ( | Config & | config, |
| std::istream & | in, | ||
| std::ostream & | out ) |
Asks the user for the main settings, keeping the current value when the answer is blank.
| config | Settings to update. |
| in | Stream to read answers from. |
| out | Stream to write questions to. |
Definition at line 201 of file Config.cpp.
| bool validateConfig | ( | const Config & | config, |
| std::string & | error ) |
Checks that the settings are consistent.
| config | Settings to check. |
| error | Receives a message describing the first problem found. |
Definition at line 214 of file Config.cpp.