A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
queue-disc-container.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Universita' degli Studi di Napoli Federico II
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Stefano Avallone <stavallo@unina.it>
7
*/
8
9
#ifndef QUEUE_DISC_CONTAINER_H
10
#define QUEUE_DISC_CONTAINER_H
11
12
#include "ns3/queue-disc.h"
13
14
#include <stdint.h>
15
#include <vector>
16
17
namespace
ns3
18
{
19
20
/**
21
* \ingroup traffic-control
22
*
23
* \brief Holds a vector of ns3::QueueDisc pointers.
24
*
25
* Typically ns-3 QueueDiscs are installed on net devices using a traffic control
26
* helper. The helper Install method takes a NetDeviceContainer which holds
27
* some number of Ptr<NetDevice>. For each of the net devices in the
28
* NetDeviceContainer the helper will instantiate a queue disc and install
29
* it to the net device. For each of the queue discs, the helper also
30
* adds the queue disc into a Container for later use by the caller.
31
* This is that container used to hold the Ptr<QueueDisc> which are
32
* instantiated by the traffic control helper.
33
*/
34
class
QueueDiscContainer
35
{
36
public
:
37
/// QueueDisc container const iterator
38
typedef
std::vector<Ptr<QueueDisc>>::const_iterator
ConstIterator
;
39
40
/**
41
* Create an empty QueueDiscContainer.
42
*/
43
QueueDiscContainer
();
44
45
/**
46
* \param qDisc a queue disc to add to the container
47
*
48
* Create a QueueDiscContainer with exactly one queue disc that has previously
49
* been instantiated
50
*/
51
QueueDiscContainer
(
Ptr<QueueDisc>
qDisc);
52
53
/**
54
* \brief Get a const iterator which refers to the first QueueDisc in the
55
* container.
56
*
57
* QueueDiscs can be retrieved from the container in two ways. First,
58
* directly by an index into the container, and second, using an iterator.
59
* This method is used in the iterator method and is typically used in a
60
* for-loop to run through the QueueDiscs
61
*
62
* \code
63
* QueueDiscContainer::ConstIterator i;
64
* for (i = container.Begin (); i != container.End (); ++i)
65
* {
66
* (*i)->method (); // some QueueDisc method
67
* }
68
* \endcode
69
*
70
* \returns a const iterator which refers to the first QueueDisc in the container.
71
*/
72
ConstIterator
Begin
()
const
;
73
74
/**
75
* \brief Get a const iterator which indicates past-the-last QueueDisc in the
76
* container.
77
*
78
* QueueDiscs can be retrieved from the container in two ways. First,
79
* directly by an index into the container, and second, using an iterator.
80
* This method is used in the iterator method and is typically used in a
81
* for-loop to run through the QueueDiscs
82
*
83
* \code
84
* QueueDiscContainer::ConstIterator i;
85
* for (i = container.Begin (); i != container.End (); ++i)
86
* {
87
* (*i)->method (); // some QueueDisc method
88
* }
89
* \endcode
90
*
91
* \returns a const iterator which indicates an ending condition for a loop.
92
*/
93
ConstIterator
End
()
const
;
94
95
/**
96
* \brief Get the number of Ptr<QueueDisc> stored in this container.
97
*
98
* QueueDiscs can be retrieved from the container in two ways. First,
99
* directly by an index into the container, and second, using an iterator.
100
* This method is used in the direct method and is typically used to
101
* define an ending condition in a for-loop that runs through the stored
102
* QueueDiscs
103
*
104
* \code
105
* uint32_t nQueueDiscs = container.GetN ();
106
* for (uint32_t i = 0 i < nQueueDiscs; ++i)
107
* {
108
* Ptr<QueueDisc> p = container.Get (i)
109
* i->method (); // some QueueDisc method
110
* }
111
* \endcode
112
*
113
* \returns the number of Ptr<QueueDisc> stored in this container.
114
*/
115
std::size_t
GetN
()
const
;
116
117
/**
118
* \brief Get the Ptr<QueueDisc> stored in this container at a given
119
* index.
120
*
121
* QueueDiscs can be retrieved from the container in two ways. First,
122
* directly by an index into the container, and second, using an iterator.
123
* This method is used in the direct method and is used to retrieve the
124
* indexed Ptr<QueueDisc>.
125
*
126
* \code
127
* uint32_t nQueueDiscs = container.GetN ();
128
* for (uint32_t i = 0 i < nQueueDiscs; ++i)
129
* {
130
* Ptr<QueueDisc> p = container.Get (i)
131
* i->method (); // some QueueDisc method
132
* }
133
* \endcode
134
*
135
* \param i the index of the requested queue disc pointer.
136
* \returns the requested queue disc pointer.
137
*/
138
Ptr<QueueDisc>
Get
(std::size_t i)
const
;
139
140
/**
141
* \brief Append the contents of another QueueDiscContainer to the end of
142
* this container.
143
*
144
* \param other The QueueDiscContainer to append.
145
*/
146
void
Add
(
QueueDiscContainer
other);
147
148
/**
149
* \brief Append a single Ptr<QueueDisc> to this container.
150
*
151
* \param qDisc The Ptr<QueueDisc> to append.
152
*/
153
void
Add
(
Ptr<QueueDisc>
qDisc);
154
155
private
:
156
std::vector<Ptr<QueueDisc>>
m_queueDiscs
;
//!< QueueDiscs smart pointers
157
};
158
159
}
// namespace ns3
160
161
#endif
/* QUEUE_DISC_CONTAINER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::QueueDiscContainer
Holds a vector of ns3::QueueDisc pointers.
Definition
queue-disc-container.h:35
ns3::QueueDiscContainer::Add
void Add(QueueDiscContainer other)
Append the contents of another QueueDiscContainer to the end of this container.
Definition
queue-disc-container.cc:48
ns3::QueueDiscContainer::m_queueDiscs
std::vector< Ptr< QueueDisc > > m_queueDiscs
QueueDiscs smart pointers.
Definition
queue-disc-container.h:156
ns3::QueueDiscContainer::QueueDiscContainer
QueueDiscContainer()
Create an empty QueueDiscContainer.
Definition
queue-disc-container.cc:14
ns3::QueueDiscContainer::Begin
ConstIterator Begin() const
Get a const iterator which refers to the first QueueDisc in the container.
Definition
queue-disc-container.cc:24
ns3::QueueDiscContainer::End
ConstIterator End() const
Get a const iterator which indicates past-the-last QueueDisc in the container.
Definition
queue-disc-container.cc:30
ns3::QueueDiscContainer::ConstIterator
std::vector< Ptr< QueueDisc > >::const_iterator ConstIterator
QueueDisc container const iterator.
Definition
queue-disc-container.h:38
ns3::QueueDiscContainer::Get
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
Definition
queue-disc-container.cc:42
ns3::QueueDiscContainer::GetN
std::size_t GetN() const
Get the number of Ptr<QueueDisc> stored in this container.
Definition
queue-disc-container.cc:36
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
traffic-control
helper
queue-disc-container.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0