A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
39 {
40 public:
41 
43 
47  void Track (EventId event);
48 
50 
51 private:
52 
54  {
55  bool operator () (const EventId &a, const EventId &b) const
56  {
57  return (a.GetTs () < b.GetTs ());
58  }
59  };
60 
61  typedef std::multiset<EventId, EventIdLessThanTs> EventList;
62 
63  EventList::size_type m_nextCleanupSize;
65 
66  void Cleanup ();
67  void Grow ();
68  void Shrink ();
69 };
70 
71 } // namespace ns3
72 
73 #endif /* EVENT_GARBAGE_COLLECTOR_H */
std::multiset< EventId, EventIdLessThanTs > EventList
An object that tracks scheduled events and automatically cancels them when it is destroyed.
an identifier for simulation events.
Definition: event-id.h:46
bool operator()(const EventId &a, const EventId &b) const
EventList::size_type m_nextCleanupSize
void Track(EventId event)
Tracks a new event.
uint64_t GetTs(void) const
Definition: event-id.cc:71