本文整理汇总了C++中Ptr::AddApplication方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::AddApplication方法的具体用法?C++ Ptr::AddApplication怎么用?C++ Ptr::AddApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ptr
的用法示例。
在下文中一共展示了Ptr::AddApplication方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Ptr<Application>
BulkSendHelper::InstallPriv (Ptr<Node> node) const
{
Ptr<Application> app = m_factory.Create<Application> ();
node->AddApplication (app);
return app;
}
示例2: Install
ApplicationContainer RadvdHelper::Install (Ptr<Node> node)
{
ApplicationContainer apps;
Ptr<Radvd> radvd = m_factory.Create<Radvd> ();
for (RadvdInterfaceMapI iter = m_radvdInterfaces.begin(); iter != m_radvdInterfaces.end(); iter ++)
{
if (!iter->second->GetPrefixes().empty())
{
radvd->AddConfiguration(iter->second);
}
}
node->AddApplication (radvd);
apps.Add (radvd);
return apps;
}
示例3: if
Ptr<Socket> uniFlow(Address sinkAddress,
uint32_t sinkPort,
string tcpVariant,
Ptr<Node> hostNode,
Ptr<Node> sinkNode,
double startTime,
double stopTime,
uint32_t packetSize,
uint32_t numPackets,
std::string dataRate,
double appStartTime,
double appStopTime)
{
//if tcp socket is Reno set it to default and so on for Tahoe and Westwood
if(tcpVariant.compare("TcpReno") == 0)
Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue(TcpReno::GetTypeId()));
else if(tcpVariant.compare("TcpTahoe") == 0)
Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue(TcpTahoe::GetTypeId()));
else if(tcpVariant.compare("TcpWestwood") == 0)
Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue(TcpWestwood::GetTypeId()));
else
{
fprintf(stderr, "Invalid TCP version\n");
exit(EXIT_FAILURE);
}
//setup the sink
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), sinkPort));
ApplicationContainer sinkApps = packetSinkHelper.Install(sinkNode);
sinkApps.Start(Seconds(startTime));
sinkApps.Stop(Seconds(stopTime));
Ptr<Socket> ns3TcpSocket = Socket::CreateSocket(hostNode, TcpSocketFactory::GetTypeId());
//setup the source
Ptr<MyApp> app = CreateObject<MyApp>();
app->Setup(ns3TcpSocket, sinkAddress, packetSize, numPackets, DataRate(dataRate));
hostNode->AddApplication(app);
app->SetStartTime(Seconds(appStartTime));
app->SetStopTime(Seconds(appStopTime));
return ns3TcpSocket;
}