ns-3
ns3::NodeContainer Class Reference

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

#include <node-container.h>

List of all members.

Public Types

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

Public Member Functions

 NodeContainer ()
 NodeContainer (Ptr< Node > node)
 NodeContainer (std::string nodeName)
 NodeContainer (const NodeContainer &a, const NodeContainer &b)
 NodeContainer (const NodeContainer &a, const NodeContainer &b, const NodeContainer &c)
 NodeContainer (const NodeContainer &a, const NodeContainer &b, const NodeContainer &c, const NodeContainer &d)
 NodeContainer (const NodeContainer &a, const NodeContainer &b, const NodeContainer &c, const NodeContainer &d, const NodeContainer &e)
Iterator Begin (void) const
 Get an iterator which refers to the first Node in the container.
Iterator End (void) const
 Get an iterator which indicates past-the-last Node in the container.
uint32_t GetN (void) const
 Get the number of Ptr<Node> stored in this container.
Ptr< NodeGet (uint32_t i) const
 Get the Ptr<Node> stored in this container at a given index.
void Create (uint32_t n)
 Create n nodes and append pointers to them to the end of this NodeContainer.
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.
void Add (NodeContainer other)
 Append the contents of another NodeContainer to the end of this container.
void Add (Ptr< Node > node)
 Append a single Ptr<Node> to this container.
void Add (std::string nodeName)
 Append to this container the single Ptr<Node> referred to via its object name service registered name.

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.

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.


Constructor & Destructor Documentation

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

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.

References Add().

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.

References Add().

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.

References Add().

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.

References Add().


Member Function Documentation

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

Parameters:
otherThe NodeContainer to append.

References Begin(), and End().

Referenced by GetGlobal(), NodeContainer(), ns3::RocketfuelTopologyReader::Read(), ns3::OrbisTopologyReader::Read(), and ns3::InetTopologyReader::Read().

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

Append a single Ptr<Node> to this container.

Parameters:
nodeThe Ptr<Node> to append.
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.
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

   NodeContainer::Iterator i;
   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.

Referenced by Add(), ns3::UanHelper::EnableAscii(), ns3::MobilityHelper::EnableAscii(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::V4PingHelper::Install(), ns3::FlowMonitorHelper::Install(), ns3::PacketSocketHelper::Install(), ns3::PacketSinkHelper::Install(), ns3::OnOffHelper::Install(), ns3::Ping6Helper::Install(), ns3::UdpServerHelper::Install(), ns3::EnergySourceHelper::Install(), ns3::BulkSendHelper::Install(), ns3::LteHelper::Install(), ns3::UdpEchoServerHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::EmuHelper::Install(), ns3::UdpClientHelper::Install(), ns3::InternetStackHelper::Install(), ns3::WifiHelper::Install(), ns3::MeshHelper::Install(), ns3::UdpTraceClientHelper::Install(), ns3::CsmaHelper::Install(), ns3::WimaxHelper::Install(), ns3::UdpEchoClientHelper::Install(), ns3::UanHelper::Install(), and ns3::MobilityHelper::Install().

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

Referenced by ns3::CsmaStarHelper::CsmaStarHelper(), ns3::PointToPointDumbbellHelper::PointToPointDumbbellHelper(), ns3::PointToPointGridHelper::PointToPointGridHelper(), and ns3::PointToPointStarHelper::PointToPointStarHelper().

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

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

Referenced by Add(), ns3::UanHelper::EnableAscii(), ns3::MobilityHelper::EnableAscii(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), GetGlobal(), ns3::V4PingHelper::Install(), ns3::FlowMonitorHelper::Install(), ns3::PacketSocketHelper::Install(), ns3::PacketSinkHelper::Install(), ns3::OnOffHelper::Install(), ns3::Ping6Helper::Install(), ns3::UdpServerHelper::Install(), ns3::EnergySourceHelper::Install(), ns3::BulkSendHelper::Install(), ns3::LteHelper::Install(), ns3::UdpEchoServerHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::EmuHelper::Install(), ns3::UdpClientHelper::Install(), ns3::InternetStackHelper::Install(), ns3::WifiHelper::Install(), ns3::MeshHelper::Install(), ns3::UdpTraceClientHelper::Install(), ns3::CsmaHelper::Install(), ns3::WimaxHelper::Install(), ns3::UdpEchoClientHelper::Install(), ns3::UanHelper::Install(), and ns3::MobilityHelper::Install().

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.

Referenced by ns3::PointToPointStarHelper::BoundingBox(), ns3::CsmaStarHelper::CsmaStarHelper(), ns3::CsmaStarHelper::GetHub(), ns3::PointToPointStarHelper::GetHub(), ns3::PointToPointDumbbellHelper::GetLeft(), ns3::PointToPointDumbbellHelper::GetRight(), ns3::PointToPointStarHelper::GetSpokeNode(), ns3::CsmaStarHelper::GetSpokeNode(), ns3::PointToPointHelper::Install(), ns3::PointToPointGridHelper::InstallStack(), ns3::PointToPointDumbbellHelper::PointToPointDumbbellHelper(), ns3::PointToPointGridHelper::PointToPointGridHelper(), and ns3::PointToPointStarHelper::PointToPointStarHelper().

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.

Referenced by ns3::PointToPointStarHelper::AssignIpv4Addresses(), ns3::CsmaStarHelper::AssignIpv4Addresses(), ns3::PointToPointStarHelper::BoundingBox(), ns3::CsmaStarHelper::CsmaStarHelper(), ns3::PointToPointHelper::Install(), ns3::PointToPointGridHelper::InstallStack(), ns3::PointToPointDumbbellHelper::LeftCount(), ns3::PointToPointStarHelper::PointToPointStarHelper(), ns3::PointToPointDumbbellHelper::RightCount(), ns3::PointToPointStarHelper::SpokeCount(), and ns3::CsmaStarHelper::SpokeCount().


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