本文整理汇总了C++中NodeSet::channelsUsed方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeSet::channelsUsed方法的具体用法?C++ NodeSet::channelsUsed怎么用?C++ NodeSet::channelsUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeSet
的用法示例。
在下文中一共展示了NodeSet::channelsUsed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeNetworksSection
void writeNetworksSection(std::ostream& out, NodeSet& ns)
{
out << "# Networks" << std::endl;
NetworkSet& nets = ns.networksUsed();
NetworkSet::iterator it = nets.begin();
while (it != nets.end())
{
Network* n = *it;
out << "SUBNET " << n->address;
out << " { ";
std::set<Node*>::iterator nit = n->nodes.begin();
double lat = 0.0;
double lon = 0.0;
double alt = 0.0;
while (nit != n->nodes.end())
{
out << (*nit)->NodeId << " ";
lat += (*nit)->entity->worldLocation.lat;
lon += (*nit)->entity->worldLocation.lon;
alt += (*nit)->entity->worldLocation.alt;
nit++;
}
lat = lat / (1.0*n->nodes.size());
lon = lon / (1.0*n->nodes.size());
alt = alt / (1.0*n->nodes.size());
out << "} " << lat << " " << lon << " " << alt << std::endl;
std::stringstream mask;
ChannelSet::iterator cit = ns.channelsUsed().begin();
while (cit != ns.channelsUsed().end())
{
if (*cit == n->channel)
{
mask << "1";
}
else
{
mask << "0";
}
cit++;
}
out << "[ " << n->address << "] PHY-LISTENABLE-CHANNEL-MASK "
<< mask.str() << std::endl;
out << "[ " << n->address << "] PHY-LISTENING-CHANNEL-MASK "
<< mask.str() << std::endl;
out << std::endl;
it++;
}
}
示例2: writeConfigFile
void ConfigFileWriter::writeConfigFile(std::string filename, NodeSet& ns)
{
std::fstream out;
out.open(filename.c_str(), std::fstream::out | std::fstream::trunc);
writeGeneralSection(out, Config::instance());
writeTerrainSection(out, Config::instance());
writePositionSection(out, Config::instance());
writeMobilitySection(out, Config::instance());
writeProgagationSection(out, Config::instance(), ns.channelsUsed());
writeNetworksSection(out, ns);
writePhysicalSection(out, Config::instance(), ns);
writeStatisticsSection(out, Config::instance());
writeHostnameSection(out, ns);
writeNodeIconSection(out, ns, Config::instance());
writeSlotsFile(out, Config::instance(), ns);
if (Config::instance().externalInterfaceType == "HLA13"
|| Config::instance().externalInterfaceType == "HLA1516")
{
writeHLASection(out, Config::instance());
}
else if (Config::instance().externalInterfaceType == "DIS")
{
writeDISSection(out, Config::instance());
}
writeComponentSection(out, ns);
out.close();
}