A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Private Attributes | List of all members
ns3::QueueDiscContainer Class Reference

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

#include "queue-disc-container.h"

Public Types

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

Public Member Functions

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

Private Attributes

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

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 44 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 48 of file queue-disc-container.h.

Constructor & Destructor Documentation

◆ QueueDiscContainer() [1/2]

ns3::QueueDiscContainer::QueueDiscContainer ( )

Create an empty QueueDiscContainer.

Definition at line 25 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 29 of file queue-disc-container.cc.

References m_queueDiscs.

Member Function Documentation

◆ Add() [1/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 59 of file queue-disc-container.cc.

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

Referenced by ns3::TrafficControlHelper::Install().

◆ Add() [2/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 68 of file queue-disc-container.cc.

References m_queueDiscs.

◆ Begin()

QueueDiscContainer::ConstIterator ns3::QueueDiscContainer::Begin ( void  ) 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
}
Returns
a const iterator which refers to the first QueueDisc in the container.

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

References m_queueDiscs.

Referenced by Add().

◆ End()

QueueDiscContainer::ConstIterator ns3::QueueDiscContainer::End ( void  ) 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 41 of file queue-disc-container.cc.

References m_queueDiscs.

Referenced by Add().

◆ 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
}
Parameters
ithe index of the requested queue disc pointer.
Returns
the requested queue disc pointer.

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

References m_queueDiscs.

Referenced by UdpSocketImplTest::DoRun().

◆ GetN()

std::size_t ns3::QueueDiscContainer::GetN ( void  ) 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 47 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 166 of file queue-disc-container.h.

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


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