本文整理汇总了C++中Ptr::AggregateObject方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::AggregateObject方法的具体用法?C++ Ptr::AggregateObject怎么用?C++ Ptr::AggregateObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ptr
的用法示例。
在下文中一共展示了Ptr::AggregateObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
AddInternetStack (Ptr<Node> node)
{
//IPV6
Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
//Routing for Ipv6
Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
ipv6->SetRoutingProtocol (ipv6Routing);
Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
node->AggregateObject (ipv6);
//ICMPv6
Ptr<Icmpv6L4Protocol> icmp6 = CreateObject<Icmpv6L4Protocol> ();
node->AggregateObject (icmp6);
//Ipv6 Extensions
ipv6->RegisterExtensions ();
ipv6->RegisterOptions ();
//UDP
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
node->AggregateObject (udp);
}
示例2:
Ptr<FaceContainer>
StackHelper::Install(Ptr<Node> node) const
{
Ptr<FaceContainer> faces = Create<FaceContainer>();
if (node->GetObject<L3Protocol>() != 0) {
NS_FATAL_ERROR("Cannot re-install NDN stack on node "
<< node->GetId());
return 0;
}
Ptr<L3Protocol> ndn = m_ndnFactory.Create<L3Protocol>();
ndn->getConfig().put("tables.cs_max_packets", (m_maxCsSize == 0) ? 1 : m_maxCsSize);
// Create and aggregate content store if NFD's contest store has been disabled
if (m_maxCsSize == 0) {
ndn->AggregateObject(m_contentStoreFactory.Create<ContentStore>());
}
// Aggregate L3Protocol on node (must be after setting ndnSIM CS)
node->AggregateObject(ndn);
for (uint32_t index = 0; index < node->GetNDevices(); index++) {
Ptr<NetDevice> device = node->GetDevice(index);
// This check does not make sense: LoopbackNetDevice is installed only if IP stack is installed,
// Normally, ndnSIM works without IP stack, so no reason to check
// if (DynamicCast<LoopbackNetDevice> (device) != 0)
// continue; // don't create face for a LoopbackNetDevice
faces->Add(this->createAndRegisterFace(node, ndn, device));
}
return faces;
}
示例3:
Ptr<Ipv4RoutingProtocol>
AodvHelper::Create (Ptr<Node> node) const
{
Ptr<aodv::RoutingProtocol> agent = m_agentFactory.Create<aodv::RoutingProtocol> ();
node->AggregateObject (agent);
return agent;
}
示例4: switch
Ptr<MobilityModel>
BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index)
{
/*
* The purpose of this method is to defer the creation of the
* MobilityModel instances to when DoRun() is called. In a previous
* version, MobilityModel instances where created directly in the
* constructor of the test suite, which caused subtle bugs due to
* "static initialization order fiasco". An example of such a subtle
* bug is that logging via NS_LOG failed for some modules.
*
*/
double hm = 1;
double hb = 30;
double henbHeight = 10.0;
Ptr<MobilityModel> mm;
switch (index)
{
case 1:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (0.0, 0.0, hb));
break;
case 2:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (2000, 0.0, hm));
break;
case 3:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (100, 0.0, hm));
break;
case 4:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (900, 0.0, hm));
break;
case 5:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (-5, 0.0, hm));
break;
case 6:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (-5, 30, henbHeight));
break;
case 7:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (-2000, 0.0, hm));
break;
case 8:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (-100, 0.0, hm));
break;
case 9:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (0, 0.0, hm));
break;
case 10:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (-100, 0.0, henbHeight));
break;
case 11:
mm = CreateObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (-500, 0.0, henbHeight));
break;
default:
mm = 0;
break;
}
Ptr<MobilityBuildingInfo> buildingInfo = CreateObject<MobilityBuildingInfo> ();
mm->AggregateObject (buildingInfo); // operation usually done by BuildingsHelper::Install
BuildingsHelper::MakeConsistent (mm);
return mm;
}