A Discrete-Event Network Simulator
API
ns3::NetDeviceContainer Class Reference

holds a vector of ns3::NetDevice pointers More...

#include "net-device-container.h"

+ Collaboration diagram for ns3::NetDeviceContainer:

Public Types

typedef std::vector< Ptr< NetDevice > >::const_iterator Iterator
 NetDevice container iterator. More...
 

Public Member Functions

 NetDeviceContainer ()
 Create an empty NetDeviceContainer. More...
 
 NetDeviceContainer (Ptr< NetDevice > dev)
 
 NetDeviceContainer (std::string devName)
 Create a NetDeviceContainer with exactly one device which has been previously instantiated and assigned a name using the Object name service. More...
 
 NetDeviceContainer (const NetDeviceContainer &a, const NetDeviceContainer &b)
 
void Add (NetDeviceContainer other)
 Append the contents of another NetDeviceContainer to the end of this container. More...
 
void Add (Ptr< NetDevice > device)
 Append a single Ptr<NetDevice> to this container. More...
 
void Add (std::string deviceName)
 Append to this container the single Ptr<NetDevice> referred to via its object name service registered name. More...
 
Iterator Begin (void) const
 Get an iterator which refers to the first NetDevice in the container. More...
 
Iterator End (void) const
 Get an iterator which indicates past-the-last NetDevice in the container. More...
 
Ptr< NetDeviceGet (uint32_t i) const
 Get the Ptr<NetDevice> stored in this container at a given index. More...
 
uint32_t GetN (void) const
 Get the number of Ptr<NetDevice> stored in this container. More...
 

Private Attributes

std::vector< Ptr< NetDevice > > m_devices
 NetDevices smart pointers. More...
 

Detailed Description

holds a vector of ns3::NetDevice pointers

Typically ns-3 NetDevices are installed on nodes using a net device helper. The helper Install method takes a NodeContainer which holds some number of Ptr<Node>. For each of the Nodes in the NodeContainer the helper will instantiate a net device, add a MAC address and a queue to the device and install it to the node. For each of the devices, the helper also adds the device into a Container for later use by the caller. This is that container used to hold the Ptr<NetDevice> which are instantiated by the device helper.

Definition at line 41 of file net-device-container.h.

Member Typedef Documentation

◆ Iterator

typedef std::vector<Ptr<NetDevice> >::const_iterator ns3::NetDeviceContainer::Iterator

NetDevice container iterator.

Definition at line 45 of file net-device-container.h.

Constructor & Destructor Documentation

◆ NetDeviceContainer() [1/4]

ns3::NetDeviceContainer::NetDeviceContainer ( )

Create an empty NetDeviceContainer.

Definition at line 26 of file net-device-container.cc.

◆ NetDeviceContainer() [2/4]

ns3::NetDeviceContainer::NetDeviceContainer ( Ptr< NetDevice dev)
Parameters
deva device to add to the container

Create a NetDeviceContainer with exactly one net device that has previously been instantiated

Definition at line 29 of file net-device-container.cc.

References m_devices.

◆ NetDeviceContainer() [3/4]

ns3::NetDeviceContainer::NetDeviceContainer ( std::string  devName)

Create a NetDeviceContainer with exactly one device which has been previously instantiated and assigned a name using the Object name service.

This NetDevice is specified by its assigned name.

Parameters
devNameThe name of the device to add to the container

Create a NetDeviceContainer with exactly one device

Definition at line 33 of file net-device-container.cc.

References m_devices.

◆ NetDeviceContainer() [4/4]

ns3::NetDeviceContainer::NetDeviceContainer ( const NetDeviceContainer a,
const NetDeviceContainer b 
)
Parameters
aa device container
banother device container

Create a device container which is a concatenation of the two input NetDeviceContainers.

Note
A frequently seen idiom that uses these constructors involves the implicit conversion by constructor of Ptr<NetDevice>. When used, two Ptr<NetDevice> will be passed to this constructor instead of NetDeviceContainer&. C++ will notice the implicit conversion path that goes through the NetDeviceContainer (Ptr<NetDevice> dev) constructor above. Using this conversion one may provide optionally provide arguments of Ptr<NetDevice> to these constructors.

Definition at line 38 of file net-device-container.cc.

References Add().

+ Here is the call graph for this function:

Member Function Documentation

◆ Add() [1/3]

void ns3::NetDeviceContainer::Add ( NetDeviceContainer  other)

Append the contents of another NetDeviceContainer to the end of this container.

Parameters
otherThe NetDeviceContainer to append.

Definition at line 67 of file net-device-container.cc.

References Begin(), End(), and m_devices.

Referenced by ns3::PointToPointDumbbellHelper::AssignIpv4Addresses(), ns3::PointToPointDumbbellHelper::AssignIpv6Addresses(), ns3::CsmaStarHelper::CsmaStarHelper(), IpAddressHelperTestCasev6::DoRun(), UdpClientServerTestCase::DoRun(), DhcpTestCase::DoRun(), CsmaBridgeTestCase::DoRun(), LteInterferenceHardFrTestCase::DoRun(), Ipv6RipngTest::DoRun(), Ipv4RipTest::DoRun(), LteCqiGenerationTestCase::DoRun(), CarrierAggregationConfigTestCase::DoRun(), LteInterferenceStrictFrTestCase::DoRun(), IcmpEchoReplyTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), UdpEchoClientSetFillTestCase::DoRun(), CsmaMulticastTestCase::DoRun(), Ipv4RipCountToInfinityTest::DoRun(), Ipv6RipngCountToInfinityTest::DoRun(), LteStrictFrAreaTestCase::DoRun(), LteSoftFrAreaTestCase::DoRun(), LteSoftFfrAreaTestCase::DoRun(), LteEnhancedFfrAreaTestCase::DoRun(), IcmpV6EchoReplyTestCase::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), Ipv6RipngSplitHorizonStrategyTest::DoRun(), Ipv4RipSplitHorizonStrategyTest::DoRun(), CsmaStarTestCase::DoRun(), TwoLinkTest::DoSetup(), TwoLanTest::DoSetup(), BridgeTest::DoSetup(), TwoBridgeTest::DoSetup(), ns3::UanHelper::EnableAscii(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AthstatsHelper::EnableAthstats(), ns3::PcapHelperForDevice::EnablePcap(), ns3::if(), ns3::SixLowPanHelper::Install(), ns3::FdNetDeviceHelper::Install(), ns3::PointToPointHelper::Install(), ns3::TvSpectrumTransmitterHelper::Install(), ns3::SimpleNetDeviceHelper::Install(), ns3::CsmaHelper::Install(), ns3::TvSpectrumTransmitterHelper::InstallAdjacent(), NetDeviceContainer(), ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), ns3::PointToPointDumbbellHelper::PointToPointDumbbellHelper(), ns3::PointToPointGridHelper::PointToPointGridHelper(), ns3::PointToPointStarHelper::PointToPointStarHelper(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), and ns3::LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice().

+ Here is the call graph for this function:

◆ Add() [2/3]

void ns3::NetDeviceContainer::Add ( Ptr< NetDevice device)

Append a single Ptr<NetDevice> to this container.

Parameters
deviceThe Ptr<NetDevice> to append.

Definition at line 75 of file net-device-container.cc.

References m_devices.

◆ Add() [3/3]

void ns3::NetDeviceContainer::Add ( std::string  deviceName)

Append to this container the single Ptr<NetDevice> referred to via its object name service registered name.

Parameters
deviceNameThe name of the NetDevice Object to add to the container.

Definition at line 80 of file net-device-container.cc.

References m_devices.

◆ Begin()

NetDeviceContainer::Iterator ns3::NetDeviceContainer::Begin ( void  ) const

Get an iterator which refers to the first NetDevice in the container.

NetDevices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the NetDevices

for (i = container.Begin (); i != container.End (); ++i)
{
(*i)->method (); // some NetDevice method
}
Returns
an iterator which refers to the first NetDevice in the container.

Definition at line 46 of file net-device-container.cc.

References m_devices.

Referenced by ns3::LteHelper::ActivateDataRadioBearer(), ns3::LteHelper::ActivateDedicatedEpsBearer(), Add(), ns3::Ipv6StaticRoutingHelper::AddMulticastRoute(), ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(), ns3::SixLowPanHelper::AssignStreams(), ns3::LrWpanHelper::AssignStreams(), ns3::CsmaHelper::AssignStreams(), ns3::MeshHelper::AssignStreams(), ns3::WaveHelper::AssignStreams(), ns3::UanHelper::AssignStreams(), ns3::WimaxHelper::AssignStreams(), ns3::WifiHelper::AssignStreams(), ns3::LteHelper::AssignStreams(), ns3::NoBackhaulEpcHelper::AssignUeIpv6Address(), ns3::LrWpanHelper::AssociateToPan(), ns3::LteHelper::Attach(), ns3::LteHelper::AttachToClosestEnb(), LteRadioLinkFailureTestCase::CheckConnected(), LteRrcConnectionEstablishmentTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteRrcConnectionEstablishmentErrorTestCase::DoRun(), ns3::UanHelper::EnableAscii(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AthstatsHelper::EnableAthstats(), ns3::PcapHelperForDevice::EnablePcap(), ns3::BridgeHelper::Install(), ns3::DeviceEnergyModelHelper::Install(), ns3::TrafficControlHelper::Install(), ns3::DhcpHelper::InstallDhcpClient(), MeshTest::Report(), and ns3::TrafficControlHelper::Uninstall().

+ Here is the caller graph for this function:

◆ End()

NetDeviceContainer::Iterator ns3::NetDeviceContainer::End ( void  ) const

Get an iterator which indicates past-the-last NetDevice in the container.

NetDevices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the NetDevices

for (i = container.Begin (); i != container.End (); ++i)
{
(*i)->method (); // some NetDevice method
}
Returns
an iterator which indicates an ending condition for a loop.

Definition at line 51 of file net-device-container.cc.

References m_devices.

Referenced by ns3::LteHelper::ActivateDataRadioBearer(), ns3::LteHelper::ActivateDedicatedEpsBearer(), Add(), ns3::Ipv6StaticRoutingHelper::AddMulticastRoute(), ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(), ns3::SixLowPanHelper::AssignStreams(), ns3::LrWpanHelper::AssignStreams(), ns3::CsmaHelper::AssignStreams(), ns3::MeshHelper::AssignStreams(), ns3::WaveHelper::AssignStreams(), ns3::UanHelper::AssignStreams(), ns3::WimaxHelper::AssignStreams(), ns3::WifiHelper::AssignStreams(), ns3::LteHelper::AssignStreams(), ns3::NoBackhaulEpcHelper::AssignUeIpv6Address(), ns3::LrWpanHelper::AssociateToPan(), ns3::LteHelper::Attach(), ns3::LteHelper::AttachToClosestEnb(), LteRadioLinkFailureTestCase::CheckConnected(), LteRrcConnectionEstablishmentTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteRrcConnectionEstablishmentErrorTestCase::DoRun(), ns3::UanHelper::EnableAscii(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AthstatsHelper::EnableAthstats(), ns3::PcapHelperForDevice::EnablePcap(), ns3::BridgeHelper::Install(), ns3::DeviceEnergyModelHelper::Install(), ns3::TrafficControlHelper::Install(), ns3::DhcpHelper::InstallDhcpClient(), MeshTest::Report(), and ns3::TrafficControlHelper::Uninstall().

+ Here is the caller graph for this function:

◆ Get()

Ptr< NetDevice > ns3::NetDeviceContainer::Get ( uint32_t  i) const

Get the Ptr<NetDevice> stored in this container at a given index.

NetDevices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the direct method and is used to retrieve the indexed Ptr<NetDevice>.

uint32_t nDevices = container.GetN ();
for (uint32_t i = 0 i < nDevices; ++i)
{
Ptr<NetDevice> p = container.Get (i)
i->method (); // some NetDevice method
}
Parameters
ithe index of the requested device pointer.
Returns
the requested device pointer.

Definition at line 62 of file net-device-container.cc.

References m_devices.

Referenced by ns3::EmuEpcHelper::AddEnb(), ns3::Ipv6AddressHelper::Assign(), ns3::Ipv4AddressHelper::Assign(), ns3::PointToPointStarHelper::AssignIpv4Addresses(), ns3::PointToPointGridHelper::AssignIpv4Addresses(), ns3::CsmaStarHelper::AssignIpv4Addresses(), ns3::PointToPointDumbbellHelper::AssignIpv4Addresses(), ns3::PointToPointStarHelper::AssignIpv6Addresses(), ns3::PointToPointGridHelper::AssignIpv6Addresses(), ns3::CsmaStarHelper::AssignIpv6Addresses(), ns3::PointToPointDumbbellHelper::AssignIpv6Addresses(), ns3::GlobalRouter::BuildNetworkLSAs(), LteRadioLinkFailureTestCase::CheckIdle(), ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), WaveformGeneratorTestCase::DoRun(), Ns3WimaxNetworkEntryTestCase::DoRun(), WifiAcMappingTest::DoRun(), Ns3WimaxSfCreationTestCase::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LenaMimoTestCase::DoRun(), LenaHarqTestCase::DoRun(), DhcpTestCase::DoRun(), LenaRrFfMacSchedulerTestCase::DoRun(), CsmaBridgeTestCase::DoRun(), LenaDataPhyErrorModelTestCase::DoRun(), LteRlcUmE2eTestCase::DoRun(), LteRlcAmE2eTestCase::DoRun(), LteRrcConnectionEstablishmentTestCase::DoRun(), Ipv4PacketInfoTagTest::DoRun(), LenaPfFfMacSchedulerTestCase1::DoRun(), LenaTdBetFfMacSchedulerTestCase1::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaFdBetFfMacSchedulerTestCase1::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LteInterferenceHardFrTestCase::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), LteLinkAdaptationTestCase::DoRun(), Ipv6ForwardingTest::DoRun(), LtePathlossModelSystemTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ns3TcpStateTestCase::DoRun(), LteEnbAntennaTestCase::DoRun(), CarrierAggregationTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), LteCqiGenerationTestCase::DoRun(), LteInterferenceTestCase::DoRun(), Ipv6PacketInfoTagTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), LteRadioLinkFailureTestCase::DoRun(), LteIpv6RoutingTestCase::DoRun(), CarrierAggregationConfigTestCase::DoRun(), LenaPfFfMacSchedulerTestCase2::DoRun(), LteInterferenceStrictFrTestCase::DoRun(), LenaTdBetFfMacSchedulerTestCase2::DoRun(), LteUeMeasurementsTestCase::DoRun(), LenaDlCtrlPhyErrorModelTestCase::DoRun(), Ns3WimaxManagementConnectionsTestCase::DoRun(), LenaFdBetFfMacSchedulerTestCase2::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), TcFlowControlTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), LteDownlinkPowerControlTestCase::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), LteCellSelectionTestCase::DoRun(), Ipv4FragmentationTest::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteHandoverTargetTestCase::DoRun(), LteHardFrTestCase::DoRun(), LteCqiGenerationDlPowerControlTestCase::DoRun(), LteUplinkOpenLoopPowerControlTestCase::DoRun(), LteUplinkClosedLoopPowerControlAbsoluteModeTestCase::DoRun(), LteDownlinkPowerControlRrcConnectionReconfigurationTestCase::DoRun(), LteStrictFrTestCase::DoRun(), LteUplinkClosedLoopPowerControlAccumulatedModeTestCase::DoRun(), LteUeMeasurementsPiecewiseTestCase1::DoRun(), UdpSocketImplTest::DoRun(), CsmaMulticastTestCase::DoRun(), LteStrictFrAreaTestCase::DoRun(), LteSoftFrAreaTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LteUeMeasurementsPiecewiseTestCase2::DoRun(), LteSoftFfrAreaTestCase::DoRun(), LteEnhancedFfrAreaTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), LteUeMeasurementsHandoverTestCase::DoRun(), Udp6SocketImplTest::DoRun(), LteRrcConnectionEstablishmentErrorTestCase::DoRun(), CsmaPacketSocketTestCase::DoRun(), ChannelAccessTestCase::DoRun(), CsmaStarTestCase::DoRun(), AnnexC_TestCase::DoRun(), Bug2222TestCase::DoRun(), Bug2843TestCase::DoRun(), Ns3WimaxSchedulingTestCase::DoRunOnce(), Ns3WimaxSimpleOFDMTestCase::DoRunOnce(), Ns3WimaxSFTypeTestCase::DoRunOnce(), BridgeTest::DoSetup(), TwoBridgeTest::DoSetup(), ns3::EmuEpcHelper::EmuEpcHelper(), GetYansWifiPhyPtr(), SetChannelFrequencyTest::GetYansWifiPhyPtr(), ns3::SixLowPanHelper::Install(), ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), NodeStatistics::NodeStatistics(), ns3::PointToPointDumbbellHelper::PointToPointDumbbellHelper(), ns3::PointToPointStarHelper::PointToPointStarHelper(), NetAnimExperiment::Run(), Experiment::Run(), TestInterBssConstantObssPdAlgo::RunOne(), Bug2470TestCase::RunSubtest(), and TestInterBssConstantObssPdAlgo::SetupSimulation().

◆ GetN()

uint32_t ns3::NetDeviceContainer::GetN ( void  ) const

Get the number of Ptr<NetDevice> stored in this container.

NetDevices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the direct method and is typically used to define an ending condition in a for-loop that runs through the stored NetDevices

uint32_t nDevices = container.GetN ();
for (uint32_t i = 0 i < nDevices; ++i)
{
Ptr<NetDevice> p = container.Get (i)
i->method (); // some NetDevice method
}
Returns
the number of Ptr<NetDevice> stored in this container.

Definition at line 57 of file net-device-container.cc.

References m_devices.

Referenced by ns3::Ipv6AddressHelper::Assign(), ns3::Ipv4AddressHelper::Assign(), ns3::PointToPointGridHelper::AssignIpv4Addresses(), ns3::PointToPointGridHelper::AssignIpv6Addresses(), ns3::Ipv6AddressHelper::AssignWithoutAddress(), ns3::LteHelper::AttachToClosestEnb(), ns3::GlobalRouter::BuildNetworkLSAs(), LteRadioLinkFailureTestCase::CheckIdle(), PeerManagementProtocolRegressionTest::CreateDevices(), HwmpProactiveRegressionTest::CreateDevices(), FlameRegressionTest::CreateDevices(), HwmpDoRfRegressionTest::CreateDevices(), HwmpSimplestRegressionTest::CreateDevices(), HwmpReactiveRegressionTest::CreateDevices(), ns3::GlobalRouter::DiscoverLSAs(), LteX2HandoverTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), CsmaStarTestCase::DoRun(), ns3::SixLowPanHelper::Install(), ns3::DeviceEnergyModelHelper::Install(), NodeStatistics::NodeStatistics(), NetAnimExperiment::Run(), Experiment::Run(), and TestInterBssConstantObssPdAlgo::RunOne().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_devices

std::vector<Ptr<NetDevice> > ns3::NetDeviceContainer::m_devices
private

NetDevices smart pointers.

Definition at line 199 of file net-device-container.h.

Referenced by Add(), Begin(), End(), Get(), GetN(), and NetDeviceContainer().


The documentation for this class was generated from the following files: