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
event-garbage-collector.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 INESC Porto
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: Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
19
*/
20
#ifndef EVENT_GARBAGE_COLLECTOR_H
21
#define EVENT_GARBAGE_COLLECTOR_H
22
23
#include <set>
24
#include "ns3/event-id.h"
25
#include "ns3/simulator.h"
26
27
namespace
ns3
{
28
38
class
EventGarbageCollector
39
{
40
public
:
41
42
EventGarbageCollector
();
43
47
void
Track
(
EventId
event);
48
49
~EventGarbageCollector
();
50
51
private
:
52
56
struct
EventIdLessThanTs
57
{
61
bool
operator ()
(
const
EventId
&a,
const
EventId
&b)
const
62
{
63
return
(a.
GetTs
() < b.
GetTs
());
64
}
65
};
66
68
typedef
std::multiset<EventId, EventIdLessThanTs>
EventList
;
69
70
EventList::size_type
m_nextCleanupSize
;
71
EventList
m_events
;
72
77
void
Cleanup
();
81
void
Grow
();
85
void
Shrink
();
86
};
87
88
}
// namespace ns3
89
90
#endif
/* EVENT_GARBAGE_COLLECTOR_H */
ns3::EventGarbageCollector::EventGarbageCollector
EventGarbageCollector()
Definition:
event-garbage-collector.cc:29
ns3::EventGarbageCollector::EventIdLessThanTs
comparison operator for std::multiset
Definition:
event-garbage-collector.h:56
ns3::EventGarbageCollector::EventList
std::multiset< EventId, EventIdLessThanTs > EventList
Event list container.
Definition:
event-garbage-collector.h:68
ns3::EventGarbageCollector::Grow
void Grow()
grow the cleanup limit
Definition:
event-garbage-collector.cc:43
ns3::EventGarbageCollector::Cleanup
void Cleanup()
called when a new event was added and the cleanup limit was exceeded in consequence.
Definition:
event-garbage-collector.cc:59
ns3::EventGarbageCollector
An object that tracks scheduled events and automatically cancels them when it is destroyed.
Definition:
event-garbage-collector.h:38
ns3::EventGarbageCollector::~EventGarbageCollector
~EventGarbageCollector()
Definition:
event-garbage-collector.cc:79
ns3::EventGarbageCollector::m_events
EventList m_events
the tracked event list
Definition:
event-garbage-collector.h:71
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
ns3::EventGarbageCollector::EventIdLessThanTs::operator()
bool operator()(const EventId &a, const EventId &b) const
comparison operator for std::multiset
Definition:
event-garbage-collector.h:61
ns3::EventGarbageCollector::m_nextCleanupSize
EventList::size_type m_nextCleanupSize
batch size for cleanup
Definition:
event-garbage-collector.h:70
ns3::EventGarbageCollector::Track
void Track(EventId event)
Tracks a new event.
Definition:
event-garbage-collector.cc:35
ns3::EventGarbageCollector::Shrink
void Shrink()
shrink the cleanup limit
Definition:
event-garbage-collector.cc:50
ns3::EventId::GetTs
uint64_t GetTs(void) const
Definition:
event-id.cc:77
src
core
helper
event-garbage-collector.h
Generated on Thu Mar 24 2016 00:46:31 for ns-3 by
1.8.9.1