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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
calendar-scheduler.h
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::PeekNext
virtual Event PeekNext(void) const
Definition:
calendar-scheduler.cc:128
ns3::CalendarScheduler::IsEmpty
virtual bool IsEmpty(void) const
Definition:
calendar-scheduler.cc:122
ns3::CalendarScheduler::Remove
virtual void Remove(const Event &ev)
Definition:
calendar-scheduler.cc:221
ns3::Scheduler
Maintain the event list.
Definition:
scheduler.h:53
ns3::CalendarScheduler::RemoveNext
virtual Event RemoveNext(void)
Definition:
calendar-scheduler.cc:206
ns3::Scheduler::Event
Definition:
scheduler.h:64
ns3::CalendarScheduler
a calendar queue event scheduler
Definition:
calendar-scheduler.h:47
ns3::CalendarScheduler::Insert
virtual void Insert(const Event &ev)
Definition:
calendar-scheduler.cc:114
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:44
src
core
model
calendar-scheduler.h
Generated on Sun Mar 16 2014 11:25:02 for ns-3 by
1.8.6