|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
54 .SetGroupName (
"Core")
107 if (!ev->IsCancelled ())
125 scheduler->Insert (next);
178 while (!eventsWithContext.empty ())
181 eventsWithContext.pop_front ();
183 ev.
impl =
event.event;
331 if (
id.GetUid () == 2)
349 event.
impl =
id.PeekEventImpl ();
350 event.key.m_ts =
id.GetTs ();
351 event.key.m_context =
id.GetContext ();
352 event.key.m_uid =
id.GetUid ();
354 event.impl->Cancel ();
356 event.impl->Unref ();
366 id.PeekEventImpl ()->Cancel ();
373 if (
id.GetUid () == 2)
375 if (
id.PeekEventImpl () == 0
376 ||
id.PeekEventImpl ()->IsCancelled ())
390 if (
id.PeekEventImpl () == 0
393 ||
id.PeekEventImpl ()->IsCancelled ())
406 return TimeStep (0x7fffffffffffffffLL);
virtual EventId ScheduleNow(EventImpl *event)
Schedule an event to run at the current virtual time.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
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...
An identifier for simulation events.
virtual Time GetDelayLeft(const EventId &id) const
Get the remaining time until this event will execute.
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.
EventImpl * impl
Pointer to the event implementation.
static TypeId GetTypeId(void)
Register this type.
virtual uint64_t GetEventCount(void) const
Get the number of events executed.
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
void ProcessOneEvent(void)
Process the next event.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
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...
TypeId SetParent(TypeId tid)
Set the parent TypeId.
ns3::Scheduler abstract base class, ns3::Scheduler::Event and ns3::Scheduler::EventKey declarations.
bool m_eventsWithContextEmpty
Flag true if all events with context have been moved to the primary event queue.
uint64_t m_ts
Event time stamp.
SystemThread::ThreadId m_main
Main execution thread.
virtual EventId Schedule(const Time &delay, EventImpl *event)
Schedule a future event execution (in the same context).
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.
Smart pointer class similar to boost::intrusive_ptr.
DestroyEvents m_destroyEvents
The container of events to run at Destroy.
The default single process simulator implementation.
void ProcessEventsWithContext(void)
Move events from a different context into the main event queue.
virtual void ScheduleWithContext(uint32_t context, const Time &delay, EventImpl *event)
Schedule a future event execution (in a different context).
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
EventKey key
Key for sorting and ordering Events.
uint32_t m_context
Event context.
DefaultSimulatorImpl()
Constructor.
uint64_t m_currentTs
Timestamp of the current event.
void Invoke(void)
Called by the simulation engine to notify the event that it is time to execute.
ns3::PointerValue attribute value declarations and template implementations.
A class which provides a simple way to implement a Critical Section.
Instantiate subclasses of ns3::Object.
virtual Time Now(void) const
Return the current simulation virtual time.
SystemMutex m_eventsWithContextMutex
Mutex to control access to the list of events with context.
ns3::EventImpl declarations.
virtual void Run(void)
Run the simulation.
Simulation virtual time values and global simulation resolution.
virtual uint32_t GetSystemId(void) const
Get the system id of this simulator.
void Unref(void) const
Decrement the reference count.
int m_unscheduledEvents
Number of events that have been inserted but not yet scheduled, not counting the Destroy events; this...
virtual Time GetMaximumSimulationTime(void) const
Get the maximum representable simulation time.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< Scheduler > m_events
The event priority queue.
virtual void Destroy()
Execute the events scheduled with ScheduleDestroy().
static bool Equals(ThreadId id)
Compares an ThreadId with the current ThreadId .
virtual uint32_t GetContext(void) const
Get the current simulation context.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
std::list< struct EventWithContext > EventsWithContext
Container type for the events from a different context.
static ThreadId Self(void)
Returns the current thread Id.
bool IsPositive(void) const
Exactly equivalent to t >= 0.
uint32_t m_uid
Next event unique id.
uint64_t m_eventCount
The event count.
uint64_t timestamp
Event timestamp.
ns3::DefaultSimulatorImpl declaration.
uint32_t context
The event context.
uint32_t m_currentContext
Execution context of the current event.
The SimulatorImpl base class.
virtual void DoDispose(void)
Destructor implementation.
ns3::Simulator declaration.
virtual bool IsFinished(void) const
Check if the simulation should finish.
Wrap an event with its execution context.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
virtual void SetScheduler(ObjectFactory schedulerFactory)
Set the Scheduler to be used to manage the event list.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
virtual bool IsExpired(const EventId &id) const
Check if an event has already run or been cancelled.
~DefaultSimulatorImpl()
Destructor.
ns3::Ptr smart pointer declaration and implementation.
@ NO_CONTEXT
Flag for events not associated with any particular context.
EventImpl * event
The event implementation.
uint32_t m_currentUid
Unique id of the current event.
bool m_stop
Flag calling for the end of the simulation.
virtual void Remove(const EventId &id)
Remove an event from the event list.
virtual void DoDispose(void)
Destructor implementation.
EventsWithContext m_eventsWithContext
The container of events from a different context.
uint32_t m_uid
Event unique id.