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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
28
namespace
ns3 {
29
47
class
HeapScheduler
:
public
Scheduler
48
{
49
public
:
50
static
TypeId
GetTypeId
(
void
);
51
52
HeapScheduler
();
53
virtual
~HeapScheduler
();
54
55
virtual
void
Insert
(
const
Event &ev);
56
virtual
bool
IsEmpty
(
void
)
const
;
57
virtual
Event
PeekNext
(
void
)
const
;
58
virtual
Event
RemoveNext
(
void
);
59
virtual
void
Remove
(
const
Event &ev);
60
61
private
:
62
typedef
std::vector<Event>
BinaryHeap
;
63
64
inline
uint32_t
Parent
(uint32_t
id
)
const
;
65
uint32_t
Sibling
(uint32_t
id
)
const
;
66
inline
uint32_t
LeftChild
(uint32_t
id
)
const
;
67
inline
uint32_t
RightChild
(uint32_t
id
)
const
;
68
inline
uint32_t
Root
(
void
)
const
;
69
/* Return the position in the array of the last element included in it. */
70
uint32_t
Last
(
void
)
const
;
71
inline
bool
IsRoot
(uint32_t
id
)
const
;
72
inline
bool
IsBottom
(uint32_t
id
)
const
;
73
inline
bool
IsLessStrictly
(uint32_t a, uint32_t b)
const
;
74
inline
uint32_t
Smallest
(uint32_t a, uint32_t b)
const
;
75
76
inline
void
Exch
(uint32_t a, uint32_t b);
77
void
BottomUp
(
void
);
78
void
TopDown
(uint32_t
start
);
79
80
BinaryHeap
m_heap
;
81
};
82
83
}
// namespace ns3
84
85
#endif
/* HEAP_SCHEDULER_H */
ns3::HeapScheduler::Sibling
uint32_t Sibling(uint32_t id) const
Definition:
heap-scheduler.cc:67
ns3::HeapScheduler::~HeapScheduler
virtual ~HeapScheduler()
Definition:
heap-scheduler.cc:55
ns3::HeapScheduler::Insert
virtual void Insert(const Event &ev)
Definition:
heap-scheduler.cc:196
ns3::HeapScheduler::TopDown
void TopDown(uint32_t start)
Definition:
heap-scheduler.cc:160
ns3::HeapScheduler::RemoveNext
virtual Event RemoveNext(void)
This method cannot be invoked if the list is empty.
Definition:
heap-scheduler.cc:210
ns3::HeapScheduler::IsLessStrictly
bool IsLessStrictly(uint32_t a, uint32_t b) const
Definition:
heap-scheduler.cc:126
visualizer.core.start
def start
Definition:
core.py:1482
ns3::HeapScheduler::PeekNext
virtual Event PeekNext(void) const
Definition:
heap-scheduler.cc:204
ns3::HeapScheduler::GetTypeId
static TypeId GetTypeId(void)
Definition:
heap-scheduler.cc:36
ns3::HeapScheduler::IsRoot
bool IsRoot(uint32_t id) const
Definition:
heap-scheduler.cc:93
ns3::HeapScheduler::Remove
virtual void Remove(const Event &ev)
Definition:
heap-scheduler.cc:222
ns3::HeapScheduler::Exch
void Exch(uint32_t a, uint32_t b)
Definition:
heap-scheduler.cc:115
ns3::HeapScheduler::RightChild
uint32_t RightChild(uint32_t id) const
Definition:
heap-scheduler.cc:79
scheduler.h
ns3::HeapScheduler::BinaryHeap
std::vector< Event > BinaryHeap
Definition:
heap-scheduler.h:62
ns3::HeapScheduler
a binary heap event scheduler
Definition:
heap-scheduler.h:47
ns3::HeapScheduler::Smallest
uint32_t Smallest(uint32_t a, uint32_t b) const
Definition:
heap-scheduler.cc:133
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:57
ns3::HeapScheduler::m_heap
BinaryHeap m_heap
Definition:
heap-scheduler.h:80
ns3::HeapScheduler::HeapScheduler
HeapScheduler()
Definition:
heap-scheduler.cc:45
ns3::HeapScheduler::IsBottom
bool IsBottom(uint32_t id) const
Definition:
heap-scheduler.cc:108
ns3::HeapScheduler::Last
uint32_t Last(void) const
Definition:
heap-scheduler.cc:100
ns3::HeapScheduler::BottomUp
void BottomUp(void)
Definition:
heap-scheduler.cc:147
ns3::HeapScheduler::IsEmpty
virtual bool IsEmpty(void) const
Definition:
heap-scheduler.cc:140
ns3::HeapScheduler::Parent
uint32_t Parent(uint32_t id) const
Definition:
heap-scheduler.cc:61
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::HeapScheduler::Root
uint32_t Root(void) const
Definition:
heap-scheduler.cc:86
ns3::HeapScheduler::LeftChild
uint32_t LeftChild(uint32_t id) const
Definition:
heap-scheduler.cc:73
src
core
model
heap-scheduler.h
Generated on Sat Apr 19 2014 14:06:51 for ns-3 by
1.8.6