ConfigDataBars class.
More...
#include <ConfigDataBars.hpp>
◆ ConfigDataBars()
ConfigDataBars::ConfigDataBars |
( |
| ) |
|
Construct a new ConfigDataBars object.
std::vector< std::shared_ptr< ConfigDataBar > > bars_
Definition: ConfigDataBars.hpp:91
◆ ~ConfigDataBars()
ConfigDataBars::~ConfigDataBars |
( |
| ) |
|
|
override |
◆ addBar()
void ConfigDataBars::addBar |
( |
const std::string & |
barName, |
|
|
std::shared_ptr< ConfigDataBar > |
bar |
|
) |
| |
◆ configInit()
void ConfigDataBars::configInit |
( |
const Json::Value & |
root_ | ) |
|
|
overridevirtual |
Initialize the ConfigDataBars object You must call configInit() in each ConfigDataBase Child class to load the data.
- Parameters
-
root_ | Json::Value& object containing the Bar configuration data |
- Todo:
- use of a smart pointer to store the ConfigDataBar objects
Implements ConfigDataBase.
34 if (root.empty() || !root.isArray()) {
35 throw std::runtime_error(
"Invalid configuration file");
37 for (
auto &bar : root) {
38 auto barData = std::make_shared<ConfigDataBar>();
39 barData->configInit(bar);
40 size_t newIndex =
bars_.size();
41 bars_.emplace_back(barData);
@ L_INFO
Definition: Logger.hpp:49
virtual void Log(const std::string &message, LogLevel level) const
Log a message This method logs a message to the log file or stream. The message is only logged if the...
Definition: Logger.cpp:73
static Logger * GetInstance()
Get the Logger object.
Definition: Logger.cpp:41
References bars_, Logger::GetInstance(), L_INFO, and Logger::Log().
◆ configSave()
Json::Value ConfigDataBars::configSave |
( |
| ) |
|
|
overridevirtual |
return a Json::Value object containing the Bars configuration data
Implements ConfigDataBase.
◆ getBar()
Get the Bar object at index.
- Parameters
-
49 {
return bars_[index]; }
References bars_.
◆ getBars()
const std::vector< ConfigDataBar * > & ConfigDataBars::getBars |
( |
| ) |
const |
◆ removeBar()
void ConfigDataBars::removeBar |
( |
int |
index | ) |
|
Remove the Bar object at index.
- Parameters
-
References bars_.
◆ bars_
std::vector<std::shared_ptr<ConfigDataBar> > ConfigDataBars::bars_ |
|
private |
The documentation for this class was generated from the following files: