54 .SetGroupName (
"Core")
106 if (!ev->IsCancelled ())
124 scheduler->Insert (next);
176 while (!eventsWithContext.empty ())
179 eventsWithContext.pop_front ();
181 ev.
impl =
event.event;
238 ev.
key.
m_ts = (uint64_t) tAbsolute.GetTimeStep ();
329 if (
id.GetUid () == 2)
347 event.
impl =
id.PeekEventImpl ();
348 event.key.m_ts =
id.GetTs ();
349 event.key.m_context =
id.GetContext ();
350 event.key.m_uid =
id.GetUid ();
352 event.impl->Cancel ();
354 event.impl->Unref ();
364 id.PeekEventImpl ()->Cancel ();
371 if (
id.GetUid () == 2)
373 if (
id.PeekEventImpl () == 0 ||
374 id.PeekEventImpl ()->IsCancelled ())
388 if (
id.PeekEventImpl () == 0 ||
392 id.PeekEventImpl ()->IsCancelled ())
405 return TimeStep (0x7fffffffffffffffLL);
virtual Time GetDelayLeft(const EventId &id) const
Get the remaining time until this event will execute.
Simulation virtual time values and global simulation resolution.
EventsWithContext m_eventsWithContext
The container of events from a different context.
virtual bool IsFinished(void) const
Check if the simulation should finish.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint32_t m_currentUid
Unique id of the current event.
ns3::EventImpl declarations.
Ptr< Scheduler > m_events
The event priority queue.
void Unref(void) const
Decrement the reference count.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
int m_unscheduledEvents
Number of events that have been inserted but not yet scheduled, not counting the Destroy events; this...
virtual void DoDispose(void)
Destructor implementation.
uint64_t m_ts
Event time stamp.
ns3::Ptr smart pointer declaration and implementation.
virtual void SetScheduler(ObjectFactory schedulerFactory)
Set the Scheduler to be used to manage the event list.
uint32_t m_uid
Next event unique id.
Wrap an event with its execution context.
static ThreadId Self(void)
Returns the current thread Id.
DestroyEvents m_destroyEvents
The container of events to run at Destroy.
EventImpl * impl
Pointer to the event implementation.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
SystemMutex m_eventsWithContextMutex
Mutex to control access to the list of events with context.
ns3::Simulator declaration.
virtual void DoDispose(void)
Destructor implementation.
virtual EventId ScheduleNow(EventImpl *event)
Schedule an event to run at the current virtual time.
virtual void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
uint32_t context
The event context.
void Invoke(void)
Called by the simulation engine to notify the event that it is time to execute.
EventImpl * event
The event implementation.
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations...
bool m_stop
Flag calling for the end of the simulation.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
EventKey key
Key for sorting and ordering Events.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetSystemId(void) const
Get the system id of this simulator.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
A class which provides a simple way to implement a Critical Section.
uint32_t m_uid
Event unique id.
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
ns3::DefaultSimulatorImpl declaration.
uint32_t m_currentContext
Execution context of the current event.
virtual Time GetMaximumSimulationTime(void) const
Get the maximum representable simulation time.
virtual uint32_t GetContext(void) const
Get the current simulation context.
virtual EventId ScheduleDestroy(EventImpl *event)
Schedule an event to run at the end of the simulation, after the Stop() time or condition has been re...
std::list< struct EventWithContext > EventsWithContext
Container type for the events from a different context.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time TimeStep(uint64_t ts)
virtual void Remove(const EventId &id)
Remove an event from the event list.
The default single process simulator implementation.
uint64_t m_currentTs
Timestamp of the current event.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
static bool Equals(ThreadId id)
Compares an ThreadId with the current ThreadId .
uint64_t timestamp
Event timestamp.
virtual EventId Schedule(const Time &delay, EventImpl *event)
Schedule a future event execution (in the same context).
DefaultSimulatorImpl()
Constructor.
Instantiate subclasses of ns3::Object.
virtual void ScheduleWithContext(uint32_t context, const Time &delay, EventImpl *event)
Schedule a future event execution (in a different context).
~DefaultSimulatorImpl()
Destructor.
virtual void Run(void)
Run the simulation.
An identifier for simulation events.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
bool IsPositive(void) const
virtual void Destroy()
Execute the events scheduled with ScheduleDestroy().
Flag for events not associated with any particular context.
virtual Time Now(void) const
Return the current simulation virtual time.
SystemThread::ThreadId m_main
Main execution thread.
void ProcessOneEvent(void)
Process the next event.
bool m_eventsWithContextEmpty
Flag true if all events with context have been moved to the primary event queue.
ns3::PointerValue attribute value declarations and template implementations.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual bool IsExpired(const EventId &id) const
Check if an event has already run or been cancelled.
uint32_t m_context
Event context.
The SimulatorImpl base class.
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.
void ProcessEventsWithContext(void)
Move events from a different context into the main event queue.