A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
drop-tail-queue.cc
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
#include "ns3/log.h"
20
#include "
drop-tail-queue.h
"
21
22
namespace
ns3
{
23
24
NS_LOG_COMPONENT_DEFINE
(
"DropTailQueue"
);
25
26
NS_OBJECT_ENSURE_REGISTERED
(DropTailQueue);
27
28
TypeId
DropTailQueue::GetTypeId
(
void
)
29
{
30
static
TypeId
tid =
TypeId
(
"ns3::DropTailQueue"
)
31
.
SetParent
<
Queue
> ()
32
.SetGroupName (
"Network"
)
33
.AddConstructor<
DropTailQueue
> ()
34
;
35
return
tid;
36
}
37
38
DropTailQueue::DropTailQueue
() :
39
Queue
(),
40
m_packets ()
41
{
42
NS_LOG_FUNCTION
(
this
);
43
}
44
45
DropTailQueue::~DropTailQueue
()
46
{
47
NS_LOG_FUNCTION
(
this
);
48
}
49
50
bool
51
DropTailQueue::DoEnqueue
(
Ptr<QueueItem>
item)
52
{
53
NS_LOG_FUNCTION
(
this
<< item);
54
NS_ASSERT
(
m_packets
.size () ==
GetNPackets
());
55
56
m_packets
.push (item);
57
58
return
true
;
59
}
60
61
Ptr<QueueItem>
62
DropTailQueue::DoDequeue
(
void
)
63
{
64
NS_LOG_FUNCTION
(
this
);
65
NS_ASSERT
(
m_packets
.size () ==
GetNPackets
());
66
67
Ptr<QueueItem>
item =
m_packets
.front ();
68
m_packets
.pop ();
69
70
NS_LOG_LOGIC
(
"Popped "
<< item);
71
72
return
item;
73
}
74
75
Ptr<const QueueItem>
76
DropTailQueue::DoPeek
(
void
)
const
77
{
78
NS_LOG_FUNCTION
(
this
);
79
NS_ASSERT
(
m_packets
.size () ==
GetNPackets
());
80
81
return
m_packets
.front ();
82
}
83
84
}
// namespace ns3
85
ns3::DropTailQueue::DoEnqueue
virtual bool DoEnqueue(Ptr< QueueItem > item)
Push an item in the queue.
Definition:
drop-tail-queue.cc:51
ns3::DropTailQueue::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
drop-tail-queue.cc:28
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
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::DoDequeue
virtual Ptr< QueueItem > DoDequeue(void)
Pull an item from the queue.
Definition:
drop-tail-queue.cc:62
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:44
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:67
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
ns3::DropTailQueue::m_packets
std::queue< Ptr< QueueItem > > m_packets
the items in the queue
Definition:
drop-tail-queue.h:54
ns3::Queue
Abstract base class for packet Queues.
Definition:
queue.h:44
ns3::Queue::GetNPackets
uint32_t GetNPackets(void) const
Definition:
queue.cc:188
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition:
log.h:252
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::DropTailQueue::DoPeek
virtual Ptr< const QueueItem > DoPeek(void) const
Peek the front item in the queue.
Definition:
drop-tail-queue.cc:76
drop-tail-queue.h
ns3::DropTailQueue::~DropTailQueue
virtual ~DropTailQueue()
Definition:
drop-tail-queue.cc:45
ns3::DropTailQueue::DropTailQueue
DropTailQueue()
DropTailQueue Constructor.
Definition:
drop-tail-queue.cc:38
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:826
ns3::DropTailQueue
A FIFO packet queue that drops tail-end packets on overflow.
Definition:
drop-tail-queue.h:32
src
network
utils
drop-tail-queue.cc
Generated on Thu Mar 24 2016 00:46:50 for ns-3 by
1.8.9.1