A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
network
utils
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>::Head
;
56
using
Queue<Item>::Tail
;
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
;
79
return
tid;
80
}
81
82
template
<
typename
Item>
83
DropTailQueue<Item>::DropTailQueue
() :
84
Queue
<Item> (),
85
NS_LOG_TEMPLATE_DEFINE
(
"DropTailQueue"
)
86
{
87
NS_LOG_FUNCTION
(
this
);
88
}
89
90
template
<
typename
Item>
91
DropTailQueue<Item>::~DropTailQueue
()
92
{
93
NS_LOG_FUNCTION
(
this
);
94
}
95
96
template
<
typename
Item>
97
bool
98
DropTailQueue<Item>::Enqueue
(
Ptr<Item>
item)
99
{
100
NS_LOG_FUNCTION
(
this
<< item);
101
102
return
DoEnqueue (Tail (), item);
103
}
104
105
template
<
typename
Item>
106
Ptr<Item>
107
DropTailQueue<Item>::Dequeue
(
void
)
108
{
109
NS_LOG_FUNCTION
(
this
);
110
111
Ptr<Item>
item = DoDequeue (Head ());
112
113
NS_LOG_LOGIC
(
"Popped "
<< item);
114
115
return
item;
116
}
117
118
template
<
typename
Item>
119
Ptr<Item>
120
DropTailQueue<Item>::Remove
(
void
)
121
{
122
NS_LOG_FUNCTION
(
this
);
123
124
Ptr<Item>
item = DoRemove (Head ());
125
126
NS_LOG_LOGIC
(
"Removed "
<< item);
127
128
return
item;
129
}
130
131
template
<
typename
Item>
132
Ptr<const Item>
133
DropTailQueue<Item>::Peek
(
void
)
const
134
{
135
NS_LOG_FUNCTION
(
this
);
136
137
return
DoPeek (Head ());
138
}
139
140
}
// namespace ns3
141
142
#endif
/* DROPTAIL_H */
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:133
ns3::DropTailQueue::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
drop-tail-queue.h:72
ns3::Ptr< Item >
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:213
ns3::DropTailQueue::Remove
virtual Ptr< Item > Remove(void)
Remove an item from the Queue (each subclass defines the position), counting it as dropped...
Definition:
drop-tail-queue.h:120
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:98
ns3::Queue
Template class for packet Queues.
Definition:
csma-net-device.h:39
ns3::DropTailQueue::~DropTailQueue
virtual ~DropTailQueue()
Definition:
drop-tail-queue.h:91
NS_LOG_TEMPLATE_DEFINE
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Definition:
log.h:236
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::DropTailQueue::DropTailQueue
DropTailQueue()
DropTailQueue Constructor.
Definition:
drop-tail-queue.h:83
NS_LOG_LOGIC
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
ns3::DropTailQueue::NS_LOG_TEMPLATE_DECLARE
NS_LOG_TEMPLATE_DECLARE
redefinition of the log component
Definition:
drop-tail-queue.h:62
ns3::DropTailQueue::Dequeue
virtual Ptr< Item > Dequeue(void)
Remove an item from the Queue (each subclass defines the position), counting it as dequeued...
Definition:
drop-tail-queue.h:107
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::DropTailQueue
A FIFO packet queue that drops tail-end packets on overflow.
Definition:
drop-tail-queue.h:32
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
Generated on Wed Nov 7 2018 10:02:07 for ns-3 by
1.8.14