Class Config

Class Documentation

class switchml::Config

A class that is responsible for parsing and representing all configurable options for SwitchML.

Public Functions

Config() = default
~Config() = default
Config(Config const&) = default
void operator=(Config const&)
Config(Config&&) = default
Config &operator=(Config&&) = default
bool LoadFromFile(std::string path = "")

Read and parse the configuration file.

Parameters

path[in] the path of the configuration file or nullptr. If the path was ommited then the function looks for the file in the following default paths in order: 1- /etc/switchml.cfg 2- ./switchml.cfg 3- ./switchml-<hostname>.cfg (Ex. ./switchml-node12.config)

Returns

loading was successfull

Returns

loading failed.

void Validate()

Make sure configuration values are valid.

If a misconfiguration is fatal then it shuts the program down.

void PrintConfig()

Print all configuration options.

Public Members

struct GeneralConfig general_

General configuration options

struct BackendConfig backend_

Backend specific configuration options