NEFFy
NEFF Calculator and MSA File Converter
Loading...
Searching...
No Matches
FlagHandler Class Reference

#include <flagHandler.h>

Public Member Functions

 FlagHandler (const std::unordered_map< std::string, FlagInfo > &_flags)
 Constructor for FlagHandler.
 
void processFlags (const std::vector< std::string > &args)
 Processes the command-line arguments and updates the flag values.
 
std::string getFlagValue (const std::string &flagName) const
 Retrieves the value of a flag.
 
void checkRequiredFlags () const
 Checks if all required flags have values.
 
float getFloatValue (const std::string &name) const
 Get given float option by user.
 
float getBooleanValue (const std::string &name) const
 Get given boolean option by user.
 
std::vector< std::string > getFileArrayValue (const std::string &name) const
 Get list of files.
 
std::vector< int > getIntArrayValue (const std::string &name) const
 Get given int option by user.
 
int getIntValue (const std::string &name) const
 Get given int option by user.
 
int getNonZeroIntValue (const std::string &name) const
 Get given non-zero int option by user.
 

Private Attributes

std::unordered_map< std::string, FlagInfoflags
 

Constructor & Destructor Documentation

◆ FlagHandler()

FlagHandler::FlagHandler ( const std::unordered_map< std::string, FlagInfo > & _flags)

Constructor for FlagHandler.

Parameters
_flagsThe map of flags to be handled.

Member Function Documentation

◆ checkRequiredFlags()

void FlagHandler::checkRequiredFlags ( ) const

Checks if all required flags have values.

Exceptions
std::runtime_errorif a required flag is missing a value.

◆ getBooleanValue()

float FlagHandler::getBooleanValue ( const std::string & name) const

Get given boolean option by user.

Parameters
flagHandler
name
Returns

◆ getFileArrayValue()

vector< string > FlagHandler::getFileArrayValue ( const std::string & name) const

Get list of files.

Parameters
name
Returns

◆ getFlagValue()

string FlagHandler::getFlagValue ( const std::string & flagName) const

Retrieves the value of a flag.

Parameters
flagNameThe name of the flag.
Returns
The value of the flag.
Exceptions
std::runtime_errorif the flag is unknown.

◆ getFloatValue()

float FlagHandler::getFloatValue ( const std::string & name) const

Get given float option by user.

Parameters
flagHandler
name
Returns

◆ getIntArrayValue()

vector< int > FlagHandler::getIntArrayValue ( const std::string & name) const

Get given int option by user.

Parameters
flagHandler
name
Returns

◆ getIntValue()

int FlagHandler::getIntValue ( const std::string & name) const

Get given int option by user.

Parameters
name
Returns

◆ getNonZeroIntValue()

int FlagHandler::getNonZeroIntValue ( const std::string & name) const

Get given non-zero int option by user.

Parameters
name
Returns

◆ processFlags()

void FlagHandler::processFlags ( const std::vector< std::string > & args)

Processes the command-line arguments and updates the flag values.

Parameters
argsThe command-line arguments.
Exceptions
std::runtime_errorif a flag is unknown, missing a value, or if a required flag is missing.

Member Data Documentation

◆ flags

std::unordered_map<std::string, FlagInfo> FlagHandler::flags
private

The documentation for this class was generated from the following files:
Footer