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
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Stefano Avallone <stavallo@unina.it>
18
*/
19
20
#ifndef QUEUE_DISC_CONTAINER_H
21
#define QUEUE_DISC_CONTAINER_H
22
23
#include "ns3/queue-disc.h"
24
25
#include <stdint.h>
26
#include <vector>
27
28
namespace
ns3
29
{
30
31
/**
32
* \ingroup traffic-control
33
*
34
* \brief Holds a vector of ns3::QueueDisc pointers.
35
*
36
* Typically ns-3 QueueDiscs are installed on net devices using a traffic control
37
* helper. The helper Install method takes a NetDeviceContainer which holds
38
* some number of Ptr<NetDevice>. For each of the net devices in the
39
* NetDeviceContainer the helper will instantiate a queue disc and install
40
* it to the net device. For each of the queue discs, the helper also
41
* adds the queue disc into a Container for later use by the caller.
42
* This is that container used to hold the Ptr<QueueDisc> which are
43
* instantiated by the traffic control helper.
44
*/
45
class
QueueDiscContainer
46
{
47
public
:
48
/// QueueDisc container const iterator
49
typedef
std::vector<Ptr<QueueDisc>>::const_iterator
ConstIterator
;
50
51
/**
52
* Create an empty QueueDiscContainer.
53
*/
54
QueueDiscContainer
();
55
56
/**
57
* \param qDisc a queue disc to add to the container
58
*
59
* Create a QueueDiscContainer with exactly one queue disc that has previously
60
* been instantiated
61
*/
62
QueueDiscContainer
(
Ptr<QueueDisc>
qDisc);
63
64
/**
65
* \brief Get a const iterator which refers to the first QueueDisc in the
66
* container.
67
*
68
* QueueDiscs can be retrieved from the container in two ways. First,
69
* directly by an index into the container, and second, using an iterator.
70
* This method is used in the iterator method and is typically used in a
71
* for-loop to run through the QueueDiscs
72
*
73
* \code
74
* QueueDiscContainer::ConstIterator i;
75
* for (i = container.Begin (); i != container.End (); ++i)
76
* {
77
* (*i)->method (); // some QueueDisc method
78
* }
79
* \endcode
80
*
81
* \returns a const iterator which refers to the first QueueDisc in the container.
82
*/
83
ConstIterator
Begin
()
const
;
84
85
/**
86
* \brief Get a const iterator which indicates past-the-last QueueDisc in the
87
* container.
88
*
89
* QueueDiscs can be retrieved from the container in two ways. First,
90
* directly by an index into the container, and second, using an iterator.
91
* This method is used in the iterator method and is typically used in a
92
* for-loop to run through the QueueDiscs
93
*
94
* \code
95
* QueueDiscContainer::ConstIterator i;
96
* for (i = container.Begin (); i != container.End (); ++i)
97
* {
98
* (*i)->method (); // some QueueDisc method
99
* }
100
* \endcode
101
*
102
* \returns a const iterator which indicates an ending condition for a loop.
103
*/
104
ConstIterator
End
()
const
;
105
106
/**
107
* \brief Get the number of Ptr<QueueDisc> stored in this container.
108
*
109
* QueueDiscs can be retrieved from the container in two ways. First,
110
* directly by an index into the container, and second, using an iterator.
111
* This method is used in the direct method and is typically used to
112
* define an ending condition in a for-loop that runs through the stored
113
* QueueDiscs
114
*
115
* \code
116
* uint32_t nQueueDiscs = container.GetN ();
117
* for (uint32_t i = 0 i < nQueueDiscs; ++i)
118
* {
119
* Ptr<QueueDisc> p = container.Get (i)
120
* i->method (); // some QueueDisc method
121
* }
122
* \endcode
123
*
124
* \returns the number of Ptr<QueueDisc> stored in this container.
125
*/
126
std::size_t
GetN
()
const
;
127
128
/**
129
* \brief Get the Ptr<QueueDisc> stored in this container at a given
130
* index.
131
*
132
* QueueDiscs can be retrieved from the container in two ways. First,
133
* directly by an index into the container, and second, using an iterator.
134
* This method is used in the direct method and is used to retrieve the
135
* indexed Ptr<QueueDisc>.
136
*
137
* \code
138
* uint32_t nQueueDiscs = container.GetN ();
139
* for (uint32_t i = 0 i < nQueueDiscs; ++i)
140
* {
141
* Ptr<QueueDisc> p = container.Get (i)
142
* i->method (); // some QueueDisc method
143
* }
144
* \endcode
145
*
146
* \param i the index of the requested queue disc pointer.
147
* \returns the requested queue disc pointer.
148
*/
149
Ptr<QueueDisc>
Get
(std::size_t i)
const
;
150
151
/**
152
* \brief Append the contents of another QueueDiscContainer to the end of
153
* this container.
154
*
155
* \param other The QueueDiscContainer to append.
156
*/
157
void
Add
(
QueueDiscContainer
other);
158
159
/**
160
* \brief Append a single Ptr<QueueDisc> to this container.
161
*
162
* \param qDisc The Ptr<QueueDisc> to append.
163
*/
164
void
Add
(
Ptr<QueueDisc>
qDisc);
165
166
private
:
167
std::vector<Ptr<QueueDisc>>
m_queueDiscs
;
//!< QueueDiscs smart pointers
168
};
169
170
}
// namespace ns3
171
172
#endif
/* QUEUE_DISC_CONTAINER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::QueueDiscContainer
Holds a vector of ns3::QueueDisc pointers.
Definition:
queue-disc-container.h:46
ns3::QueueDiscContainer::Add
void Add(QueueDiscContainer other)
Append the contents of another QueueDiscContainer to the end of this container.
Definition:
queue-disc-container.cc:59
ns3::QueueDiscContainer::m_queueDiscs
std::vector< Ptr< QueueDisc > > m_queueDiscs
QueueDiscs smart pointers.
Definition:
queue-disc-container.h:167
ns3::QueueDiscContainer::QueueDiscContainer
QueueDiscContainer()
Create an empty QueueDiscContainer.
Definition:
queue-disc-container.cc:25
ns3::QueueDiscContainer::Begin
ConstIterator Begin() const
Get a const iterator which refers to the first QueueDisc in the container.
Definition:
queue-disc-container.cc:35
ns3::QueueDiscContainer::End
ConstIterator End() const
Get a const iterator which indicates past-the-last QueueDisc in the container.
Definition:
queue-disc-container.cc:41
ns3::QueueDiscContainer::ConstIterator
std::vector< Ptr< QueueDisc > >::const_iterator ConstIterator
QueueDisc container const iterator.
Definition:
queue-disc-container.h:49
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:53
ns3::QueueDiscContainer::GetN
std::size_t GetN() const
Get the number of Ptr<QueueDisc> stored in this container.
Definition:
queue-disc-container.cc:47
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
traffic-control
helper
queue-disc-container.h
Generated on Tue May 28 2024 23:39:40 for ns-3 by
1.9.6