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
list-scheduler.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#ifndef LIST_SCHEDULER_H
10
#define LIST_SCHEDULER_H
11
12
#include "
scheduler.h
"
13
14
#include <list>
15
#include <stdint.h>
16
#include <utility>
17
18
/**
19
* \file
20
* \ingroup scheduler
21
* ns3::ListScheduler declaration.
22
*/
23
24
namespace
ns3
25
{
26
27
class
EventImpl;
28
29
/**
30
* \ingroup scheduler
31
* \brief a std::list event scheduler
32
*
33
* This class implements an event scheduler using an std::list
34
* data structure, that is, a double linked-list.
35
*
36
* \par Time Complexity
37
*
38
* Operation | Amortized %Time | Reason
39
* :----------- | :-------------- | :-----
40
* Insert() | Linear | Linear search in `std::list`
41
* IsEmpty() | Constant | `std::list::size()`
42
* PeekNext() | Constant | `std::list::front()`
43
* Remove() | Linear | Linear search in `std::list`
44
* RemoveNext() | Constant | `std::list::pop_front()`
45
*
46
* \par Memory Complexity
47
*
48
* Category | Memory | Reason
49
* :-------- | :------------------------------- | :-----
50
* Overhead | 2 x `sizeof (*)` + `size_t`<br/>(24 bytes) | `std::list`
51
* Per Event | 2 x `sizeof (*)` | `std::list`
52
*
53
*/
54
class
ListScheduler
:
public
Scheduler
55
{
56
public
:
57
/**
58
* Register this type.
59
* \return The object TypeId.
60
*/
61
static
TypeId
GetTypeId
();
62
63
/** Constructor. */
64
ListScheduler
();
65
/** Destructor. */
66
~ListScheduler
()
override
;
67
68
// Inherited
69
void
Insert
(
const
Scheduler::Event
& ev)
override
;
70
bool
IsEmpty
()
const override
;
71
Scheduler::Event
PeekNext
()
const override
;
72
Scheduler::Event
RemoveNext
()
override
;
73
void
Remove
(
const
Scheduler::Event
& ev)
override
;
74
75
private
:
76
/** Event list type: a simple list of Events. */
77
typedef
std::list<Scheduler::Event>
Events
;
78
/** Events iterator. */
79
typedef
std::list<Scheduler::Event>::iterator
EventsI
;
80
81
/** The event list. */
82
Events
m_events
;
83
};
84
85
}
// namespace ns3
86
87
#endif
/* LIST_SCHEDULER_H */
ns3::ListScheduler
a std::list event scheduler
Definition
list-scheduler.h:55
ns3::ListScheduler::EventsI
std::list< Scheduler::Event >::iterator EventsI
Events iterator.
Definition
list-scheduler.h:79
ns3::ListScheduler::~ListScheduler
~ListScheduler() override
Destructor.
Definition
list-scheduler.cc:46
ns3::ListScheduler::Events
std::list< Scheduler::Event > Events
Event list type: a simple list of Events.
Definition
list-scheduler.h:77
ns3::ListScheduler::ListScheduler
ListScheduler()
Constructor.
Definition
list-scheduler.cc:41
ns3::ListScheduler::m_events
Events m_events
The event list.
Definition
list-scheduler.h:82
ns3::ListScheduler::RemoveNext
Scheduler::Event RemoveNext() override
Remove the earliest event from the event list.
Definition
list-scheduler.cc:80
ns3::ListScheduler::Remove
void Remove(const Scheduler::Event &ev) override
Remove a specific event from the event list.
Definition
list-scheduler.cc:89
ns3::ListScheduler::IsEmpty
bool IsEmpty() const override
Test if the schedule is empty.
Definition
list-scheduler.cc:66
ns3::ListScheduler::PeekNext
Scheduler::Event PeekNext() const override
Get a pointer to the next event.
Definition
list-scheduler.cc:73
ns3::ListScheduler::Insert
void Insert(const Scheduler::Event &ev) override
Insert a new Event in the schedule.
Definition
list-scheduler.cc:51
ns3::ListScheduler::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
list-scheduler.cc:32
ns3::Scheduler
Maintain the event list.
Definition
scheduler.h:146
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
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:173
src
core
model
list-scheduler.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0