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
calendar-scheduler.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 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 CALENDAR_SCHEDULER_H
22
#define CALENDAR_SCHEDULER_H
23
24
#include "
scheduler.h
"
25
#include <stdint.h>
26
#include <list>
27
28
namespace
ns3 {
29
30
class
EventImpl;
31
47
class
CalendarScheduler
:
public
Scheduler
48
{
49
public
:
50
static
TypeId
GetTypeId
(
void
);
51
52
CalendarScheduler
();
53
virtual
~CalendarScheduler
();
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
void
ResizeUp
(
void
);
63
void
ResizeDown
(
void
);
64
void
Resize
(uint32_t newSize);
65
uint32_t
CalculateNewWidth
(
void
);
66
void
Init
(uint32_t nBuckets,
67
uint64_t width,
68
uint64_t startPrio);
69
inline
uint32_t
Hash
(uint64_t key)
const
;
70
void
PrintInfo
(
void
);
71
void
DoResize
(uint32_t newSize, uint32_t newWidth);
72
Scheduler::Event
DoRemoveNext
(
void
);
73
void
DoInsert
(
const
Event
&ev);
74
75
typedef
std::list<Scheduler::Event>
Bucket
;
76
Bucket
*
m_buckets
;
77
// number of buckets in array
78
uint32_t
m_nBuckets
;
79
// duration of a bucket
80
uint64_t
m_width
;
81
// bucket index from which the last event was dequeued
82
uint32_t
m_lastBucket
;
83
// priority at the top of the bucket from which last event was dequeued
84
uint64_t
m_bucketTop
;
85
// the priority of the last event removed
86
uint64_t
m_lastPrio
;
87
// number of events in queue
88
uint32_t
m_qSize
;
89
};
90
91
}
// namespace ns3
92
93
#endif
/* CALENDAR_SCHEDULER_H */
ns3::CalendarScheduler::ResizeDown
void ResizeDown(void)
Definition:
calendar-scheduler.cc:262
ns3::CalendarScheduler::CalculateNewWidth
uint32_t CalculateNewWidth(void)
Definition:
calendar-scheduler.cc:273
ns3::CalendarScheduler::DoInsert
void DoInsert(const Event &ev)
Definition:
calendar-scheduler.cc:95
ns3::CalendarScheduler::m_qSize
uint32_t m_qSize
Definition:
calendar-scheduler.h:88
ns3::CalendarScheduler::ResizeUp
void ResizeUp(void)
Definition:
calendar-scheduler.cc:251
ns3::CalendarScheduler::PeekNext
virtual Event PeekNext(void) const
Definition:
calendar-scheduler.cc:130
ns3::CalendarScheduler::m_bucketTop
uint64_t m_bucketTop
Definition:
calendar-scheduler.h:84
ns3::CalendarScheduler::IsEmpty
virtual bool IsEmpty(void) const
Definition:
calendar-scheduler.cc:124
scheduler.h
ns3::CalendarScheduler::~CalendarScheduler
virtual ~CalendarScheduler()
Definition:
calendar-scheduler.cc:53
ns3::CalendarScheduler::Remove
virtual void Remove(const Event &ev)
Definition:
calendar-scheduler.cc:227
ns3::CalendarScheduler::Init
void Init(uint32_t nBuckets, uint64_t width, uint64_t startPrio)
Definition:
calendar-scheduler.cc:60
ns3::CalendarScheduler::CalendarScheduler
CalendarScheduler()
Definition:
calendar-scheduler.cc:47
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:57
ns3::CalendarScheduler::m_width
uint64_t m_width
Definition:
calendar-scheduler.h:80
ns3::CalendarScheduler::Resize
void Resize(uint32_t newSize)
Definition:
calendar-scheduler.cc:371
ns3::CalendarScheduler::RemoveNext
virtual Event RemoveNext(void)
This method cannot be invoked if the list is empty.
Definition:
calendar-scheduler.cc:212
ns3::CalendarScheduler::m_buckets
Bucket * m_buckets
Definition:
calendar-scheduler.h:76
ns3::CalendarScheduler::DoRemoveNext
Scheduler::Event DoRemoveNext(void)
Definition:
calendar-scheduler.cc:165
ns3::Scheduler::Event
Definition:
scheduler.h:70
ns3::CalendarScheduler::m_lastBucket
uint32_t m_lastBucket
Definition:
calendar-scheduler.h:82
ns3::CalendarScheduler::DoResize
void DoResize(uint32_t newSize, uint32_t newWidth)
Definition:
calendar-scheduler.cc:352
ns3::CalendarScheduler::Bucket
std::list< Scheduler::Event > Bucket
Definition:
calendar-scheduler.h:75
ns3::CalendarScheduler::GetTypeId
static TypeId GetTypeId(void)
Definition:
calendar-scheduler.cc:38
ns3::CalendarScheduler
a calendar queue event scheduler
Definition:
calendar-scheduler.h:47
ns3::CalendarScheduler::m_lastPrio
uint64_t m_lastPrio
Definition:
calendar-scheduler.h:86
ns3::CalendarScheduler::Hash
uint32_t Hash(uint64_t key) const
Definition:
calendar-scheduler.cc:86
ns3::CalendarScheduler::Insert
virtual void Insert(const Event &ev)
Definition:
calendar-scheduler.cc:116
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::CalendarScheduler::m_nBuckets
uint32_t m_nBuckets
Definition:
calendar-scheduler.h:78
ns3::CalendarScheduler::PrintInfo
void PrintInfo(void)
Definition:
calendar-scheduler.cc:73
src
core
model
calendar-scheduler.h
Generated on Sat Apr 19 2014 14:06:51 for ns-3 by
1.8.6