48 .AddConstructor<DefaultSimulatorImpl> ()
97 if (!ev->IsCancelled ())
115 scheduler->Insert (next);
167 while (!eventsWithContext.empty ())
170 eventsWithContext.pop_front ();
172 ev.
impl =
event.event;
320 if (
id.GetUid () == 2)
338 event.
impl =
id.PeekEventImpl ();
339 event.key.m_ts =
id.GetTs ();
340 event.key.m_context =
id.GetContext ();
341 event.key.m_uid =
id.GetUid ();
343 event.impl->Cancel ();
345 event.impl->Unref ();
355 id.PeekEventImpl ()->Cancel ();
362 if (
id.GetUid () == 2)
364 if (
id.PeekEventImpl () == 0 ||
365 id.PeekEventImpl ()->IsCancelled ())
379 if (
id.PeekEventImpl () == 0 ||
383 id.PeekEventImpl ()->IsCancelled ())
398 return TimeStep (0x7fffffffffffffffLL);
Simulation virtual time values and global simulation resolution.
EventsWithContext m_eventsWithContext
Smart pointer class similar to boost::intrusive_ptr.
bool IsPositive(void) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
ns3::EventImpl declarations.
Ptr< Scheduler > m_events
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual void DoDispose(void)
Destructor implementation.
uint64_t m_ts
Event time stamp.
Smart pointer implementation.
virtual Time GetMaximumSimulationTime(void) const
Get the maximum representable simulation time.
virtual void SetScheduler(ObjectFactory schedulerFactory)
Set the Scheduler to be used to manage the event list.
static ThreadId Self(void)
Returns the current thread Id.
DestroyEvents m_destroyEvents
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
virtual void DoDispose(void)
Destructor implementation.
ns3::Simulator declaration.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
virtual EventId ScheduleNow(EventImpl *event)
Schedule an event to run at the current virtual time.
virtual uint32_t GetSystemId(void) const
Get the system id of this simulator.
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...
void Invoke(void)
Called by the simulation engine to notify the event that it is time to execute.
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations...
EventKey key
Key for sorting and ordering Events.
static TypeId GetTypeId(void)
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.
virtual Time Now(void) const
Return the current simulation virtual time.
void Unref(void) const
Decrement the reference count.
uint32_t m_currentContext
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
virtual Time GetDelayLeft(const EventId &id) const
Get the remaining time until this event will execute.
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
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.
virtual uint32_t GetContext(void) const
Get the current simulation context.
int64_t GetTimeStep(void) const
Time TimeStep(uint64_t ts)
virtual void Remove(const EventId &id)
Remove an event from the event list.
virtual void ScheduleWithContext(uint32_t context, Time const &time, EventImpl *event)
Schedule a future event execution (in a different context).
static bool Equals(ThreadId id)
Compares an ThreadId with the current ThreadId .
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual EventId Schedule(Time const &time, EventImpl *event)
Schedule a future event execution (in the same context).
Instantiate subclasses of ns3::Object.
virtual bool IsFinished(void) const
Check if the simulation should finish.
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.
virtual void Destroy()
Execute the events scheduled with ScheduleDestroy().
virtual bool IsExpired(const EventId &id) const
Check if an event has already run or been cancelled.
SystemThread::ThreadId m_main
void ProcessOneEvent(void)
bool m_eventsWithContextEmpty
Pointer attribute value declarations and template implementations.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
uint32_t m_context
Event context.
The SimulatorImpl base class.
void ProcessEventsWithContext(void)