mmCEsim 0.3.0
mmWave Channel Estimation Simulation
Config Class Reference

User configuration. More...

#include <config.h>

Public Member Functions

 Config ()
 Construct a new Config object. More...
 
std::string operator[] (const std::string &key) const
 Read the key. More...
 
bool set (const std::string &key, const std::string &v)
 Set the key value. More...
 
size_t size () const noexcept
 
bool write () const
 

Static Public Member Functions

static std::string read (const std::string &key, std::string *msg=nullptr)
 
static std::string read (const std::string &key, const std::string &default_val, std::string *msg=nullptr)
 
static bool edit (const std::string &key, const std::string &v, std::string *msg=nullptr)
 

Private Member Functions

bool _load ()
 

Private Attributes

YAML::Node _config
 

Detailed Description

User configuration.

Provide read and write portal.

Constructor & Destructor Documentation

◆ Config()

Config::Config ( )

Construct a new Config object.

This is a default constructor.

Here is the call graph for this function:

Member Function Documentation

◆ _load()

bool Config::_load ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ edit()

bool Config::edit ( const std::string &  key,
const std::string &  v,
std::string *  msg = nullptr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]()

std::string Config::operator[] ( const std::string &  key) const

Read the key.

Exceptions
Astd::runtime_error will be thrown if the key cannot be correctly accessed.
Parameters
keyThe key.
Returns
(std::string) The value.
Here is the call graph for this function:

◆ read() [1/2]

std::string Config::read ( const std::string &  key,
const std::string &  default_val,
std::string *  msg = nullptr 
)
static
Here is the call graph for this function:

◆ read() [2/2]

std::string Config::read ( const std::string &  key,
std::string *  msg = nullptr 
)
static
Here is the caller graph for this function:

◆ set()

bool Config::set ( const std::string &  key,
const std::string &  v 
)

Set the key value.

It will only set the key value when the key exists. Return false if the key does not exist.

Exceptions
Astd::runtime_error will be thrown if the key exists but the value cannot be set.
Parameters
keyThe key.
vThe value.
Return values
trueSuccessfully set the key.
falseFailed to set the key.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

size_t Config::size ( ) const
inlinenoexcept

◆ write()

bool Config::write ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _config

YAML::Node Config::_config
private

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