当前位置: 首页>>代码示例>>C++>>正文


C++ Ptr::AddApplication方法代码示例

本文整理汇总了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;
}
开发者ID:shuiziliuBUPT,项目名称:HelloWorld,代码行数:8,代码来源:bulk-send-helper.cpp

示例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;
}
开发者ID:shuiziliuBUPT,项目名称:HelloWorld,代码行数:15,代码来源:radvd-helper.cpp

示例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;
}
开发者ID:bee2502,项目名称:Computer-Networks-Lab,代码行数:46,代码来源:simulator.c


注:本文中的Ptr::AddApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。