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

keep track of a set of node pointers. More...

#include "node-container.h"

+ Collaboration diagram for ns3::NodeContainer:

Public Types

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

Public Member Functions

 NodeContainer ()
 Create an empty NodeContainer. More...
 
 NodeContainer (Ptr< Node > node)
 Create a NodeContainer with exactly one node which has been previously instantiated. More...
 
 NodeContainer (std::string nodeName)
 Create a NodeContainer with exactly one node which has been previously instantiated and assigned a name using the Object Name Service. More...
 
 NodeContainer (const NodeContainer &a, const NodeContainer &b)
 Create a node container which is a concatenation of two input NodeContainers. More...
 
 NodeContainer (const NodeContainer &a, const NodeContainer &b, const NodeContainer &c)
 Create a node container which is a concatenation of three input NodeContainers. More...
 
 NodeContainer (const NodeContainer &a, const NodeContainer &b, const NodeContainer &c, const NodeContainer &d)
 Create a node container which is a concatenation of four input NodeContainers. More...
 
 NodeContainer (const NodeContainer &a, const NodeContainer &b, const NodeContainer &c, const NodeContainer &d, const NodeContainer &e)
 Create a node container which is a concatenation of five input NodeContainers. More...
 
void Add (NodeContainer other)
 Append the contents of another NodeContainer to the end of this container. More...
 
void Add (Ptr< Node > node)
 Append a single Ptr<Node> to this container. More...
 
void Add (std::string nodeName)
 Append to this container the single Ptr<Node> referred to via its object name service registered name. More...
 
Iterator Begin (void) const
 Get an iterator which refers to the first Node in the container. More...
 
void Create (uint32_t n)
 Create n nodes and append pointers to them to the end of this NodeContainer. More...
 
void Create (uint32_t n, uint32_t systemId)
 Create n nodes with specified systemId for distributed simulations and append pointers to them to the end of this NodeContainer. More...
 
Iterator End (void) const
 Get an iterator which indicates past-the-last Node in the container. More...
 
Ptr< NodeGet (uint32_t i) const
 Get the Ptr<Node> stored in this container at a given index. More...
 
uint32_t GetN (void) const
 Get the number of Ptr<Node> stored in this container. More...
 

Static Public Member Functions

static NodeContainer GetGlobal (void)
 Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and stored in the ns3::NodeList. More...
 

Private Attributes

std::vector< Ptr< Node > > m_nodes
 Nodes smart pointers. More...
 

Detailed Description

keep track of a set of node pointers.

Typically ns-3 helpers operate on more than one node at a time. For example a device helper may want to install devices on a large number of similar nodes. The helper Install methods usually take a NodeContainer as a parameter. NodeContainers hold the multiple Ptr<Node> which are used to refer to the nodes.

Definition at line 38 of file node-container.h.

Member Typedef Documentation

typedef std::vector<Ptr<Node> >::const_iterator ns3::NodeContainer::Iterator

Node container iterator.

Definition at line 42 of file node-container.h.

Constructor & Destructor Documentation

ns3::NodeContainer::NodeContainer ( )

Create an empty NodeContainer.

Definition at line 26 of file node-container.cc.

ns3::NodeContainer::NodeContainer ( Ptr< Node node)

Create a NodeContainer with exactly one node which has been previously instantiated.

The single Node is specified by a smart pointer.

Parameters
nodeThe Ptr<Node> to add to the container.

Definition at line 30 of file node-container.cc.

References m_nodes.

ns3::NodeContainer::NodeContainer ( std::string  nodeName)

Create a NodeContainer with exactly one node which has been previously instantiated and assigned a name using the Object Name Service.

This Node is then specified by its assigned name.

Parameters
nodeNameThe name of the Node Object to add to the container.

Definition at line 34 of file node-container.cc.

References m_nodes.

ns3::NodeContainer::NodeContainer ( const NodeContainer a,
const NodeContainer b 
)

Create a node container which is a concatenation of two input NodeContainers.

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

Definition at line 39 of file node-container.cc.

References Add().

+ Here is the call graph for this function:

ns3::NodeContainer::NodeContainer ( const NodeContainer a,
const NodeContainer b,
const NodeContainer c 
)

Create a node container which is a concatenation of three input NodeContainers.

Parameters
aThe first NodeContainer
bThe second NodeContainer
cThe third NodeContainer
Note
A frequently seen idiom that uses these constructors involves the implicit conversion by constructor of Ptr<Node>. When used, two Ptr<Node> will be passed to this constructor instead of NodeContainer&. C++ will notice the implicit conversion path that goes through the NodeContainer (Ptr<Node> node) constructor above. Using this conversion one may provide optionally provide arguments of Ptr<Node> to these constructors.

Definition at line 44 of file node-container.cc.

References Add().

+ Here is the call graph for this function:

ns3::NodeContainer::NodeContainer ( const NodeContainer a,
const NodeContainer b,
const NodeContainer c,
const NodeContainer d 
)

Create a node container which is a concatenation of four input NodeContainers.

Parameters
aThe first NodeContainer
bThe second NodeContainer
cThe third NodeContainer
dThe fourth NodeContainer
Note
A frequently seen idiom that uses these constructors involves the implicit conversion by constructor of Ptr<Node>. When used, two Ptr<Node> will be passed to this constructor instead of NodeContainer&. C++ will notice the implicit conversion path that goes through the NodeContainer (Ptr<Node> node) constructor above. Using this conversion one may provide optionally provide arguments of Ptr<Node> to these constructors.

Definition at line 51 of file node-container.cc.

References Add().

+ Here is the call graph for this function:

ns3::NodeContainer::NodeContainer ( const NodeContainer a,
const NodeContainer b,
const NodeContainer c,
const NodeContainer d,
const NodeContainer e 
)

Create a node container which is a concatenation of five input NodeContainers.

Parameters
aThe first NodeContainer
bThe second NodeContainer
cThe third NodeContainer
dThe fourth NodeContainer
eThe fifth NodeContainer
Note
A frequently seen idiom that uses these constructors involves the implicit conversion by constructor of Ptr<Node>. When used, two Ptr<Node> will be passed to this constructor instead of NodeContainer&. C++ will notice the implicit conversion path that goes through the NodeContainer (Ptr<Node> node) constructor above. Using this conversion one may provide optionally provide arguments of Ptr<Node> to these constructors.

Definition at line 60 of file node-container.cc.

References Add().

+ Here is the call graph for this function:

Member Function Documentation

void ns3::NodeContainer::Add ( Ptr< Node node)

Append a single Ptr<Node> to this container.

Parameters
nodeThe Ptr<Node> to append.

Definition at line 117 of file node-container.cc.

References m_nodes.

void ns3::NodeContainer::Add ( std::string  nodeName)

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

Parameters
nodeNameThe name of the Node Object to add to the container.

Definition at line 122 of file node-container.cc.

References m_nodes.

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

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

Nodes 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 Nodes

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

Definition at line 72 of file node-container.cc.

References m_nodes.

Referenced by Add(), ns3::LteHelper::AddX2Interface(), ns3::AodvHelper::AssignStreams(), ns3::RipHelper::AssignStreams(), ns3::RipNgHelper::AssignStreams(), ns3::OlsrHelper::AssignStreams(), ns3::OnOffHelper::AssignStreams(), ns3::WaveBsmHelper::AssignStreams(), ns3::InternetStackHelper::AssignStreams(), ns3::MobilityHelper::AssignStreams(), ns3::NullMessageSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::CalculateLookAhead(), RandomRoomPositionAllocatorTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), SameRoomPositionAllocatorTestCase::DoRun(), ns3::UanHelper::EnableAscii(), ns3::MobilityHelper::EnableAscii(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), ns3::AthstatsHelper::EnableAthstats(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::SameRoomPositionAllocator::GetNext(), ns3::Ipv4NixVectorRouting::GetNodeByIp(), ns3::BuildingsHelper::Install(), ns3::V4PingHelper::Install(), ns3::PacketSocketHelper::Install(), ns3::FlowMonitorHelper::Install(), ns3::PacketSinkHelper::Install(), ns3::DsrMainHelper::Install(), ns3::Ping6Helper::Install(), ns3::EnergySourceHelper::Install(), ns3::UdpServerHelper::Install(), ns3::BulkSendHelper::Install(), ns3::OnOffHelper::Install(), ns3::UdpEchoServerHelper::Install(), ns3::FdNetDeviceHelper::Install(), ns3::LrWpanHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::TvSpectrumTransmitterHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::UdpClientHelper::Install(), ns3::MeshHelper::Install(), ns3::SimpleNetDeviceHelper::Install(), ns3::InternetStackHelper::Install(), ns3::CsmaHelper::Install(), ns3::WimaxHelper::Install(), ns3::UdpTraceClientHelper::Install(), ns3::WaveHelper::Install(), ns3::UanHelper::Install(), ns3::MobilityHelper::Install(), ns3::UdpEchoClientHelper::Install(), ns3::WifiHelper::Install(), ns3::TvSpectrumTransmitterHelper::InstallAdjacent(), ns3::LteSimpleHelper::InstallEnbDevice(), ns3::LteHelper::InstallEnbDevice(), ns3::LteSimpleHelper::InstallUeDevice(), ns3::LteHelper::InstallUeDevice(), ns3::SameRoomPositionAllocator::SameRoomPositionAllocator(), ns3::AnimationInterface::TrackIpv4Route(), NetAnimExperiment::UpdatePositions(), and Experiment::UpdatePositions().

void ns3::NodeContainer::Create ( uint32_t  n)

Create n nodes and append pointers to them to the end of this NodeContainer.

Nodes are at the heart of any ns-3 simulation. One of the first tasks that any simulation needs to do is to create a number of nodes. This method automates that task.

Parameters
nThe number of Nodes to create

Definition at line 93 of file node-container.cc.

References m_nodes.

Referenced by ns3::BriteTopologyHelper::BuildBriteTopology(), VanetRoutingExperiment::ConfigureNodes(), BatteryLifetimeTest::ConstantLoadTest(), ns3::olsr::Bug780Test::CreateNodes(), PeerManagementProtocolRegressionTest::CreateNodes(), ns3::olsr::HelloRegressionTest::CreateNodes(), Bug772ChainTest::CreateNodes(), HwmpProactiveRegressionTest::CreateNodes(), FlameRegressionTest::CreateNodes(), DsdvManetExample::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), AodvExample::CreateNodes(), HwmpDoRfRegressionTest::CreateNodes(), HwmpSimplestRegressionTest::CreateNodes(), HwmpReactiveRegressionTest::CreateNodes(), MeshTest::CreateNodes(), Ns2MobilityHelperTest::CreateNodes(), ChainRegressionTest::CreateNodes(), TestCaseHelper::CreatWaveDevice(), ns3::CsmaStarHelper::CsmaStarHelper(), BasicEnergyDepletionTest::DepletionTestCase(), IpAddressHelperTestCasev6::DoRun(), Ns3WimaxNetworkEntryTestCase::DoRun(), PacketSocketAppsTest::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), Ns3WimaxSfCreationTestCase::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), MobilityTraceTestCase::DoRun(), LenaMimoTestCase::DoRun(), WifiAcMappingTest::DoRun(), LenaHarqTestCase::DoRun(), UdpClientServerTestCase::DoRun(), LenaRrFfMacSchedulerTestCase::DoRun(), LenaDataPhyErrorModelTestCase::DoRun(), CsmaBridgeTestCase::DoRun(), LteRlcUmE2eTestCase::DoRun(), LteRlcAmE2eTestCase::DoRun(), LteRrcConnectionEstablishmentTestCase::DoRun(), LenaPfFfMacSchedulerTestCase1::DoRun(), LenaTdBetFfMacSchedulerTestCase1::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaFdBetFfMacSchedulerTestCase1::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), RandomRoomPositionAllocatorTestCase::DoRun(), LteInterferenceHardFrTestCase::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), LteLinkAdaptationTestCase::DoRun(), SpectrumIdealPhyTestCase::DoRun(), LtePathlossModelSystemTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), ns3::aodv::LoopbackTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), LteHandoverDelayTestCase::DoRun(), CarrierAggregationTestCase::DoRun(), LteEnbAntennaTestCase::DoRun(), LteCqiGenerationTestCase::DoRun(), OcbWifiMacTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), LteInterferenceTestCase::DoRun(), BriteTopologyFunctionTestCase::DoRun(), BuildingsHelperOneTestCase::DoRun(), Ns3TcpInteroperabilityTestCase::DoRun(), LenaPfFfMacSchedulerTestCase2::DoRun(), LteInterferenceStrictFrTestCase::DoRun(), LenaTdBetFfMacSchedulerTestCase2::DoRun(), LteUeMeasurementsTestCase::DoRun(), LenaDlCtrlPhyErrorModelTestCase::DoRun(), Ns3WimaxManagementConnectionsTestCase::DoRun(), LenaFdBetFfMacSchedulerTestCase2::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), EpcS1uDlTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), LteDownlinkPowerControlTestCase::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), TcFlowControlTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteHandoverTargetTestCase::DoRun(), LteHardFrTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), LteCqiGenerationDlPowerControlTestCase::DoRun(), LteUplinkOpenLoopPowerControlTestCase::DoRun(), SameRoomPositionAllocatorTestCase::DoRun(), Ns3TcpSocketTestCase2::DoRun(), CsmaBroadcastTestCase::DoRun(), LteUplinkClosedLoopPowerControlAbsoluteModeTestCase::DoRun(), LteDownlinkPowerControlRrcConnectionReconfigurationTestCase::DoRun(), LteStrictFrTestCase::DoRun(), LteUplinkClosedLoopPowerControlAccumulatedModeTestCase::DoRun(), LteUeMeasurementsPiecewiseTestCase1::DoRun(), Ns3TcpCwndTestCase1::DoRun(), UdpEchoClientSetFillTestCase::DoRun(), CsmaMulticastTestCase::DoRun(), LteStrictFrAreaTestCase::DoRun(), LteSoftFrAreaTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LteUeMeasurementsPiecewiseTestCase2::DoRun(), WaypointMobilityModelViaHelper::DoRun(), LteSoftFfrAreaTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), LteEnhancedFfrAreaTestCase::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), Ns3TcpCwndTestCase2::DoRun(), CsmaOneSubnetTestCase::DoRun(), LteUeMeasurementsHandoverTestCase::DoRun(), Bug730TestCase::DoRun(), LteRrcConnectionEstablishmentErrorTestCase::DoRun(), CsmaPacketSocketTestCase::DoRun(), CsmaPingTestCase::DoRun(), SetChannelFrequencyTest::DoRun(), CsmaRawIpSocketTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), CsmaStarTestCase::DoRun(), Bug2222TestCase::DoRun(), Ns3WimaxSchedulingTestCase::DoRunOnce(), Ns3WimaxSimpleOFDMTestCase::DoRunOnce(), Ns3WimaxSFTypeTestCase::DoRunOnce(), LinkTest::DoSetup(), LanTest::DoSetup(), TwoLinkTest::DoSetup(), TwoLanTest::DoSetup(), BridgeTest::DoSetup(), TwoBridgeTest::DoSetup(), experiment(), ns3::TvSpectrumTransmitterHelper::InstallRandomRegionalTransmitters(), LteFadingTestSuite::LteFadingTestSuite(), ns3::PointToPointDumbbellHelper::PointToPointDumbbellHelper(), ns3::PointToPointGridHelper::PointToPointGridHelper(), ns3::PointToPointStarHelper::PointToPointStarHelper(), AnimationInterfaceTestCase::PrepareNetwork(), AnimationRemainingEnergyTestCase::PrepareNetwork(), NetAnimExperiment::Run(), Experiment::Run(), RoutingExperiment::Run(), RunSimulation(), BatteryLifetimeTest::VariableLoadTest(), and WifiInterferenceTestCase::WifiSimpleInterference().

void ns3::NodeContainer::Create ( uint32_t  n,
uint32_t  systemId 
)

Create n nodes with specified systemId for distributed simulations and append pointers to them to the end of this NodeContainer.

Nodes are at the heart of any ns-3 simulation. One of the first tasks that any simulation needs to do is to create a number of nodes. This method automates that task, and adds the ability to specify systemId for distributed simulations.

Parameters
nThe number of Nodes to create
systemIdThe system id or rank associated with this node

Definition at line 101 of file node-container.cc.

References m_nodes.

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

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

Nodes 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 Nodes

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

Definition at line 77 of file node-container.cc.

References m_nodes.

Referenced by Add(), ns3::LteHelper::AddX2Interface(), ns3::AodvHelper::AssignStreams(), ns3::RipHelper::AssignStreams(), ns3::RipNgHelper::AssignStreams(), ns3::OlsrHelper::AssignStreams(), ns3::OnOffHelper::AssignStreams(), ns3::WaveBsmHelper::AssignStreams(), ns3::InternetStackHelper::AssignStreams(), ns3::MobilityHelper::AssignStreams(), ns3::NullMessageSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::CalculateLookAhead(), RandomRoomPositionAllocatorTestCase::DoRun(), LteCellSelectionTestCase::DoRun(), SameRoomPositionAllocatorTestCase::DoRun(), ns3::UanHelper::EnableAscii(), ns3::MobilityHelper::EnableAscii(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), ns3::AthstatsHelper::EnableAthstats(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::SameRoomPositionAllocator::GetNext(), ns3::Ipv4NixVectorRouting::GetNodeByIp(), ns3::BuildingsHelper::Install(), ns3::V4PingHelper::Install(), ns3::PacketSocketHelper::Install(), ns3::FlowMonitorHelper::Install(), ns3::PacketSinkHelper::Install(), ns3::DsrMainHelper::Install(), ns3::Ping6Helper::Install(), ns3::EnergySourceHelper::Install(), ns3::UdpServerHelper::Install(), ns3::BulkSendHelper::Install(), ns3::OnOffHelper::Install(), ns3::UdpEchoServerHelper::Install(), ns3::FdNetDeviceHelper::Install(), ns3::LrWpanHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::TvSpectrumTransmitterHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::UdpClientHelper::Install(), ns3::MeshHelper::Install(), ns3::SimpleNetDeviceHelper::Install(), ns3::InternetStackHelper::Install(), ns3::CsmaHelper::Install(), ns3::WimaxHelper::Install(), ns3::UdpTraceClientHelper::Install(), ns3::WaveHelper::Install(), ns3::UanHelper::Install(), ns3::MobilityHelper::Install(), ns3::UdpEchoClientHelper::Install(), ns3::WifiHelper::Install(), ns3::TvSpectrumTransmitterHelper::InstallAdjacent(), ns3::LteSimpleHelper::InstallEnbDevice(), ns3::LteHelper::InstallEnbDevice(), ns3::LteSimpleHelper::InstallUeDevice(), ns3::LteHelper::InstallUeDevice(), ns3::SameRoomPositionAllocator::SameRoomPositionAllocator(), ns3::AnimationInterface::TrackIpv4Route(), NetAnimExperiment::UpdatePositions(), and Experiment::UpdatePositions().

Ptr< Node > ns3::NodeContainer::Get ( uint32_t  i) const

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

Nodes 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<Appliation>.

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

Definition at line 88 of file node-container.cc.

References m_nodes.

Referenced by Experiment::AssignNeighbors(), ns3::PointToPointStarHelper::BoundingBox(), BuildAppsTest(), AnimationRemainingEnergyTestCase::CheckLogic(), ns3::BriteTopologyHelper::ConstructTopology(), Bug772ChainTest::CreateDevices(), ChainRegressionTest::CreateDevices(), ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::HelloRegressionTest::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), AodvExample::CreateNodes(), Ns2MobilityHelperTest::CreateNodes(), ns3::CsmaStarHelper::CsmaStarHelper(), IpAddressHelperTestCasev6::DoRun(), PacketSocketAppsTest::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LenaMimoTestCase::DoRun(), WifiAcMappingTest::DoRun(), LenaHarqTestCase::DoRun(), UdpClientServerTestCase::DoRun(), LenaRrFfMacSchedulerTestCase::DoRun(), LenaDataPhyErrorModelTestCase::DoRun(), CsmaBridgeTestCase::DoRun(), LenaPfFfMacSchedulerTestCase1::DoRun(), LenaTdBetFfMacSchedulerTestCase1::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaFdBetFfMacSchedulerTestCase1::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LteInterferenceHardFrTestCase::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), SpectrumIdealPhyTestCase::DoRun(), LtePathlossModelSystemTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), ns3::aodv::LoopbackTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), LteHandoverDelayTestCase::DoRun(), CarrierAggregationTestCase::DoRun(), OcbWifiMacTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), BriteTopologyFunctionTestCase::DoRun(), BuildingsHelperOneTestCase::DoRun(), Ns3TcpInteroperabilityTestCase::DoRun(), LenaPfFfMacSchedulerTestCase2::DoRun(), LteInterferenceStrictFrTestCase::DoRun(), LenaTdBetFfMacSchedulerTestCase2::DoRun(), LenaDlCtrlPhyErrorModelTestCase::DoRun(), LenaFdBetFfMacSchedulerTestCase2::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), EpcS1uDlTestCase::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LteCellSelectionTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), TcFlowControlTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteHandoverTargetTestCase::DoRun(), LinkTest::DoRun(), UdpTraceClientServerTestCase::DoRun(), LteUplinkOpenLoopPowerControlTestCase::DoRun(), Ns3TcpSocketTestCase2::DoRun(), LteUplinkClosedLoopPowerControlAbsoluteModeTestCase::DoRun(), CsmaBroadcastTestCase::DoRun(), LteUplinkClosedLoopPowerControlAccumulatedModeTestCase::DoRun(), ChainRegressionTest::DoRun(), LteUeMeasurementsPiecewiseTestCase1::DoRun(), Ns3TcpCwndTestCase1::DoRun(), LanTest::DoRun(), UdpEchoClientSetFillTestCase::DoRun(), CsmaMulticastTestCase::DoRun(), TwoLinkTest::DoRun(), LteStrictFrAreaTestCase::DoRun(), LteSoftFrAreaTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LteUeMeasurementsPiecewiseTestCase2::DoRun(), WaypointMobilityModelViaHelper::DoRun(), LteSoftFfrAreaTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), LteEnhancedFfrAreaTestCase::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), Ns3TcpCwndTestCase2::DoRun(), TwoLanTest::DoRun(), CsmaOneSubnetTestCase::DoRun(), LteUeMeasurementsHandoverTestCase::DoRun(), BridgeTest::DoRun(), Bug730TestCase::DoRun(), LteRrcConnectionEstablishmentErrorTestCase::DoRun(), CsmaPacketSocketTestCase::DoRun(), CsmaPingTestCase::DoRun(), TwoBridgeTest::DoRun(), SetChannelFrequencyTest::DoRun(), CsmaRawIpSocketTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), CsmaStarTestCase::DoRun(), Bug2222TestCase::DoRun(), TwoLinkTest::DoSetup(), TwoLanTest::DoSetup(), BridgeTest::DoSetup(), TwoBridgeTest::DoSetup(), experiment(), Experiment::GenerateNeighbors(), OcbWifiMacTestCase::GetCurrentPosition(), ns3::PointToPointStarHelper::GetHub(), ns3::CsmaStarHelper::GetHub(), ns3::PointToPointDumbbellHelper::GetLeft(), ns3::PointToPointDumbbellHelper::GetRight(), ns3::PointToPointStarHelper::GetSpokeNode(), ns3::CsmaStarHelper::GetSpokeNode(), ns3::PointToPointHelper::Install(), MeshTest::InstallApplication(), HwmpProactiveRegressionTest::InstallApplications(), DsdvManetExample::InstallApplications(), FlameRegressionTest::InstallApplications(), HwmpDoRfRegressionTest::InstallApplications(), HwmpSimplestRegressionTest::InstallApplications(), AodvExample::InstallApplications(), HwmpReactiveRegressionTest::InstallApplications(), ns3::PointToPointGridHelper::InstallStack(), LteFadingTestSuite::LteFadingTestSuite(), ns3::PointToPointDumbbellHelper::PointToPointDumbbellHelper(), ns3::PointToPointGridHelper::PointToPointGridHelper(), ns3::PointToPointStarHelper::PointToPointStarHelper(), AnimationInterfaceTestCase::PrepareNetwork(), AnimationRemainingEnergyTestCase::PrepareNetwork(), HwmpSimplestRegressionTest::ResetPosition(), HwmpReactiveRegressionTest::ResetPosition(), NetAnimExperiment::Run(), Experiment::Run(), RoutingExperiment::Run(), RunSimulation(), Experiment::SelectSrcDest(), Experiment::SendMultiDestinations(), ns3::LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(), RoutingHelper::SetupRoutingMessages(), and WifiInterferenceTestCase::WifiSimpleInterference().

NodeContainer ns3::NodeContainer::GetGlobal ( void  )
static

Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and stored in the ns3::NodeList.

Whenever a Node is created, a Ptr<Node> is added to a global list of all nodes in the system. It is sometimes useful to be able to get to all nodes in one place. This method creates a NodeContainer that is initialized to contain all of the simulation nodes,

Returns
a NoceContainer which contains a list of all Nodes.

Definition at line 129 of file node-container.cc.

References Add(), ns3::NodeList::Begin(), and ns3::NodeList::End().

Referenced by ns3::NullMessageSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::CalculateLookAhead(), ns3::UanHelper::EnableAsciiAll(), ns3::MobilityHelper::EnableAsciiAll(), ns3::AsciiTraceHelperForDevice::EnableAsciiAll(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4All(), ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6All(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForDevice::EnablePcapAll(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv4::EnablePcapIpv4All(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::PcapHelperForIpv6::EnablePcapIpv6All(), ns3::Ipv4NixVectorRouting::GetNodeByIp(), ns3::EnergySourceHelper::InstallAll(), ns3::InternetStackHelper::InstallAll(), and ns3::MobilityHelper::InstallAll().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Nodes 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 Nodes

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

Definition at line 83 of file node-container.cc.

References m_nodes.

Referenced by ns3::PointToPointStarHelper::AssignIpv4Addresses(), ns3::CsmaStarHelper::AssignIpv4Addresses(), ns3::PointToPointStarHelper::AssignIpv6Addresses(), ns3::CsmaStarHelper::AssignIpv6Addresses(), Experiment::AssignNeighbors(), ns3::PointToPointStarHelper::BoundingBox(), ns3::CsmaStarHelper::CsmaStarHelper(), ns3::LenaDeactivateBearerTestCase::DoRun(), RocketfuelTopologyReaderTest::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), LteX2HandoverTestCase::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), EpcS1uDlTestCase::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LteCellSelectionTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteHandoverTargetTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), LteUeMeasurementsHandoverTestCase::DoRun(), CsmaStarTestCase::DoRun(), ns3::PointToPointHelper::Install(), ns3::PointToPointGridHelper::InstallStack(), ns3::PointToPointDumbbellHelper::LeftCount(), ns3::PointToPointStarHelper::PointToPointStarHelper(), ns3::PointToPointDumbbellHelper::RightCount(), NetAnimExperiment::Run(), Experiment::Run(), Experiment::SelectSrcDest(), Experiment::SendMultiDestinations(), ns3::LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(), ns3::PointToPointStarHelper::SpokeCount(), ns3::CsmaStarHelper::SpokeCount(), and ns3::AnimationInterface::TrackIpv4Route().

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<Ptr<Node> > ns3::NodeContainer::m_nodes
private

Nodes smart pointers.

Definition at line 292 of file node-container.h.

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


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