A Discrete-Event Network Simulator
API
ns3::EventGarbageCollector Class Reference

An object that tracks scheduled events and automatically cancels them when it is destroyed. More...

#include "event-garbage-collector.h"

+ Collaboration diagram for ns3::EventGarbageCollector:

Classes

struct  EventIdLessThanTs
 comparison operator for std::multiset More...
 

Public Member Functions

 EventGarbageCollector ()
 
 ~EventGarbageCollector ()
 
void Track (EventId event)
 Tracks a new event. More...
 

Private Types

typedef std::multiset< EventId, EventIdLessThanTsEventList
 Event list container. More...
 

Private Member Functions

void Cleanup ()
 called when a new event was added and the cleanup limit was exceeded in consequence. More...
 
void Grow ()
 grow the cleanup limit More...
 
void Shrink ()
 shrink the cleanup limit More...
 

Private Attributes

EventList m_events
 the tracked event list More...
 
EventList::size_type m_nextCleanupSize
 batch size for cleanup More...
 

Detailed Description

An object that tracks scheduled events and automatically cancels them when it is destroyed.

It is useful in situations where multiple instances of the same type of event can simultaneously be scheduled, and when the events should be limited to the lifetime of a container object.

Definition at line 38 of file event-garbage-collector.h.

Member Typedef Documentation

Event list container.

Definition at line 68 of file event-garbage-collector.h.

Constructor & Destructor Documentation

ns3::EventGarbageCollector::EventGarbageCollector ( )

Definition at line 29 of file event-garbage-collector.cc.

ns3::EventGarbageCollector::~EventGarbageCollector ( )

Definition at line 79 of file event-garbage-collector.cc.

References ns3::Simulator::Cancel(), and m_events.

+ Here is the call graph for this function:

Member Function Documentation

void ns3::EventGarbageCollector::Cleanup ( )
private

called when a new event was added and the cleanup limit was exceeded in consequence.

Definition at line 59 of file event-garbage-collector.cc.

References Grow(), m_events, m_nextCleanupSize, and Shrink().

Referenced by Track().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::EventGarbageCollector::Grow ( )
private

grow the cleanup limit

Definition at line 43 of file event-garbage-collector.cc.

References CLEANUP_CHUNK_MAX_SIZE, and m_nextCleanupSize.

Referenced by Cleanup(), and Shrink().

+ Here is the caller graph for this function:

void ns3::EventGarbageCollector::Shrink ( )
private

shrink the cleanup limit

Definition at line 50 of file event-garbage-collector.cc.

References Grow(), m_events, and m_nextCleanupSize.

Referenced by Cleanup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

EventList ns3::EventGarbageCollector::m_events
private

the tracked event list

Definition at line 71 of file event-garbage-collector.h.

Referenced by Cleanup(), Shrink(), Track(), and ~EventGarbageCollector().

EventList::size_type ns3::EventGarbageCollector::m_nextCleanupSize
private

batch size for cleanup

Definition at line 70 of file event-garbage-collector.h.

Referenced by Cleanup(), Grow(), Shrink(), and Track().


The documentation for this class was generated from the following files: