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
heap-scheduler.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005 INRIA
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
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef HEAP_SCHEDULER_H
22
#define HEAP_SCHEDULER_H
23
24
#include "
scheduler.h
"
25
#include <stdint.h>
26
#include <vector>
27
34
namespace
ns3
{
35
53
class
HeapScheduler
:
public
Scheduler
54
{
55
public
:
56
static
TypeId
GetTypeId
(
void
);
57
58
HeapScheduler
();
59
virtual
~HeapScheduler
();
60
61
virtual
void
Insert
(
const
Event &ev);
62
virtual
bool
IsEmpty
(
void
)
const
;
63
virtual
Event
PeekNext
(
void
)
const
;
64
virtual
Event
RemoveNext
(
void
);
65
virtual
void
Remove
(
const
Event &ev);
66
67
private
:
68
typedef
std::vector<Event>
BinaryHeap
;
69
70
inline
uint32_t
Parent
(uint32_t
id
)
const
;
71
uint32_t
Sibling
(uint32_t
id
)
const
;
72
inline
uint32_t
LeftChild
(uint32_t
id
)
const
;
73
inline
uint32_t
RightChild
(uint32_t
id
)
const
;
74
inline
uint32_t
Root
(
void
)
const
;
75
/* Return the position in the array of the last element included in it. */
76
uint32_t
Last
(
void
)
const
;
77
inline
bool
IsRoot
(uint32_t
id
)
const
;
78
inline
bool
IsBottom
(uint32_t
id
)
const
;
79
inline
bool
IsLessStrictly
(uint32_t a, uint32_t b)
const
;
80
inline
uint32_t
Smallest
(uint32_t a, uint32_t b)
const
;
81
82
inline
void
Exch
(uint32_t a, uint32_t b);
83
void
BottomUp
(
void
);
84
void
TopDown
(uint32_t
start
);
85
86
BinaryHeap
m_heap
;
87
};
88
89
}
// namespace ns3
90
91
#endif
/* HEAP_SCHEDULER_H */
ns3::HeapScheduler::Sibling
uint32_t Sibling(uint32_t id) const
Definition:
heap-scheduler.cc:73
ns3::HeapScheduler::~HeapScheduler
virtual ~HeapScheduler()
Definition:
heap-scheduler.cc:61
ns3::HeapScheduler::Insert
virtual void Insert(const Event &ev)
Definition:
heap-scheduler.cc:202
ns3::HeapScheduler::TopDown
void TopDown(uint32_t start)
Definition:
heap-scheduler.cc:166
ns3::HeapScheduler::RemoveNext
virtual Event RemoveNext(void)
This method cannot be invoked if the list is empty.
Definition:
heap-scheduler.cc:216
visualizer.core.start
def start()
Definition:
core.py:1482
ns3::HeapScheduler::IsLessStrictly
bool IsLessStrictly(uint32_t a, uint32_t b) const
Definition:
heap-scheduler.cc:132
ns3::HeapScheduler::PeekNext
virtual Event PeekNext(void) const
Definition:
heap-scheduler.cc:210
ns3::HeapScheduler::GetTypeId
static TypeId GetTypeId(void)
Definition:
heap-scheduler.cc:41
ns3::HeapScheduler::IsRoot
bool IsRoot(uint32_t id) const
Definition:
heap-scheduler.cc:99
ns3::HeapScheduler::Remove
virtual void Remove(const Event &ev)
Definition:
heap-scheduler.cc:228
ns3::HeapScheduler::Exch
void Exch(uint32_t a, uint32_t b)
Definition:
heap-scheduler.cc:121
ns3::HeapScheduler::RightChild
uint32_t RightChild(uint32_t id) const
Definition:
heap-scheduler.cc:85
scheduler.h
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations...
ns3::HeapScheduler::BinaryHeap
std::vector< Event > BinaryHeap
Definition:
heap-scheduler.h:68
ns3::HeapScheduler
a binary heap event scheduler
Definition:
heap-scheduler.h:53
ns3::HeapScheduler::Smallest
uint32_t Smallest(uint32_t a, uint32_t b) const
Definition:
heap-scheduler.cc:139
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:66
ns3::HeapScheduler::m_heap
BinaryHeap m_heap
Definition:
heap-scheduler.h:86
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::HeapScheduler::HeapScheduler
HeapScheduler()
Definition:
heap-scheduler.cc:51
ns3::HeapScheduler::IsBottom
bool IsBottom(uint32_t id) const
Definition:
heap-scheduler.cc:114
ns3::HeapScheduler::Last
uint32_t Last(void) const
Definition:
heap-scheduler.cc:106
ns3::HeapScheduler::BottomUp
void BottomUp(void)
Definition:
heap-scheduler.cc:153
ns3::HeapScheduler::IsEmpty
virtual bool IsEmpty(void) const
Definition:
heap-scheduler.cc:146
ns3::HeapScheduler::Parent
uint32_t Parent(uint32_t id) const
Definition:
heap-scheduler.cc:67
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:57
ns3::HeapScheduler::Root
uint32_t Root(void) const
Definition:
heap-scheduler.cc:92
ns3::HeapScheduler::LeftChild
uint32_t LeftChild(uint32_t id) const
Definition:
heap-scheduler.cc:79
src
core
model
heap-scheduler.h
Generated on Wed May 13 2015 14:59:11 for ns-3 by
1.8.9.1