Aggie Student Toolkit — Load Balancer CSCE 412 Project 4
Arnav Fotedar · Fall 2026 · C++ load balancer simulation
Loading...
Searching...
No Matches
Config.h File Reference

Declares the Config structure and the command-line and interactive input functions. More...

#include <cstdint>
#include <iosfwd>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  Config
 Every user-adjustable setting for one simulation run. More...

Functions

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.
void printUsage (std::ostream &out, const std::string &program)
 Prints the list of command-line options.

Detailed Description

Declares the Config structure and the command-line and interactive input functions.

Author
Arnav Fotedar

Definition in file Config.h.

Function Documentation

◆ parseArguments()

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.

Parameters
argcArgument count from main().
argvArgument values from main().
configReceives the parsed settings.
errorReceives a message when parsing fails.
Returns
False if an option is unknown or a value is malformed.

Definition at line 95 of file Config.cpp.

◆ promptForSettings()

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.

Parameters
configSettings to update.
inStream to read answers from.
outStream to write questions to.

Definition at line 201 of file Config.cpp.

◆ validateConfig()

bool validateConfig ( const Config & config,
std::string & error )

Checks that the settings are consistent.

Parameters
configSettings to check.
errorReceives a message describing the first problem found.
Returns
True if the settings can be simulated.

Definition at line 214 of file Config.cpp.

◆ printUsage()

void printUsage ( std::ostream & out,
const std::string & program )

Prints the list of command-line options.

Parameters
outStream to write to.
programProgram name shown in the usage line.

Definition at line 61 of file Config.cpp.