本文整理汇总了C++中ConfigObject::getConfString方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigObject::getConfString方法的具体用法?C++ ConfigObject::getConfString怎么用?C++ ConfigObject::getConfString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigObject
的用法示例。
在下文中一共展示了ConfigObject::getConfString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subnetConfig
RRDVisAnalyzer::RRDVisAnalyzer(const ConfigObject& configObject, ReporterBase& reporter)
: AnalyzerBase(configObject, reporter), configSection("rrdvisualizer"), firstFlow(true), lastFlowStart(0)
{
configFile = configObject.getConfString(configSection, "configfile");
rrdPath = configObject.getConfString(configSection, "rrdtool_path");
rrdDbPath = configObject.getConfString(configSection, "db_path");
// parse subnet config file
std::ifstream subnetConfig(configFile.c_str());
std::string token;
bool subnet = true;
std::string subnet_string;
tree = lpm_init();
std::vector<std::string> subnetList;
while (subnetConfig) {
subnetConfig >> token;
if (subnet) {
subnet_string = token;
subnet = false;
} else {
size_t pos = subnet_string.find("/");
if (pos == std::string::npos) {
throw std::runtime_error("Error: Cannot parse subnet \"" + subnet_string + "\"");
}
std::string ip = subnet_string.substr(0, pos);
std::string mask = subnet_string.substr(pos + 1, subnet_string.size());
rrdDBMap[subnet_string] = token;
lpm_insert(tree, ip.c_str(), atoi(mask.c_str()));
subnet = true;
}
}
// define the number of values that need to be aggregated
// by the rrdtools
intervals.push_back(1);
intervals.push_back(5);
intervals.push_back(30);
intervals.push_back(120);
intervals.push_back(24*60);
// graph time spans
graphTimeSpans.push_back("-1d");
graphTimeSpans.push_back("-1w");
graphTimeSpans.push_back("-1m");
graphTimeSpans.push_back("-1y");
}