A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
drop-tail-queue.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 University of Washington
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
#ifndef DROPTAIL_H
20
#define DROPTAIL_H
21
22
#include "ns3/queue.h"
23
24
namespace
ns3
{
25
31
template
<
typename
Item>
32
class
DropTailQueue
:
public
Queue
<Item>
33
{
34
public
:
39
static
TypeId
GetTypeId
(
void
);
45
DropTailQueue
();
46
47
virtual
~DropTailQueue
();
48
49
virtual
bool
Enqueue
(
Ptr<Item>
item);
50
virtual
Ptr<Item>
Dequeue
(
void
);
51
virtual
Ptr<Item>
Remove
(
void
);
52
virtual
Ptr<const Item>
Peek
(
void
)
const
;
53
54
private
:
55
using
Queue<Item>::begin
;
56
using
Queue<Item>::end
;
57
using
Queue<Item>::DoEnqueue
;
58
using
Queue<Item>::DoDequeue
;
59
using
Queue<Item>::DoRemove
;
60
using
Queue<Item>::DoPeek
;
61
62
NS_LOG_TEMPLATE_DECLARE
;
63
};
64
65
70
template
<
typename
Item>
71
TypeId
72
DropTailQueue<Item>::GetTypeId
(
void
)
73
{
74
static
TypeId
tid =
TypeId
((
"ns3::DropTailQueue<"
+
GetTypeParamName
<
DropTailQueue<Item>
> () +
">"
).c_str ())
75
.
SetParent
<
Queue<Item>
> ()
76
.SetGroupName (
"Network"
)
77
.template AddConstructor<DropTailQueue<Item> > ()
78
.AddAttribute (
"MaxSize"
,
79
"The max queue size"
,
80
QueueSizeValue
(
QueueSize
(
"100p"
)),
81
MakeQueueSizeAccessor
(&
QueueBase::SetMaxSize
,
82
&
QueueBase::GetMaxSize
),
83
MakeQueueSizeChecker
())
84
;
85
return
tid;
86
}
87
88
template
<
typename
Item>
89
DropTailQueue<Item>::DropTailQueue
() :
90
Queue
<Item> (),
91
NS_LOG_TEMPLATE_DEFINE
(
"DropTailQueue"
)
92
{
93
NS_LOG_FUNCTION
(
this
);
94
}
95
96
template
<
typename
Item>
97
DropTailQueue<Item>::~DropTailQueue
()
98
{
99
NS_LOG_FUNCTION
(
this
);
100
}
101
102
template
<
typename
Item>
103
bool
104
DropTailQueue<Item>::Enqueue
(
Ptr<Item>
item)
105
{
106
NS_LOG_FUNCTION
(
this
<< item);
107
108
return
DoEnqueue (end (), item);
109
}
110
111
template
<
typename
Item>
112
Ptr<Item>
113
DropTailQueue<Item>::Dequeue
(
void
)
114
{
115
NS_LOG_FUNCTION
(
this
);
116
117
Ptr<Item>
item = DoDequeue (begin ());
118
119
NS_LOG_LOGIC
(
"Popped "
<< item);
120
121
return
item;
122
}
123
124
template
<
typename
Item>
125
Ptr<Item>
126
DropTailQueue<Item>::Remove
(
void
)
127
{
128
NS_LOG_FUNCTION
(
this
);
129
130
Ptr<Item>
item = DoRemove (begin ());
131
132
NS_LOG_LOGIC
(
"Removed "
<< item);
133
134
return
item;
135
}
136
137
template
<
typename
Item>
138
Ptr<const Item>
139
DropTailQueue<Item>::Peek
(
void
)
const
140
{
141
NS_LOG_FUNCTION
(
this
);
142
143
return
DoPeek (begin ());
144
}
145
146
// The following explicit template instantiation declarations prevent all the
147
// translation units including this header file to implicitly instantiate the
148
// DropTailQueue<Packet> class and the DropTailQueue<QueueDiscItem> class. The
149
// unique instances of these classes are explicitly created through the macros
150
// NS_OBJECT_TEMPLATE_CLASS_DEFINE (DropTailQueue,Packet) and
151
// NS_OBJECT_TEMPLATE_CLASS_DEFINE (DropTailQueue,QueueDiscItem), which are included
152
// in drop-tail-queue.cc
153
extern
template
class
DropTailQueue<Packet>
;
154
extern
template
class
DropTailQueue<QueueDiscItem>
;
155
156
}
// namespace ns3
157
158
#endif
/* DROPTAIL_H */
ns3::QueueBase::SetMaxSize
void SetMaxSize(QueueSize size)
Set the maximum size of this queue.
Definition:
queue.cc:200
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::DropTailQueue::NS_LOG_TEMPLATE_DECLARE
NS_LOG_TEMPLATE_DECLARE
redefinition of the log component
Definition:
drop-tail-queue.h:62
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeQueueSizeChecker
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
Definition:
queue-size.cc:29
ns3::DropTailQueue::DropTailQueue
DropTailQueue()
DropTailQueue Constructor.
Definition:
drop-tail-queue.h:89
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::DropTailQueue::Remove
virtual Ptr< Item > Remove(void)
Remove an item from the Queue (each subclass defines the position), counting it and tracing it as bot...
Definition:
drop-tail-queue.h:126
ns3::QueueSizeValue
Definition:
queue-size.h:221
ns3::GetTypeParamName
std::string GetTypeParamName(void)
Helper function to get the name (as a string) of the type parameter of a template class.
Definition:
object-base.h:102
ns3::Ptr< Item >
DropTailQueue< Packet >
DropTailQueue< QueueDiscItem >
Introspection did not find any typical Config paths.
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition:
log.h:289
ns3::DropTailQueue::Peek
virtual Ptr< const Item > Peek(void) const
Get a copy of an item in the queue (each subclass defines the position) without removing it.
Definition:
drop-tail-queue.h:139
ns3::DropTailQueue::Enqueue
virtual bool Enqueue(Ptr< Item > item)
Place an item into the Queue (each subclass defines the position)
Definition:
drop-tail-queue.h:104
ns3::DropTailQueue::~DropTailQueue
virtual ~DropTailQueue()
Definition:
drop-tail-queue.h:97
NS_LOG_TEMPLATE_DEFINE
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Definition:
log.h:239
ns3::DropTailQueue::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
drop-tail-queue.h:72
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:244
ns3::MakeQueueSizeAccessor
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
Definition:
queue-size.h:221
ns3::DropTailQueue
A FIFO packet queue that drops tail-end packets on overflow.
Definition:
drop-tail-queue.h:33
ns3::QueueBase::GetMaxSize
QueueSize GetMaxSize(void) const
Definition:
queue.cc:217
ns3::QueueSize
Class for representing queue sizes.
Definition:
queue-size.h:95
ns3::Queue
Template class for packet Queues.
Definition:
queue.h:254
ns3::DropTailQueue::Dequeue
virtual Ptr< Item > Dequeue(void)
Remove an item from the Queue (each subclass defines the position), counting it and tracing it as deq...
Definition:
drop-tail-queue.h:113
src
network
utils
drop-tail-queue.h
Generated on Fri Oct 1 2021 17:03:30 for ns-3 by
1.8.20