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
priority-queue-scheduler.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
20
#ifndef PRIORITY_QUEUE_SCHEDULER_H
21
#define PRIORITY_QUEUE_SCHEDULER_H
22
23
#include "
scheduler.h
"
24
25
#include <algorithm>
26
#include <functional>
27
#include <queue>
28
#include <stdint.h>
29
#include <utility>
30
37
namespace
ns3
38
{
39
65
class
PriorityQueueScheduler
:
public
Scheduler
66
{
67
public
:
72
static
TypeId
GetTypeId
();
73
75
PriorityQueueScheduler
();
77
~PriorityQueueScheduler
()
override
;
78
79
// Inherited
80
void
Insert
(
const
Scheduler::Event
& ev)
override
;
81
bool
IsEmpty
()
const override
;
82
Scheduler::Event
PeekNext
()
const override
;
83
Scheduler::Event
RemoveNext
()
override
;
84
void
Remove
(
const
Scheduler::Event
& ev)
override
;
85
86
private
:
91
class
EventPriorityQueue
:
public
std::priority_queue<Scheduler::Event,
92
std::vector<Scheduler::Event>,
93
std::greater<Scheduler::Event>>
94
{
95
public
:
100
bool
remove
(
const
Scheduler::Event
& ev);
101
102
};
// class EventPriorityQueue
103
105
EventPriorityQueue
m_queue
;
106
107
};
// class PriorityQueueScheduler
108
109
}
// namespace ns3
110
111
#endif
/* PRIORITY_QUEUE_SCHEDULER_H */
ns3::PriorityQueueScheduler::EventPriorityQueue
Custom priority_queue which supports remove, and returns entries in increasing time order.
Definition:
priority-queue-scheduler.h:94
ns3::PriorityQueueScheduler::EventPriorityQueue::remove
bool remove(const Scheduler::Event &ev)
Remove a specific event from the event list.
Definition:
priority-queue-scheduler.cc:94
ns3::PriorityQueueScheduler
a std::priority_queue event scheduler
Definition:
priority-queue-scheduler.h:66
ns3::PriorityQueueScheduler::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition:
priority-queue-scheduler.cc:44
ns3::PriorityQueueScheduler::RemoveNext
Scheduler::Event RemoveNext() override
Remove the earliest event from the event list.
Definition:
priority-queue-scheduler.cc:85
ns3::PriorityQueueScheduler::~PriorityQueueScheduler
~PriorityQueueScheduler() override
Destructor.
Definition:
priority-queue-scheduler.cc:58
ns3::PriorityQueueScheduler::Insert
void Insert(const Scheduler::Event &ev) override
Insert a new Event in the schedule.
Definition:
priority-queue-scheduler.cc:64
ns3::PriorityQueueScheduler::PeekNext
Scheduler::Event PeekNext() const override
Get a pointer to the next event.
Definition:
priority-queue-scheduler.cc:78
ns3::PriorityQueueScheduler::Remove
void Remove(const Scheduler::Event &ev) override
Remove a specific event from the event list.
Definition:
priority-queue-scheduler.cc:110
ns3::PriorityQueueScheduler::m_queue
EventPriorityQueue m_queue
The event queue.
Definition:
priority-queue-scheduler.h:105
ns3::PriorityQueueScheduler::PriorityQueueScheduler
PriorityQueueScheduler()
Constructor.
Definition:
priority-queue-scheduler.cc:53
ns3::PriorityQueueScheduler::IsEmpty
bool IsEmpty() const override
Test if the schedule is empty.
Definition:
priority-queue-scheduler.cc:71
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:157
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
scheduler.h
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations.
ns3::Scheduler::Event
Scheduler event.
Definition:
scheduler.h:184
src
core
model
priority-queue-scheduler.h
Generated on Sun Jul 2 2023 18:21:32 for ns-3 by
1.9.6