A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
queue.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7// The queue base class has a limit on its size, in terms of number of
8// packets or number of bytes depending on the operating mode.
9// The base class implements tracing and basic statistics calculations.
10
11#ifndef QUEUE_H
12#define QUEUE_H
13
14#include "queue-fwd.h"
15#include "queue-item.h"
16#include "queue-size.h"
17
18#include "ns3/log.h"
19#include "ns3/object.h"
20#include "ns3/packet.h"
21#include "ns3/traced-callback.h"
22#include "ns3/traced-value.h"
23
24#include <sstream>
25#include <string>
26#include <type_traits>
27
28namespace ns3
29{
30
31/**
32 * \ingroup network
33 * \defgroup queue Queue
34 */
35
36/**
37 * \ingroup queue
38 * \brief Abstract base class for packet Queues
39 *
40 * This class defines the subset of the base APIs for packet queues in the ns-3 system
41 * that is independent of the type of enqueued objects
42 */
43class QueueBase : public Object
44{
45 public:
46 /**
47 * \brief Get the type ID.
48 * \return the object TypeId
49 */
50 static TypeId GetTypeId();
51
52 QueueBase();
53 ~QueueBase() override;
54
55 /**
56 * \brief Append the item type to the provided type ID if the latter does not
57 * end with '>'
58 *
59 * \param typeId the type ID
60 * \param itemType the item type
61 *
62 * This method is meant to be invoked by helpers to save users from
63 * specifying the type of items stored in a queue. For instance,
64 * PointToPointHelper::SetQueue calls
65 *
66 * \code
67 * QueueBase::AppendItemTypeIfNotPresent (type, "Packet");
68 * \endcode
69 *
70 * where type specifies the queue type (e.g., "ns3::DropTailQueue").
71 * This allows users to call SetQueue ("ns3::DropTailQueue")
72 * instead of SetQueue ("ns3::DropTailQueue<Packet>")
73 */
74 static void AppendItemTypeIfNotPresent(std::string& typeId, const std::string& itemType);
75
76 /**
77 * \return true if the queue is empty; false otherwise
78 */
79 bool IsEmpty() const;
80
81 /**
82 * \return The number of packets currently stored in the Queue
83 */
84 uint32_t GetNPackets() const;
85
86 /**
87 * \return The number of bytes currently occupied by the packets in the Queue
88 */
89 uint32_t GetNBytes() const;
90
91 /**
92 * \return The current size of the Queue in terms of packets, if the maximum
93 * size is specified in packets, or bytes, otherwise
94 */
96
97 /**
98 * \return The total number of bytes received by this Queue since the
99 * simulation began, or since ResetStatistics was called, according to
100 * whichever happened more recently
101 */
103
104 /**
105 * \return The total number of packets received by this Queue since the
106 * simulation began, or since ResetStatistics was called, according to
107 * whichever happened more recently
108 */
110
111 /**
112 * \return The total number of bytes dropped by this Queue since the
113 * simulation began, or since ResetStatistics was called, according to
114 * whichever happened more recently
115 */
117
118 /**
119 * \return The total number of bytes dropped before enqueue by this Queue
120 * since the simulation began, or since ResetStatistics was called, according
121 * to whichever happened more recently
122 */
124
125 /**
126 * \return The total number of bytes dropped after dequeue by this Queue
127 * since the simulation began, or since ResetStatistics was called, according
128 * to whichever happened more recently
129 */
131
132 /**
133 * \return The total number of packets dropped by this Queue since the
134 * simulation began, or since ResetStatistics was called, according to
135 * whichever happened more recently
136 */
138
139 /**
140 * \return The total number of packets dropped before enqueue by this Queue
141 * since the simulation began, or since ResetStatistics was called, according
142 * to whichever happened more recently
143 */
145
146 /**
147 * \return The total number of packets dropped after dequeue by this Queue
148 * since the simulation began, or since ResetStatistics was called, according
149 * to whichever happened more recently
150 */
152
153 /**
154 * Resets the counts for dropped packets, dropped bytes, received packets, and
155 * received bytes.
156 */
157 void ResetStatistics();
158
159 /**
160 * \brief Set the maximum size of this queue
161 *
162 * Trying to set a null size has no effect.
163 *
164 * \param size the maximum size
165 */
166 void SetMaxSize(QueueSize size);
167
168 /**
169 * \return the maximum size of this queue
170 */
171 QueueSize GetMaxSize() const;
172
173 /**
174 * \brief Check if the queue would overflow with additional bytes or packets
175 * Note: the check is performed according to the queue's operating mode (bytes or packets).
176 * \param nPackets number of additional packets
177 * \param nBytes number of additional bytes
178 * \return true if the queue should overflow, false otherwise.
179 */
180 bool WouldOverflow(uint32_t nPackets, uint32_t nBytes) const;
181
182#if 0
183 // average calculation requires keeping around
184 // a buffer with the date of arrival of past received packets
185 // which are within the average window
186 // so, it is quite costly to do it all the time.
187 // Hence, it is disabled by default and must be explicitly
188 // enabled with this method which specifies the size
189 // of the average window in time units.
190 void EnableRunningAverage(Time averageWindow);
191 void DisableRunningAverage();
192 // average
193 double GetQueueSizeAverage();
194 double GetReceivedBytesPerSecondAverage();
195 double GetReceivedPacketsPerSecondAverage();
196 double GetDroppedBytesPerSecondAverage();
197 double GetDroppedPacketsPerSecondAverage();
198 // variance
199 double GetQueueSizeVariance();
200 double GetReceivedBytesPerSecondVariance();
201 double GetReceivedPacketsPerSecondVariance();
202 double GetDroppedBytesPerSecondVariance();
203 double GetDroppedPacketsPerSecondVariance();
204#endif
205
206 protected:
207 TracedValue<uint32_t> m_nBytes; //!< Number of bytes in the queue
208 uint32_t m_nTotalReceivedBytes; //!< Total received bytes
209 TracedValue<uint32_t> m_nPackets; //!< Number of packets in the queue
210 uint32_t m_nTotalReceivedPackets; //!< Total received packets
211 uint32_t m_nTotalDroppedBytes; //!< Total dropped bytes
212 uint32_t m_nTotalDroppedBytesBeforeEnqueue; //!< Total dropped bytes before enqueue
213 uint32_t m_nTotalDroppedBytesAfterDequeue; //!< Total dropped bytes after dequeue
214 uint32_t m_nTotalDroppedPackets; //!< Total dropped packets
215 uint32_t m_nTotalDroppedPacketsBeforeEnqueue; //!< Total dropped packets before enqueue
216 uint32_t m_nTotalDroppedPacketsAfterDequeue; //!< Total dropped packets after dequeue
217
218 QueueSize m_maxSize; //!< max queue size
219};
220
221/**
222 * \ingroup queue
223 * \brief Template class for packet Queues
224 *
225 * This class defines the subset of the base APIs for packet queues in the ns-3 system
226 * that is dependent on the type of enqueued objects.
227 *
228 * Queue is a template class. The type of the objects stored within the queue
229 * is specified by the type parameter, which can be any class providing a
230 * GetSize () method (e.g., Packet, QueueDiscItem, etc.). Subclasses need to
231 * implement the Enqueue, Dequeue, Remove and Peek methods, and are
232 * encouraged to leverage the DoEnqueue, DoDequeue, DoRemove, and DoPeek
233 * methods in doing so, to ensure that appropriate trace sources are called
234 * and statistics are maintained. The template parameter specifies the type of
235 * container used internally to store queue items. The container type must provide
236 * the methods insert(), erase() and clear() and define the iterator and const_iterator
237 * types, following the usual syntax of C++ containers. The default container type
238 * is std::list (as defined in queue-fwd.h). In case the container is such that
239 * an object stored within the queue is obtained from a container element through
240 * an operation other than dereferencing an iterator pointing to the container
241 * element, the container has to provide a public method named GetItem that
242 * returns the object stored within the queue that is included in the container
243 * element pointed to by a given const iterator.
244 *
245 * Users of the Queue template class usually hold a queue through a smart pointer,
246 * hence forward declaration is recommended to avoid pulling the implementation
247 * of the templates included in this file. Thus, include queue-fwd.h, which
248 * provides a forward declaration for the Queue class that defines the default
249 * value for the template template parameter, instead of queue.h in your .h file.
250 * Then, include queue.h in the corresponding .cc file.
251 *
252 * \tparam Item \explicit Type of the objects stored within the queue
253 * \tparam Container \explicit Type of the container that stores queue items
254 */
255template <typename Item, typename Container>
256class Queue : public QueueBase
257{
258 public:
259 /**
260 * \brief Get the type ID.
261 * \return the object TypeId
262 */
264
266 ~Queue() override;
267
268 /**
269 * Place an item into the Queue (each subclass defines the position)
270 * \param item item to enqueue
271 * \return True if the operation was successful; false otherwise
272 */
273 virtual bool Enqueue(Ptr<Item> item) = 0;
274
275 /**
276 * Remove an item from the Queue (each subclass defines the position),
277 * counting it and tracing it as dequeued
278 * \return 0 if the operation was not successful; the item otherwise.
279 */
280 virtual Ptr<Item> Dequeue() = 0;
281
282 /**
283 * Remove an item from the Queue (each subclass defines the position),
284 * counting it and tracing it as both dequeued and dropped
285 * \return 0 if the operation was not successful; the item otherwise.
286 */
287 virtual Ptr<Item> Remove() = 0;
288
289 /**
290 * Get a copy of an item in the queue (each subclass defines the position)
291 * without removing it
292 * \return 0 if the operation was not successful; the item otherwise.
293 */
294 virtual Ptr<const Item> Peek() const = 0;
295
296 /**
297 * Flush the queue by calling Remove() on each item enqueued. Note that
298 * this operation will cause dequeue and drop counts to be incremented and
299 * traces to be triggered for each Remove() action.
300 */
301 void Flush();
302
303 /// Define ItemType as the type of the stored elements
304 typedef Item ItemType;
305
306 protected:
307 /// Const iterator.
308 typedef typename Container::const_iterator ConstIterator;
309 /// Iterator.
310 typedef typename Container::iterator Iterator;
311
312 /**
313 * Get a const reference to the container of queue items.
314 *
315 * \return a const reference to the container of queue items
316 */
317 const Container& GetContainer() const;
318
319 /**
320 * Push an item in the queue
321 * \param pos the position before which the item will be inserted
322 * \param item the item to enqueue
323 * \return true if success, false if the packet has been dropped.
324 */
326
327 /**
328 * Push an item in the queue
329 * \param pos the position before which the item will be inserted
330 * \param item the item to enqueue
331 * \param[out] ret an iterator pointing to the inserted value
332 * \return true if success, false if the packet has been dropped.
333 */
335
336 /**
337 * Pull the item to dequeue from the queue
338 * \param pos the position of the item to dequeue
339 * \return the item.
340 */
342
343 /**
344 * Pull the item to drop from the queue
345 * \param pos the position of the item to remove
346 * \return the item.
347 */
349
350 /**
351 * Peek the front item in the queue
352 * \param pos the position of the item to peek
353 * \return the item.
354 */
356
357 /**
358 * \brief Drop a packet before enqueue
359 * \param item item that was dropped
360 *
361 * This method is called by the base class when a packet is dropped because
362 * the queue is full and by the subclasses to notify parent (this class) that
363 * a packet has been dropped for other reasons before being enqueued.
364 */
366
367 /**
368 * \brief Drop a packet after dequeue
369 * \param item item that was dropped
370 *
371 * This method is called by the base class when a Remove operation is requested
372 * and by the subclasses to notify parent (this class) that a packet has been
373 * dropped for other reasons after being dequeued.
374 */
376
377 /** \copydoc ns3::Object::DoDispose */
378 void DoDispose() override;
379
380 private:
381 /**
382 * Struct providing a static method returning the object stored within the queue
383 * that is included in the container element pointed to by the given const iterator.
384 * This method is used when the container does not define a GetItem method and
385 * assumes that an object stored in the queue can be obtained by dereferencing the
386 * iterator pointing to the container element that includes such an object.
387 */
388 template <class, class = void>
390 {
391 /**
392 * \param it the given const iterator
393 * \return the item included in the element pointed to by the given iterator
394 */
395 static Ptr<Item> GetItem(const Container&, const ConstIterator it)
396 {
397 return *it;
398 }
399 };
400
401 /**
402 * Struct providing a static method returning the object stored within the queue
403 * that is included in the container element pointed to by the given const iterator.
404 * This method is used when the container defines a GetItem method and is simply a
405 * wrapper to invoke such a method.
406 */
407 template <class T>
409 T,
410 std::void_t<decltype(std::declval<T>().GetItem(std::declval<ConstIterator>()))>>
411 {
412 /**
413 * \param container the container
414 * \param it the given const iterator
415 * \return the item included in the element pointed to by the given iterator
416 */
417 static Ptr<Item> GetItem(const Container& container, const ConstIterator it)
418 {
419 return container.GetItem(it);
420 }
421 };
422
423 Container m_packets; //!< the items in the queue
424 NS_LOG_TEMPLATE_DECLARE; //!< the log component
425
426 /// Traced callback: fired when a packet is enqueued
428 /// Traced callback: fired when a packet is dequeued
430 /// Traced callback: fired when a packet is dropped
432 /// Traced callback: fired when a packet is dropped before enqueue
434 /// Traced callback: fired when a packet is dropped after dequeue
436};
437
438/**
439 * Implementation of the templates declared above.
440 */
441
442template <typename Item, typename Container>
443TypeId
445{
447 auto startPos = name.find('<') + 1;
448 auto endPos = name.find_first_of(",>", startPos);
449 std::string tcbName = "ns3::" + name.substr(startPos, endPos - startPos) + "::TracedCallback";
450
451 static TypeId tid =
452 TypeId(name)
454 .SetGroupName("Network")
455 .AddTraceSource("Enqueue",
456 "Enqueue a packet in the queue.",
458 tcbName)
459 .AddTraceSource("Dequeue",
460 "Dequeue a packet from the queue.",
462 tcbName)
463 .AddTraceSource("Drop",
464 "Drop a packet (for whatever reason).",
466 tcbName)
467 .AddTraceSource(
468 "DropBeforeEnqueue",
469 "Drop a packet before enqueue.",
471 tcbName)
472 .AddTraceSource(
473 "DropAfterDequeue",
474 "Drop a packet after dequeue.",
476 tcbName);
477 return tid;
478}
479
480template <typename Item, typename Container>
485
486template <typename Item, typename Container>
490
491template <typename Item, typename Container>
492const Container&
494{
495 return m_packets;
496}
497
498template <typename Item, typename Container>
499bool
501{
502 Iterator ret;
503 return DoEnqueue(pos, item, ret);
504}
505
506template <typename Item, typename Container>
507bool
509{
510 NS_LOG_FUNCTION(this << item);
511
512 if (GetCurrentSize() + item > GetMaxSize())
513 {
514 NS_LOG_LOGIC("Queue full -- dropping pkt");
515 DropBeforeEnqueue(item);
516 return false;
517 }
518
519 ret = m_packets.insert(pos, item);
520
521 uint32_t size = item->GetSize();
522 m_nBytes += size;
523 m_nTotalReceivedBytes += size;
524
525 m_nPackets++;
526 m_nTotalReceivedPackets++;
527
528 NS_LOG_LOGIC("m_traceEnqueue (p)");
529 m_traceEnqueue(item);
530
531 return true;
532}
533
534template <typename Item, typename Container>
537{
538 NS_LOG_FUNCTION(this);
539
540 if (m_nPackets.Get() == 0)
541 {
542 NS_LOG_LOGIC("Queue empty");
543 return nullptr;
544 }
545
546 Ptr<Item> item = MakeGetItem<Container>::GetItem(m_packets, pos);
547
548 if (item)
549 {
550 m_packets.erase(pos);
551 NS_ASSERT(m_nBytes.Get() >= item->GetSize());
552 NS_ASSERT(m_nPackets.Get() > 0);
553
554 m_nBytes -= item->GetSize();
555 m_nPackets--;
556
557 NS_LOG_LOGIC("m_traceDequeue (p)");
558 m_traceDequeue(item);
559 }
560 return item;
561}
562
563template <typename Item, typename Container>
566{
567 NS_LOG_FUNCTION(this);
568
569 if (m_nPackets.Get() == 0)
570 {
571 NS_LOG_LOGIC("Queue empty");
572 return nullptr;
573 }
574
575 Ptr<Item> item = MakeGetItem<Container>::GetItem(m_packets, pos);
576
577 if (item)
578 {
579 m_packets.erase(pos);
580 NS_ASSERT(m_nBytes.Get() >= item->GetSize());
581 NS_ASSERT(m_nPackets.Get() > 0);
582
583 m_nBytes -= item->GetSize();
584 m_nPackets--;
585
586 // packets are first dequeued and then dropped
587 NS_LOG_LOGIC("m_traceDequeue (p)");
588 m_traceDequeue(item);
589
590 DropAfterDequeue(item);
591 }
592 return item;
593}
594
595template <typename Item, typename Container>
596void
598{
599 NS_LOG_FUNCTION(this);
600 while (!IsEmpty())
601 {
602 Remove();
603 }
604}
605
606template <typename Item, typename Container>
607void
609{
610 NS_LOG_FUNCTION(this);
611 m_packets.clear();
613}
614
615template <typename Item, typename Container>
618{
619 NS_LOG_FUNCTION(this);
620
621 if (m_nPackets.Get() == 0)
622 {
623 NS_LOG_LOGIC("Queue empty");
624 return nullptr;
625 }
626
627 return MakeGetItem<Container>::GetItem(m_packets, pos);
628}
629
630template <typename Item, typename Container>
631void
633{
634 NS_LOG_FUNCTION(this << item);
635
636 m_nTotalDroppedPackets++;
637 m_nTotalDroppedPacketsBeforeEnqueue++;
638 m_nTotalDroppedBytes += item->GetSize();
639 m_nTotalDroppedBytesBeforeEnqueue += item->GetSize();
640
641 NS_LOG_LOGIC("m_traceDropBeforeEnqueue (p)");
642 m_traceDrop(item);
643 m_traceDropBeforeEnqueue(item);
644}
645
646template <typename Item, typename Container>
647void
649{
650 NS_LOG_FUNCTION(this << item);
651
652 m_nTotalDroppedPackets++;
653 m_nTotalDroppedPacketsAfterDequeue++;
654 m_nTotalDroppedBytes += item->GetSize();
655 m_nTotalDroppedBytesAfterDequeue += item->GetSize();
656
657 NS_LOG_LOGIC("m_traceDropAfterDequeue (p)");
658 m_traceDrop(item);
659 m_traceDropAfterDequeue(item);
660}
661
662// The following explicit template instantiation declarations prevent all the
663// translation units including this header file to implicitly instantiate the
664// Queue<Packet> class and the Queue<QueueDiscItem> class. The unique instances
665// of these classes are explicitly created through the macros
666// NS_OBJECT_TEMPLATE_CLASS_DEFINE (Queue,Packet) and
667// NS_OBJECT_TEMPLATE_CLASS_DEFINE (Queue,QueueDiscItem), which are included in queue.cc
668extern template class Queue<Packet>;
669extern template class Queue<QueueDiscItem>;
670
671} // namespace ns3
672
673#endif /* QUEUE_H */
A base class which provides memory management and object aggregation.
Definition object.h:78
virtual void DoDispose()
Destructor implementation.
Definition object.cc:433
Smart pointer class similar to boost::intrusive_ptr.
Abstract base class for packet Queues.
Definition queue.h:44
uint32_t m_nTotalDroppedBytesBeforeEnqueue
Total dropped bytes before enqueue.
Definition queue.h:212
uint32_t GetTotalDroppedPacketsAfterDequeue() const
Definition queue.cc:167
TracedValue< uint32_t > m_nPackets
Number of packets in the queue.
Definition queue.h:209
uint32_t GetTotalDroppedPacketsBeforeEnqueue() const
Definition queue.cc:159
uint32_t m_nTotalDroppedPacketsAfterDequeue
Total dropped packets after dequeue.
Definition queue.h:216
uint32_t m_nTotalReceivedPackets
Total received packets.
Definition queue.h:210
uint32_t GetTotalDroppedBytesAfterDequeue() const
Definition queue.cc:143
QueueSize GetMaxSize() const
Definition queue.cc:206
uint32_t GetTotalReceivedBytes() const
Definition queue.cc:111
bool WouldOverflow(uint32_t nPackets, uint32_t nBytes) const
Check if the queue would overflow with additional bytes or packets Note: the check is performed accor...
Definition queue.cc:213
void ResetStatistics()
Resets the counts for dropped packets, dropped bytes, received packets, and received bytes.
Definition queue.cc:175
bool IsEmpty() const
Definition queue.cc:71
static void AppendItemTypeIfNotPresent(std::string &typeId, const std::string &itemType)
Append the item type to the provided type ID if the latter does not end with '>'.
Definition queue.cc:62
uint32_t GetTotalDroppedBytes() const
Definition queue.cc:127
static TypeId GetTypeId()
Get the type ID.
Definition queue.cc:24
uint32_t GetTotalDroppedBytesBeforeEnqueue() const
Definition queue.cc:135
uint32_t m_nTotalDroppedBytes
Total dropped bytes.
Definition queue.h:211
uint32_t GetNBytes() const
Definition queue.cc:87
uint32_t m_nTotalDroppedPacketsBeforeEnqueue
Total dropped packets before enqueue.
Definition queue.h:215
QueueSize m_maxSize
max queue size
Definition queue.h:218
uint32_t m_nTotalDroppedPackets
Total dropped packets.
Definition queue.h:214
uint32_t GetNPackets() const
Definition queue.cc:79
void SetMaxSize(QueueSize size)
Set the maximum size of this queue.
Definition queue.cc:189
uint32_t GetTotalReceivedPackets() const
Definition queue.cc:119
TracedValue< uint32_t > m_nBytes
Number of bytes in the queue.
Definition queue.h:207
~QueueBase() override
Definition queue.cc:56
uint32_t m_nTotalDroppedBytesAfterDequeue
Total dropped bytes after dequeue.
Definition queue.h:213
uint32_t GetTotalDroppedPackets() const
Definition queue.cc:151
uint32_t m_nTotalReceivedBytes
Total received bytes.
Definition queue.h:208
QueueSize GetCurrentSize() const
Definition queue.cc:95
Template class for packet Queues.
Definition queue.h:257
virtual Ptr< const Item > Peek() const =0
Get a copy of an item in the queue (each subclass defines the position) without removing it.
Ptr< Item > DoRemove(ConstIterator pos)
Pull the item to drop from the queue.
Definition queue.h:565
~Queue() override
Definition queue.h:487
bool DoEnqueue(ConstIterator pos, Ptr< Item > item, Iterator &ret)
Push an item in the queue.
Definition queue.h:508
TracedCallback< Ptr< const Item > > m_traceDrop
Traced callback: fired when a packet is dropped.
Definition queue.h:431
Ptr< Item > DoDequeue(ConstIterator pos)
Pull the item to dequeue from the queue.
Definition queue.h:536
void Flush()
Flush the queue by calling Remove() on each item enqueued.
Definition queue.h:597
Container m_packets
the items in the queue
Definition queue.h:423
TracedCallback< Ptr< const Item > > m_traceDropAfterDequeue
Traced callback: fired when a packet is dropped after dequeue.
Definition queue.h:435
bool DoEnqueue(ConstIterator pos, Ptr< Item > item)
Push an item in the queue.
Definition queue.h:500
Ptr< const Item > DoPeek(ConstIterator pos) const
Peek the front item in the queue.
Definition queue.h:617
void DropAfterDequeue(Ptr< Item > item)
Drop a packet after dequeue.
Definition queue.h:648
void DoDispose() override
Destructor implementation.
Definition queue.h:608
TracedCallback< Ptr< const Item > > m_traceEnqueue
Traced callback: fired when a packet is enqueued.
Definition queue.h:427
virtual bool Enqueue(Ptr< Item > item)=0
Place an item into the Queue (each subclass defines the position)
const Container & GetContainer() const
Get a const reference to the container of queue items.
Definition queue.h:493
TracedCallback< Ptr< const Item > > m_traceDequeue
Traced callback: fired when a packet is dequeued.
Definition queue.h:429
virtual Ptr< Item > Remove()=0
Remove an item from the Queue (each subclass defines the position), counting it and tracing it as bot...
void DropBeforeEnqueue(Ptr< Item > item)
Drop a packet before enqueue.
Definition queue.h:632
static TypeId GetTypeId()
Get the type ID.
Definition queue.h:444
Container::iterator Iterator
Iterator.
Definition queue.h:310
TracedCallback< Ptr< const Item > > m_traceDropBeforeEnqueue
Traced callback: fired when a packet is dropped before enqueue.
Definition queue.h:433
Container::const_iterator ConstIterator
Const iterator.
Definition queue.h:308
virtual Ptr< Item > Dequeue()=0
Remove an item from the Queue (each subclass defines the position), counting it and tracing it as deq...
Item ItemType
Define ItemType as the type of the stored elements.
Definition queue.h:304
NS_LOG_TEMPLATE_DECLARE
the log component
Definition queue.h:424
Class for representing queue sizes.
Definition queue-size.h:85
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Definition log.h:225
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string GetTemplateClassName()
Helper function to get the name (as a string) of the type of a template class.
STL namespace.
Forward declaration of template class Queue.
Struct providing a static method returning the object stored within the queue that is included in the...
Definition queue.h:390
static Ptr< Item > GetItem(const Container &, const ConstIterator it)
Definition queue.h:395