本文整理汇总了C++中NodeSet::modelsUsed方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeSet::modelsUsed方法的具体用法?C++ NodeSet::modelsUsed怎么用?C++ NodeSet::modelsUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeSet
的用法示例。
在下文中一共展示了NodeSet::modelsUsed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeRouterModelFile
void ConfigFileWriter::writeRouterModelFile(std::string filename,
NodeSet& ns)
{
std::fstream out;
std::set<std::string>::iterator it = ns.modelsUsed().begin();
if (it != ns.modelsUsed().end())
{
out.open(filename.c_str(), std::fstream::out | std::fstream::trunc);
}
while (it != ns.modelsUsed().end())
{
ParameterMap* parameters = Config::instance().getModelParameterList(*it);
const Parameter& model = parameters->getParameter("ROUTER-MODEL");
if (model != Parameter::unknownParameter)
{
out << model << std::endl;
ParameterMap::iterator pit = parameters->begin();
while (pit != parameters->end())
{
if (pit->first != "ROUTER-MODEL")
out << pit->second << std::endl;
pit++;
}
out << std::endl;
}
it++;
}
}
示例2: writePhysicalSection
void writePhysicalSection(std::ostream& out, Config& config, NodeSet& ns)
{
out << "# Physical" << std::endl;
NetworkSet& nets = ns.networksUsed();
std::string defaultModel =
config.getParameter("VRLINK-DEFAULT-ROUTER-MODEL").value;
std::set<std::string> models;
NetworkSet::iterator nit = nets.begin();
while (nit != nets.end())
{
if ((*nit)->models.size() == 0)
{
models.insert(defaultModel);
}
else
{
models.insert((*nit)->models.begin(), (*nit)->models.end());
}
nit++;
}
if (models.size() == 1)
{
ParameterMap* parameters = config.getModelParameterList(*models.begin());
if (parameters)
{
writeParameters(out, "", parameters);
}
}
else if (models.size() > 1)
{
nit = nets.begin();
while (nit != nets.end())
{
Network* n = *nit;
ParameterMap* common = n->getCommonParameters();
std::stringstream subnet;
subnet << "[" << n->address << "]";
writeParameters(out, subnet.str(), common);
std::set<std::string>::iterator mit = n->models.begin();
while (mit != n->models.end())
{
ParameterMap* parameters = config.getModelParameterList(*mit);
ParameterMap* specfic = *parameters - *common;
std::string group = n->getGroup(*mit);
if (parameters && !group.empty())
{
writeParameters(out, group, specfic);
}
delete specfic;
mit++;
}
nit++;
}
}
std::set<std::string>::iterator it = ns.modelsUsed().begin();
if (it != ns.modelsUsed().end())
{
out << config.getParameter("ROUTER-MODEL-CONFIG-FILE") << std::endl;
}
}