A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::QueueDiscContainer Class Reference

Holds a vector of ns3::QueueDisc pointers. More...

#include "queue-disc-container.h"

+ Collaboration diagram for ns3::QueueDiscContainer:

Public Types

typedef std::vector< Ptr< QueueDisc > >::const_iterator ConstIterator
 QueueDisc container const iterator.
 

Public Member Functions

 QueueDiscContainer ()
 Create an empty QueueDiscContainer.
 
 QueueDiscContainer (Ptr< QueueDisc > qDisc)
 
void Add (Ptr< QueueDisc > qDisc)
 Append a single Ptr<QueueDisc> to this container.
 
void Add (QueueDiscContainer other)
 Append the contents of another QueueDiscContainer to the end of this container.
 
ConstIterator Begin () const
 Get a const iterator which refers to the first QueueDisc in the container.
 
ConstIterator End () const
 Get a const iterator which indicates past-the-last QueueDisc in the container.
 
Ptr< QueueDiscGet (std::size_t i) const
 Get the Ptr<QueueDisc> stored in this container at a given index.
 
std::size_t GetN () const
 Get the number of Ptr<QueueDisc> stored in this container.
 

Private Attributes

std::vector< Ptr< QueueDisc > > m_queueDiscs
 QueueDiscs smart pointers.
 

Detailed Description

Holds a vector of ns3::QueueDisc pointers.

Typically ns-3 QueueDiscs are installed on net devices using a traffic control helper. The helper Install method takes a NetDeviceContainer which holds some number of Ptr<NetDevice>. For each of the net devices in the NetDeviceContainer the helper will instantiate a queue disc and install it to the net device. For each of the queue discs, the helper also adds the queue disc into a Container for later use by the caller. This is that container used to hold the Ptr<QueueDisc> which are instantiated by the traffic control helper.

Definition at line 34 of file queue-disc-container.h.

Member Typedef Documentation

◆ ConstIterator

typedef std::vector<Ptr<QueueDisc>>::const_iterator ns3::QueueDiscContainer::ConstIterator

QueueDisc container const iterator.

Definition at line 38 of file queue-disc-container.h.

Constructor & Destructor Documentation

◆ QueueDiscContainer() [1/2]

ns3::QueueDiscContainer::QueueDiscContainer ( )

Create an empty QueueDiscContainer.

Definition at line 14 of file queue-disc-container.cc.

◆ QueueDiscContainer() [2/2]

ns3::QueueDiscContainer::QueueDiscContainer ( Ptr< QueueDisc > qDisc)
Parameters
qDisca queue disc to add to the container

Create a QueueDiscContainer with exactly one queue disc that has previously been instantiated

Definition at line 18 of file queue-disc-container.cc.

References m_queueDiscs.

Member Function Documentation

◆ Add() [1/2]

void ns3::QueueDiscContainer::Add ( Ptr< QueueDisc > qDisc)

Append a single Ptr<QueueDisc> to this container.

Parameters
qDiscThe Ptr<QueueDisc> to append.

Definition at line 57 of file queue-disc-container.cc.

References m_queueDiscs.

◆ Add() [2/2]

void ns3::QueueDiscContainer::Add ( QueueDiscContainer other)

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

Parameters
otherThe QueueDiscContainer to append.

Definition at line 48 of file queue-disc-container.cc.

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

+ Here is the call graph for this function:

◆ Begin()

QueueDiscContainer::ConstIterator ns3::QueueDiscContainer::Begin ( ) const

Get a const iterator which refers to the first QueueDisc in the container.

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

for (i = container.Begin (); i != container.End (); ++i)
{
(*i)->method (); // some QueueDisc method
}
std::vector< Ptr< QueueDisc > >::const_iterator ConstIterator
QueueDisc container const iterator.
Returns
a const iterator which refers to the first QueueDisc in the container.

Definition at line 24 of file queue-disc-container.cc.

References m_queueDiscs.

Referenced by Add().

+ Here is the caller graph for this function:

◆ End()

QueueDiscContainer::ConstIterator ns3::QueueDiscContainer::End ( ) const

Get a const iterator which indicates past-the-last QueueDisc in the container.

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

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

Definition at line 30 of file queue-disc-container.cc.

References m_queueDiscs.

Referenced by Add().

+ Here is the caller graph for this function:

◆ Get()

Ptr< QueueDisc > ns3::QueueDiscContainer::Get ( std::size_t i) const

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

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

uint32_t nQueueDiscs = container.GetN ();
for (uint32_t i = 0 i < nQueueDiscs; ++i)
{
Ptr<QueueDisc> p = container.Get (i)
i->method (); // some QueueDisc method
}
Smart pointer class similar to boost::intrusive_ptr.
Parameters
ithe index of the requested queue disc pointer.
Returns
the requested queue disc pointer.

Definition at line 42 of file queue-disc-container.cc.

References m_queueDiscs.

Referenced by UdpSocketImplTest::DoRun(), and experiment().

+ Here is the caller graph for this function:

◆ GetN()

std::size_t ns3::QueueDiscContainer::GetN ( ) const

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

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

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

Definition at line 36 of file queue-disc-container.cc.

References m_queueDiscs.

Member Data Documentation

◆ m_queueDiscs

std::vector<Ptr<QueueDisc> > ns3::QueueDiscContainer::m_queueDiscs
private

QueueDiscs smart pointers.

Definition at line 156 of file queue-disc-container.h.

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


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