A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
simulator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef SIMULATOR_H
10#define SIMULATOR_H
11
12#include "event-id.h"
13#include "event-impl.h"
14#include "make-event.h"
15#include "nstime.h"
16#include "object-factory.h"
17
18#include <stdint.h>
19#include <string>
20
21/**
22 * @file
23 * @ingroup simulator
24 * ns3::Simulator declaration.
25 */
26
27namespace ns3
28{
29
30class SimulatorImpl;
31class Scheduler;
32
33/**
34 * @ingroup core
35 * @defgroup simulator Simulator
36 * @brief Control the virtual time and the execution of simulation events.
37 */
38/**
39 * @ingroup simulator
40 *
41 * @brief Control the scheduling of simulation events.
42 *
43 * The internal simulation clock is maintained
44 * as a 64-bit integer in a unit specified by the user
45 * through the Time::SetResolution function. This means that it is
46 * not possible to specify event expiration times with anything better
47 * than this user-specified accuracy. Events whose expiration time is
48 * the same modulo this accuracy are scheduled in FIFO order: the
49 * first event inserted in the scheduling queue is scheduled to
50 * expire first.
51 *
52 * A simple example of how to use the Simulator class to schedule events
53 * is shown in sample-simulator.cc:
54 * @include src/core/examples/sample-simulator.cc
55 */
57{
58 public:
59 // Delete default constructor and destructor to avoid misuse
60 Simulator() = delete;
61 ~Simulator() = delete;
62
63 /**
64 * @param [in] impl A new simulator implementation.
65 *
66 * The simulator provides a mechanism to swap out different implementations.
67 * For example, the default implementation is a single-threaded simulator
68 * that performs no realtime synchronization. By calling this method, you
69 * can substitute in a new simulator implementation that might be multi-
70 * threaded and synchronize events to a realtime clock.
71 *
72 * The simulator implementation can be set when the simulator is not
73 * running.
74 */
75 static void SetImplementation(Ptr<SimulatorImpl> impl);
76
77 /**
78 * @brief Get the SimulatorImpl singleton.
79 *
80 * @internal
81 * If the SimulatorImpl singleton hasn't been created yet,
82 * this function does so. At the same time it also creates
83 * the Scheduler. Both of these respect the global values
84 * which may have been set from the command line or through
85 * the Config system.
86 *
87 * As a side effect we also call LogSetTimePrinter() and
88 * LogSetNodePrinter() with the default implementations
89 * since we can't really do any logging until we have
90 * a SimulatorImpl and Scheduler.
91
92 * @return The SimulatorImpl singleton.
93 */
95
96 /**
97 * @brief Set the scheduler type with an ObjectFactory.
98 * @param [in] schedulerFactory The configured ObjectFactory.
99 *
100 * The event scheduler can be set at any time: the events scheduled
101 * in the previous scheduler will be transferred to the new scheduler
102 * before we start to use it.
103 */
104 static void SetScheduler(ObjectFactory schedulerFactory);
105
106 /**
107 * Execute the events scheduled with ScheduleDestroy().
108 *
109 * This method is typically invoked at the end of a simulation
110 * to avoid false-positive reports by a leak checker.
111 * After this method has been invoked, it is actually possible
112 * to restart a new simulation with a set of calls to Simulator::Run,
113 * Simulator::Schedule and Simulator::ScheduleWithContext.
114 *
115 * @hidecaller
116 */
117 static void Destroy();
118
119 /**
120 * Check if the simulation should finish.
121 *
122 * Reasons to finish are because there are
123 * no more events lefts to be scheduled, or if simulation
124 * time has already reached the "stop time" (see Simulator::Stop()).
125 *
126 * @return @c true if no more events or stop time reached.
127 */
128 static bool IsFinished();
129
130 /**
131 * Run the simulation.
132 *
133 * The simulation will run until one of:
134 * - No events are present anymore
135 * - The user called Simulator::Stop
136 * - The user called Simulator::Stop with a stop time and the
137 * expiration time of the next event to be processed
138 * is greater than or equal to the stop time.
139 *
140 * @hidecaller
141 */
142 static void Run();
143
144 /**
145 * Tell the Simulator the calling event should be the last one
146 * executed.
147 *
148 * If a running event invokes this method, it will be the last
149 * event executed by the Simulator::Run method before
150 * returning to the caller.
151 *
152 * @hidecaller
153 */
154 static void Stop();
155
156 /**
157 * Schedule the time delay until the Simulator should stop.
158 *
159 * Force the Simulator::Run method to return to the caller when the
160 * expiration time of the next event to be processed is greater than
161 * or equal to the stop time. The stop time is relative to the
162 * current simulation time.
163 * @param [in] delay The stop time, relative to the current time.
164 * @return The stop EventId.
165 *
166 * @hidecaller
167 */
168 static EventId Stop(const Time& delay);
169
170 /**
171 * Returns the Stop Event, or an invalid event if the simulation
172 * does not have a scheduled stop time.
173 * @return The stop EventId.
174 */
175 static EventId GetStopEvent();
176
177 /**
178 * Get the current simulation context.
179 *
180 * The simulation context is the ns-3 notion of a Logical Process.
181 * Events in a single context should only modify state associated with
182 * that context. Events for objects in other contexts should be
183 * scheduled with ScheduleWithContext() to track the context switches.
184 * In other words, events in different contexts should be mutually
185 * thread safe, by not modify overlapping model state.
186 *
187 * In circumstances where the context can't be determined, such as
188 * during object initialization, the \c enum value \c NO_CONTEXT
189 * should be used.
190 *
191 * @return The current simulation context
192 */
193 static uint32_t GetContext();
194
195 /**
196 * Context enum values.
197 *
198 * @internal
199 * This enum type is fixed to match the representation size
200 * of simulation context.
201 */
202 enum : uint32_t
203 {
204 /**
205 * Flag for events not associated with any particular context.
206 */
207 NO_CONTEXT = 0xffffffff
208 };
209
210 /**
211 * Get the number of events executed.
212 * @returns The total number of events executed.
213 */
214 static uint64_t GetEventCount();
215
216 /**
217 * @name Schedule events (in the same context) to run at a future time.
218 */
219 /** @{ */
220 /**
221 * Schedule an event to expire after @p delay.
222 * This can be thought of as scheduling an event
223 * for the current simulation time plus the @p delay passed as a
224 * parameter.
225 *
226 * We leverage SFINAE to discard this overload if the second argument is
227 * convertible to Ptr<EventImpl> or is a function pointer.
228 *
229 * @tparam FUNC @deduced Template type for the function to invoke.
230 * @tparam Ts @deduced Argument types.
231 * @param [in] delay The relative expiration time of the event.
232 * @param [in] f The function to invoke.
233 * @param [in] args Arguments to pass to MakeEvent.
234 * @returns The id for the scheduled event.
235 * @hidecaller
236 */
237 template <typename FUNC,
238 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
239 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
240 typename... Ts>
241 static EventId Schedule(const Time& delay, FUNC f, Ts&&... args);
242
243 /**
244 * Schedule an event to expire after @p delay.
245 * This can be thought of as scheduling an event
246 * for the current simulation time plus the @p delay passed as a
247 * parameter.
248 *
249 * @tparam Us @deduced Formal function argument types.
250 * @tparam Ts @deduced Actual function argument types.
251 * When the event expires (when it becomes due to be run), the
252 * function will be invoked with any supplied arguments.
253 * @param [in] delay The relative expiration time of the event.
254 * @param [in] f The function to invoke.
255 * @param [in] args Arguments to pass to the invoked function.
256 * @returns The id for the scheduled event.
257 * @hidecaller
258 */
259 template <typename... Us, typename... Ts>
260 static EventId Schedule(const Time& delay, void (*f)(Us...), Ts&&... args);
261 /** @} */ // Schedule events (in the same context) to run at a future time.
262
263 /**
264 * @name Schedule events (in a different context) to run now or at a future time.
265 *
266 * See @ref main-test-sync.cc for example usage.
267 */
268 /** @{ */
269 /**
270 * Schedule an event with the given context.
271 * A context of 0xffffffff means no context is specified.
272 * This method is thread-safe: it can be called from any thread.
273 *
274 * We leverage SFINAE to discard this overload if the second argument is
275 * convertible to Ptr<EventImpl> or is a function pointer.
276 *
277 * @tparam FUNC @deduced Template type for the function to invoke.
278 * @tparam Ts @deduced Argument types.
279 * @param [in] context User-specified context parameter
280 * @param [in] delay The relative expiration time of the event.
281 * @param [in] f The function to invoke.
282 * @param [in] args Arguments to pass to MakeEvent.
283 * @hidecaller
284 */
285 template <typename FUNC,
286 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
287 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
288 typename... Ts>
289 static void ScheduleWithContext(uint32_t context, const Time& delay, FUNC f, Ts&&... args);
290
291 /**
292 * Schedule an event with the given context.
293 * A context of 0xffffffff means no context is specified.
294 * This method is thread-safe: it can be called from any thread.
295 *
296 * @tparam Us @deduced Formal function argument types.
297 * @tparam Ts @deduced Actual function argument types.
298 * @param [in] context User-specified context parameter
299 * @param [in] delay The relative expiration time of the event.
300 * @param [in] f The function to invoke.
301 * @param [in] args Arguments to pass to the invoked function.
302 * @hidecaller
303 */
304 template <typename... Us, typename... Ts>
305 static void ScheduleWithContext(uint32_t context,
306 const Time& delay,
307 void (*f)(Us...),
308 Ts&&... args);
309 /** @} */ // Schedule events (in a different context) to run now or at a future time.
310
311 /**
312 * @name Schedule events (in the same context) to run now.
313 */
314 /** @{ */
315 /**
316 * Schedule an event to expire Now. All events scheduled to
317 * to expire "Now" are scheduled FIFO, after all normal events
318 * have expired.
319 *
320 * We leverage SFINAE to discard this overload if the second argument is
321 * convertible to Ptr<EventImpl> or is a function pointer.
322 *
323 * @tparam FUNC @deduced Template type for the function to invoke.
324 * @tparam Ts @deduced Actual function argument types.
325 * @param [in] f The function to invoke.
326 * @param [in] args Arguments to pass to the invoked function.
327 * @return The EventId of the scheduled event.
328 * @hidecaller
329 */
330 template <typename FUNC,
331 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
332 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
333 typename... Ts>
334 static EventId ScheduleNow(FUNC f, Ts&&... args);
335
336 /**
337 * Schedule an event to expire Now. All events scheduled to
338 * to expire "Now" are scheduled FIFO, after all normal events
339 * have expired.
340 *
341 * @tparam Us @deduced Formal function argument types.
342 * @tparam Ts @deduced Actual function argument types.
343 * @param [in] f The function to invoke.
344 * @param [in] args Arguments to pass to MakeEvent.
345 * @return The EventId of the scheduled event.
346 * @hidecaller
347 */
348 template <typename... Us, typename... Ts>
349 static EventId ScheduleNow(void (*f)(Us...), Ts&&... args);
350
351 /** @} */ // Schedule events (in the same context) to run now.
352
353 /**
354 * @name Schedule events to run at the end of the simulation, when Simulator:Destroy() is
355 * called.
356 */
357 /** @{ */
358 /**
359 * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
360 * All events scheduled to expire at "Destroy" time are scheduled FIFO,
361 * after all normal events have expired and only when
362 * Simulator::Destroy is invoked.
363 *
364 * We leverage SFINAE to discard this overload if the second argument is
365 * convertible to Ptr<EventImpl> or is a function pointer.
366 *
367 * @tparam FUNC @deduced Template type for the function to invoke.
368 * @tparam Ts @deduced Actual function argument types.
369 * @param [in] f The function to invoke.
370 * @param [in] args Arguments to pass to MakeEvent.
371 * @return The EventId of the scheduled event.
372 */
373 template <typename FUNC,
374 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
375 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
376 typename... Ts>
377 static EventId ScheduleDestroy(FUNC f, Ts&&... args);
378
379 /**
380 * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
381 * All events scheduled to expire at "Destroy" time are scheduled FIFO,
382 * after all normal events have expired and only when
383 * Simulator::Destroy is invoked.
384 *
385 * @tparam Us @deduced Formal function argument types.
386 * @tparam Ts @deduced Actual function argument types.
387 * @param [in] f The function to invoke.
388 * @param [in] args Arguments to pass to MakeEvent.
389 * @return The EventId of the scheduled event.
390 */
391 template <typename... Us, typename... Ts>
392 static EventId ScheduleDestroy(void (*f)(Us...), Ts&&... args);
393
394 /** @} */ // Schedule events to run when Simulator:Destroy() is called.
395
396 /**
397 * Remove an event from the event list.
398 *
399 * This method has the same visible effect as the
400 * ns3::EventId::Cancel method
401 * but its algorithmic complexity is much higher: it has often
402 * O(log(n)) complexity, sometimes O(n), sometimes worse.
403 * Note that it is not possible to remove events which were scheduled
404 * for the "destroy" time. Doing so will result in a program error (crash).
405 *
406 * @param [in] id The event to remove from the list of scheduled events.
407 */
408 static void Remove(const EventId& id);
409
410 /**
411 * Set the cancel bit on this event: the event's associated function
412 * will not be invoked when it expires.
413 *
414 * This method has the same visible effect as the
415 * ns3::Simulator::Remove method but its algorithmic complexity is
416 * much lower: it has O(1) complexity.
417 * This method has the exact same semantics as ns3::EventId::Cancel.
418 * Note that it is not possible to cancel events which were scheduled
419 * for the "destroy" time. Doing so will result in a program error (crash).
420 *
421 * @param [in] id the event to cancel
422 */
423 static void Cancel(const EventId& id);
424
425 /**
426 * Check if an event has already run or been cancelled.
427 *
428 * This method has O(1) complexity.
429 * Note that it is not possible to test for the expiration of
430 * events which were scheduled for the "destroy" time. Doing so
431 * will result in a program error (crash).
432 * An event is said to "expire" when it starts being executed,
433 * which means that if the code executed by the event calls
434 * this function, it will get true.
435 *
436 * @param [in] id The event to test for expiration.
437 * @returns @c true if the event has expired, false otherwise.
438 */
439 static bool IsExpired(const EventId& id);
440
441 /**
442 * Return the current simulation virtual time.
443 *
444 * @returns The current virtual time.
445 * @hidecaller
446 */
447 static Time Now();
448
449 /**
450 * Get the remaining time until this event will execute.
451 *
452 * @param [in] id The event id to analyse.
453 * @return The delay left until the input event id expires.
454 * if the event is not running, this method returns
455 * zero.
456 */
457 static Time GetDelayLeft(const EventId& id);
458
459 /**
460 * Get the maximum representable simulation time.
461 *
462 * @return The maximum simulation time at which an event
463 * can be scheduled.
464 *
465 * The returned value will always be bigger than or equal to Simulator::Now.
466 */
468
469 /**
470 * Schedule a future event execution (in the same context).
471 *
472 * @param [in] delay Delay until the event expires.
473 * @param [in] event The event to schedule.
474 * @returns A unique identifier for the newly-scheduled event.
475 * @hidecaller
476 */
477 static EventId Schedule(const Time& delay, const Ptr<EventImpl>& event);
478
479 /**
480 * Schedule a future event execution (in a different context).
481 * This method is thread-safe: it can be called from any thread.
482 *
483 * @param [in] delay Delay until the event expires.
484 * @param [in] context Event context.
485 * @param [in] event The event to schedule.
486 * @hidecaller
487 */
488 static void ScheduleWithContext(uint32_t context, const Time& delay, EventImpl* event);
489
490 /**
491 * Schedule an event to run at the end of the simulation, after
492 * the Stop() time or condition has been reached.
493 *
494 * @param [in] event The event to schedule.
495 * @returns A unique identifier for the newly-scheduled event.
496 */
497 static EventId ScheduleDestroy(const Ptr<EventImpl>& event);
498
499 /**
500 * Schedule an event to run at the current virtual time.
501 *
502 * @param [in] event The event to schedule.
503 * @returns A unique identifier for the newly-scheduled event.
504 * @hidecaller
505 */
506 static EventId ScheduleNow(const Ptr<EventImpl>& event);
507
508 /**
509 * Get the system id of this simulator.
510 *
511 * The system id is the identifier for this simulator instance
512 * in a distributed simulation. For MPI this is the MPI rank.
513 * @return The system id for this simulator.
514 */
515 static uint32_t GetSystemId();
516
517 private:
518 /**
519 * Implementation of the various Schedule methods.
520 * @param [in] delay Delay until the event should execute.
521 * @param [in] event The event to execute.
522 * @return The EventId.
523 */
524 static EventId DoSchedule(const Time& delay, EventImpl* event);
525 /**
526 * Implementation of the various ScheduleNow methods.
527 * @param [in] event The event to execute.
528 * @return The EventId.
529 */
530 static EventId DoScheduleNow(EventImpl* event);
531 /**
532 * Implementation of the various ScheduleDestroy methods.
533 * @param [in] event The event to execute.
534 * @return The EventId.
535 */
536 static EventId DoScheduleDestroy(EventImpl* event);
537
538 /**
539 * Stop event (if present)
540 */
542
543 // end of class Simulator
544};
545
546/**
547 * @ingroup simulator
548 * @brief create an ns3::Time instance which contains the
549 * current simulation time.
550 *
551 * This is really a shortcut for the ns3::Simulator::Now method.
552 * It is typically used as shown below to schedule an event
553 * which expires at the absolute time "2 seconds":
554 * @code
555 * Simulator::Schedule (Seconds (2.0) - Now (), &my_function);
556 * @endcode
557 * @return The current simulation time.
558 * @hidecaller
559 */
560Time Now();
561
562} // namespace ns3
563
564/********************************************************************
565 * Implementation of the templates declared above.
566 ********************************************************************/
567
568namespace ns3
569{
570
571// Doxygen has trouble with static template functions in a class:
572// it treats the in-class declaration as different from the
573// out of class definition, so makes two entries in the member list. Ugh
574
575template <typename FUNC,
576 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
577 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
578 typename... Ts>
579EventId
580Simulator::Schedule(const Time& delay, FUNC f, Ts&&... args)
581{
582 return DoSchedule(delay, MakeEvent(f, std::forward<Ts>(args)...));
583}
584
585template <typename... Us, typename... Ts>
587Simulator::Schedule(const Time& delay, void (*f)(Us...), Ts&&... args)
588{
589 return DoSchedule(delay, MakeEvent(f, std::forward<Ts>(args)...));
590}
591
592template <typename FUNC,
593 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
594 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
595 typename... Ts>
596void
597Simulator::ScheduleWithContext(uint32_t context, const Time& delay, FUNC f, Ts&&... args)
598{
599 return ScheduleWithContext(context, delay, MakeEvent(f, std::forward<Ts>(args)...));
600}
601
602template <typename... Us, typename... Ts>
603void
604Simulator::ScheduleWithContext(uint32_t context, const Time& delay, void (*f)(Us...), Ts&&... args)
605{
606 return ScheduleWithContext(context, delay, MakeEvent(f, std::forward<Ts>(args)...));
607}
608
609template <typename FUNC,
610 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
611 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
612 typename... Ts>
614Simulator::ScheduleNow(FUNC f, Ts&&... args)
615{
616 return DoScheduleNow(MakeEvent(f, std::forward<Ts>(args)...));
617}
618
619template <typename... Us, typename... Ts>
621Simulator::ScheduleNow(void (*f)(Us...), Ts&&... args)
622{
623 return DoScheduleNow(MakeEvent(f, std::forward<Ts>(args)...));
624}
625
626template <typename FUNC,
627 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
628 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
629 typename... Ts>
631Simulator::ScheduleDestroy(FUNC f, Ts&&... args)
632{
633 return DoScheduleDestroy(MakeEvent(f, std::forward<Ts>(args)...));
634}
635
636template <typename... Us, typename... Ts>
638Simulator::ScheduleDestroy(void (*f)(Us...), Ts&&... args)
639{
640 return DoScheduleDestroy(MakeEvent(f, std::forward<Ts>(args)...));
641}
642
643} // namespace ns3
644
645#endif /* SIMULATOR_H */
An identifier for simulation events.
Definition event-id.h:44
A simulation event.
Definition event-impl.h:35
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Maintain the event list.
Definition scheduler.h:146
static EventId DoScheduleDestroy(EventImpl *event)
Implementation of the various ScheduleDestroy methods.
Definition simulator.cc:252
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:580
static Ptr< SimulatorImpl > GetImplementation()
Get the SimulatorImpl singleton.
Definition simulator.cc:356
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition simulator.cc:268
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:597
static EventId m_stopEvent
Stop event (if present).
Definition simulator.h:541
static bool IsFinished()
Check if the simulation should finish.
Definition simulator.cc:154
static uint32_t GetSystemId()
Get the system id of this simulator.
Definition simulator.cc:313
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition simulator.cc:278
Simulator()=delete
static EventId ScheduleDestroy(FUNC f, Ts &&... args)
Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
Definition simulator.h:631
static void SetScheduler(ObjectFactory schedulerFactory)
Set the scheduler type with an ObjectFactory.
Definition simulator.cc:147
static EventId DoScheduleNow(EventImpl *event)
Implementation of the various ScheduleNow methods.
Definition simulator.cc:243
@ NO_CONTEXT
Flag for events not associated with any particular context.
Definition simulator.h:207
static uint64_t GetEventCount()
Get the number of events executed.
Definition simulator.cc:307
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:614
~Simulator()=delete
static EventId DoSchedule(const Time &delay, EventImpl *event)
Implementation of the various Schedule methods.
Definition simulator.cc:234
static Time GetMaximumSimulationTime()
Get the maximum representable simulation time.
Definition simulator.cc:294
static void Remove(const EventId &id)
Remove an event from the event list.
Definition simulator.cc:258
static EventId GetStopEvent()
Returns the Stop Event, or an invalid event if the simulation does not have a scheduled stop time.
Definition simulator.cc:185
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
static void SetImplementation(Ptr< SimulatorImpl > impl)
Definition simulator.cc:328
static uint32_t GetContext()
Get the current simulation context.
Definition simulator.cc:301
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition simulator.cc:200
The SimulatorImpl base class.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:96
ns3::EventId declarations.
ns3::EventImpl declarations.
std::enable_if_t< std::is_member_pointer_v< MEM >, EventImpl * > MakeEvent(MEM mem_ptr, OBJ obj, Ts... args)
Make an EventImpl from class method members which take varying numbers of arguments.
Definition make-event.h:133
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition simulator.cc:288
ns3::MakeEvent function declarations and template implementation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes.
ns3::ObjectFactory class declaration.