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 static void Destroy();
116
117 /**
118 * Check if the simulation should finish.
119 *
120 * Reasons to finish are because there are
121 * no more events lefts to be scheduled, or if simulation
122 * time has already reached the "stop time" (see Simulator::Stop()).
123 *
124 * @return @c true if no more events or stop time reached.
125 */
126 static bool IsFinished();
127
128 /**
129 * Run the simulation.
130 *
131 * The simulation will run until one of:
132 * - No events are present anymore
133 * - The user called Simulator::Stop
134 * - The user called Simulator::Stop with a stop time and the
135 * expiration time of the next event to be processed
136 * is greater than or equal to the stop time.
137 */
138 static void Run();
139
140 /**
141 * Tell the Simulator the calling event should be the last one
142 * executed.
143 *
144 * If a running event invokes this method, it will be the last
145 * event executed by the Simulator::Run method before
146 * returning to the caller.
147 */
148 static void Stop();
149
150 /**
151 * Schedule the time delay until the Simulator should stop.
152 *
153 * Force the Simulator::Run method to return to the caller when the
154 * expiration time of the next event to be processed is greater than
155 * or equal to the stop time. The stop time is relative to the
156 * current simulation time.
157 * @param [in] delay The stop time, relative to the current time.
158 * @return The stop EventId.
159 */
160 static EventId Stop(const Time& delay);
161
162 /**
163 * Returns the Stop Event, or an invalid event if the simulation
164 * does not have a scheduled stop time.
165 * @return The stop EventId.
166 */
167 static EventId GetStopEvent();
168
169 /**
170 * Get the current simulation context.
171 *
172 * The simulation context is the ns-3 notion of a Logical Process.
173 * Events in a single context should only modify state associated with
174 * that context. Events for objects in other contexts should be
175 * scheduled with ScheduleWithContext() to track the context switches.
176 * In other words, events in different contexts should be mutually
177 * thread safe, by not modify overlapping model state.
178 *
179 * In circumstances where the context can't be determined, such as
180 * during object initialization, the \c enum value \c NO_CONTEXT
181 * should be used.
182 *
183 * @return The current simulation context
184 */
185 static uint32_t GetContext();
186
187 /**
188 * Context enum values.
189 *
190 * \internal
191 * This enum type is fixed to match the representation size
192 * of simulation context.
193 */
194 enum : uint32_t
195 {
196 /**
197 * Flag for events not associated with any particular context.
198 */
199 NO_CONTEXT = 0xffffffff
200 };
201
202 /**
203 * Get the number of events executed.
204 * \returns The total number of events executed.
205 */
206 static uint64_t GetEventCount();
207
208 /**
209 * @name Schedule events (in the same context) to run at a future time.
210 */
211 /** @{ */
212 /**
213 * Schedule an event to expire after @p delay.
214 * This can be thought of as scheduling an event
215 * for the current simulation time plus the @p delay passed as a
216 * parameter.
217 *
218 * We leverage SFINAE to discard this overload if the second argument is
219 * convertible to Ptr<EventImpl> or is a function pointer.
220 *
221 * @tparam FUNC @deduced Template type for the function to invoke.
222 * @tparam Ts @deduced Argument types.
223 * @param [in] delay The relative expiration time of the event.
224 * @param [in] f The function to invoke.
225 * @param [in] args Arguments to pass to MakeEvent.
226 * @returns The id for the scheduled event.
227 */
228 template <typename FUNC,
229 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
230 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
231 typename... Ts>
232 static EventId Schedule(const Time& delay, FUNC f, Ts&&... args);
233
234 /**
235 * Schedule an event to expire after @p delay.
236 * This can be thought of as scheduling an event
237 * for the current simulation time plus the @p delay passed as a
238 * parameter.
239 *
240 * @tparam Us @deduced Formal function argument types.
241 * @tparam Ts @deduced Actual function argument types.
242 * When the event expires (when it becomes due to be run), the
243 * function will be invoked with any supplied arguments.
244 * @param [in] delay The relative expiration time of the event.
245 * @param [in] f The function to invoke.
246 * @param [in] args Arguments to pass to the invoked function.
247 * @returns The id for the scheduled event.
248 */
249 template <typename... Us, typename... Ts>
250 static EventId Schedule(const Time& delay, void (*f)(Us...), Ts&&... args);
251 /** @} */ // Schedule events (in the same context) to run at a future time.
252
253 /**
254 * @name Schedule events (in a different context) to run now or at a future time.
255 *
256 * See @ref main-test-sync.cc for example usage.
257 */
258 /** @{ */
259 /**
260 * Schedule an event with the given context.
261 * A context of 0xffffffff means no context is specified.
262 * This method is thread-safe: it can be called from any thread.
263 *
264 * We leverage SFINAE to discard this overload if the second argument is
265 * convertible to Ptr<EventImpl> or is a function pointer.
266 *
267 * @tparam FUNC @deduced Template type for the function to invoke.
268 * @tparam Ts @deduced Argument types.
269 * @param [in] context User-specified context parameter
270 * @param [in] delay The relative expiration time of the event.
271 * @param [in] f The function to invoke.
272 * @param [in] args Arguments to pass to MakeEvent.
273 */
274 template <typename FUNC,
275 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
276 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
277 typename... Ts>
278 static void ScheduleWithContext(uint32_t context, const Time& delay, FUNC f, Ts&&... args);
279
280 /**
281 * Schedule an event with the given context.
282 * A context of 0xffffffff means no context is specified.
283 * This method is thread-safe: it can be called from any thread.
284 *
285 * @tparam Us @deduced Formal function argument types.
286 * @tparam Ts @deduced Actual function argument types.
287 * @param [in] context User-specified context parameter
288 * @param [in] delay The relative expiration time of the event.
289 * @param [in] f The function to invoke.
290 * @param [in] args Arguments to pass to the invoked function.
291 */
292 template <typename... Us, typename... Ts>
293 static void ScheduleWithContext(uint32_t context,
294 const Time& delay,
295 void (*f)(Us...),
296 Ts&&... args);
297 /** @} */ // Schedule events (in a different context) to run now or at a future time.
298
299 /**
300 * @name Schedule events (in the same context) to run now.
301 */
302 /** @{ */
303 /**
304 * Schedule an event to expire Now. All events scheduled to
305 * to expire "Now" are scheduled FIFO, after all normal events
306 * have expired.
307 *
308 * We leverage SFINAE to discard this overload if the second argument is
309 * convertible to Ptr<EventImpl> or is a function pointer.
310 *
311 * @tparam FUNC @deduced Template type for the function to invoke.
312 * @tparam Ts @deduced Actual function argument types.
313 * @param [in] f The function to invoke.
314 * @param [in] args Arguments to pass to the invoked function.
315 * @return The EventId of the scheduled event.
316 */
317 template <typename FUNC,
318 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
319 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
320 typename... Ts>
321 static EventId ScheduleNow(FUNC f, Ts&&... args);
322
323 /**
324 * Schedule an event to expire Now. All events scheduled to
325 * to expire "Now" are scheduled FIFO, after all normal events
326 * have expired.
327 *
328 * @tparam Us @deduced Formal function argument types.
329 * @tparam Ts @deduced Actual function argument types.
330 * @param [in] f The function to invoke.
331 * @param [in] args Arguments to pass to MakeEvent.
332 * @return The EventId of the scheduled event.
333 */
334 template <typename... Us, typename... Ts>
335 static EventId ScheduleNow(void (*f)(Us...), Ts&&... args);
336
337 /** @} */ // Schedule events (in the same context) to run now.
338
339 /**
340 * @name Schedule events to run at the end of the simulation, when Simulator:Destroy() is
341 * called.
342 */
343 /** @{ */
344 /**
345 * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
346 * All events scheduled to expire at "Destroy" time are scheduled FIFO,
347 * after all normal events have expired and only when
348 * Simulator::Destroy is invoked.
349 *
350 * We leverage SFINAE to discard this overload if the second argument is
351 * convertible to Ptr<EventImpl> or is a function pointer.
352 *
353 * @tparam FUNC @deduced Template type for the function to invoke.
354 * @tparam Ts @deduced Actual function argument types.
355 * @param [in] f The function to invoke.
356 * @param [in] args Arguments to pass to MakeEvent.
357 * @return The EventId of the scheduled event.
358 */
359 template <typename FUNC,
360 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
361 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
362 typename... Ts>
363 static EventId ScheduleDestroy(FUNC f, Ts&&... args);
364
365 /**
366 * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
367 * All events scheduled to expire at "Destroy" time are scheduled FIFO,
368 * after all normal events have expired and only when
369 * Simulator::Destroy is invoked.
370 *
371 * @tparam Us @deduced Formal function argument types.
372 * @tparam Ts @deduced Actual function argument types.
373 * @param [in] f The function to invoke.
374 * @param [in] args Arguments to pass to MakeEvent.
375 * @return The EventId of the scheduled event.
376 */
377 template <typename... Us, typename... Ts>
378 static EventId ScheduleDestroy(void (*f)(Us...), Ts&&... args);
379
380 /** @} */ // Schedule events to run when Simulator:Destroy() is called.
381
382 /**
383 * Remove an event from the event list.
384 *
385 * This method has the same visible effect as the
386 * ns3::EventId::Cancel method
387 * but its algorithmic complexity is much higher: it has often
388 * O(log(n)) complexity, sometimes O(n), sometimes worse.
389 * Note that it is not possible to remove events which were scheduled
390 * for the "destroy" time. Doing so will result in a program error (crash).
391 *
392 * @param [in] id The event to remove from the list of scheduled events.
393 */
394 static void Remove(const EventId& id);
395
396 /**
397 * Set the cancel bit on this event: the event's associated function
398 * will not be invoked when it expires.
399 *
400 * This method has the same visible effect as the
401 * ns3::Simulator::Remove method but its algorithmic complexity is
402 * much lower: it has O(1) complexity.
403 * This method has the exact same semantics as ns3::EventId::Cancel.
404 * Note that it is not possible to cancel events which were scheduled
405 * for the "destroy" time. Doing so will result in a program error (crash).
406 *
407 * @param [in] id the event to cancel
408 */
409 static void Cancel(const EventId& id);
410
411 /**
412 * Check if an event has already run or been cancelled.
413 *
414 * This method has O(1) complexity.
415 * Note that it is not possible to test for the expiration of
416 * events which were scheduled for the "destroy" time. Doing so
417 * will result in a program error (crash).
418 * An event is said to "expire" when it starts being executed,
419 * which means that if the code executed by the event calls
420 * this function, it will get true.
421 *
422 * @param [in] id The event to test for expiration.
423 * @returns @c true if the event has expired, false otherwise.
424 */
425 static bool IsExpired(const EventId& id);
426
427 /**
428 * Return the current simulation virtual time.
429 *
430 * @returns The current virtual time.
431 */
432 static Time Now();
433
434 /**
435 * Get the remaining time until this event will execute.
436 *
437 * @param [in] id The event id to analyse.
438 * @return The delay left until the input event id expires.
439 * if the event is not running, this method returns
440 * zero.
441 */
442 static Time GetDelayLeft(const EventId& id);
443
444 /**
445 * Get the maximum representable simulation time.
446 *
447 * @return The maximum simulation time at which an event
448 * can be scheduled.
449 *
450 * The returned value will always be bigger than or equal to Simulator::Now.
451 */
453
454 /**
455 * Schedule a future event execution (in the same context).
456 *
457 * @param [in] delay Delay until the event expires.
458 * @param [in] event The event to schedule.
459 * @returns A unique identifier for the newly-scheduled event.
460 */
461 static EventId Schedule(const Time& delay, const Ptr<EventImpl>& event);
462
463 /**
464 * Schedule a future event execution (in a different context).
465 * This method is thread-safe: it can be called from any thread.
466 *
467 * @param [in] delay Delay until the event expires.
468 * @param [in] context Event context.
469 * @param [in] event The event to schedule.
470 */
471 static void ScheduleWithContext(uint32_t context, const Time& delay, EventImpl* event);
472
473 /**
474 * Schedule an event to run at the end of the simulation, after
475 * the Stop() time or condition has been reached.
476 *
477 * @param [in] event The event to schedule.
478 * @returns A unique identifier for the newly-scheduled event.
479 */
480 static EventId ScheduleDestroy(const Ptr<EventImpl>& event);
481
482 /**
483 * Schedule an event to run at the current virtual time.
484 *
485 * @param [in] event The event to schedule.
486 * @returns A unique identifier for the newly-scheduled event.
487 */
488 static EventId ScheduleNow(const Ptr<EventImpl>& event);
489
490 /**
491 * Get the system id of this simulator.
492 *
493 * The system id is the identifier for this simulator instance
494 * in a distributed simulation. For MPI this is the MPI rank.
495 * @return The system id for this simulator.
496 */
497 static uint32_t GetSystemId();
498
499 private:
500 /**
501 * Implementation of the various Schedule methods.
502 * @param [in] delay Delay until the event should execute.
503 * @param [in] event The event to execute.
504 * @return The EventId.
505 */
506 static EventId DoSchedule(const Time& delay, EventImpl* event);
507 /**
508 * Implementation of the various ScheduleNow methods.
509 * @param [in] event The event to execute.
510 * @return The EventId.
511 */
512 static EventId DoScheduleNow(EventImpl* event);
513 /**
514 * Implementation of the various ScheduleDestroy methods.
515 * @param [in] event The event to execute.
516 * @return The EventId.
517 */
518 static EventId DoScheduleDestroy(EventImpl* event);
519
520 /**
521 * Stop event (if present)
522 */
524
525}; // class Simulator
526
527/**
528 * @ingroup simulator
529 * @brief create an ns3::Time instance which contains the
530 * current simulation time.
531 *
532 * This is really a shortcut for the ns3::Simulator::Now method.
533 * It is typically used as shown below to schedule an event
534 * which expires at the absolute time "2 seconds":
535 * @code
536 * Simulator::Schedule (Seconds (2.0) - Now (), &my_function);
537 * @endcode
538 * @return The current simulation time.
539 */
540Time Now();
541
542} // namespace ns3
543
544/********************************************************************
545 * Implementation of the templates declared above.
546 ********************************************************************/
547
548namespace ns3
549{
550
551// Doxygen has trouble with static template functions in a class:
552// it treats the in-class declaration as different from the
553// out of class definition, so makes two entries in the member list. Ugh
554
555template <typename FUNC,
556 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
557 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
558 typename... Ts>
559EventId
560Simulator::Schedule(const Time& delay, FUNC f, Ts&&... args)
561{
562 return DoSchedule(delay, MakeEvent(f, std::forward<Ts>(args)...));
563}
564
565template <typename... Us, typename... Ts>
567Simulator::Schedule(const Time& delay, void (*f)(Us...), Ts&&... args)
568{
569 return DoSchedule(delay, MakeEvent(f, std::forward<Ts>(args)...));
570}
571
572template <typename FUNC,
573 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
574 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
575 typename... Ts>
576void
577Simulator::ScheduleWithContext(uint32_t context, const Time& delay, FUNC f, Ts&&... args)
578{
579 return ScheduleWithContext(context, delay, MakeEvent(f, std::forward<Ts>(args)...));
580}
581
582template <typename... Us, typename... Ts>
583void
584Simulator::ScheduleWithContext(uint32_t context, const Time& delay, void (*f)(Us...), Ts&&... args)
585{
586 return ScheduleWithContext(context, delay, MakeEvent(f, std::forward<Ts>(args)...));
587}
588
589template <typename FUNC,
590 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
591 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
592 typename... Ts>
594Simulator::ScheduleNow(FUNC f, Ts&&... args)
595{
596 return DoScheduleNow(MakeEvent(f, std::forward<Ts>(args)...));
597}
598
599template <typename... Us, typename... Ts>
601Simulator::ScheduleNow(void (*f)(Us...), Ts&&... args)
602{
603 return DoScheduleNow(MakeEvent(f, std::forward<Ts>(args)...));
604}
605
606template <typename FUNC,
607 std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
608 std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
609 typename... Ts>
611Simulator::ScheduleDestroy(FUNC f, Ts&&... args)
612{
613 return DoScheduleDestroy(MakeEvent(f, std::forward<Ts>(args)...));
614}
615
616template <typename... Us, typename... Ts>
618Simulator::ScheduleDestroy(void (*f)(Us...), Ts&&... args)
619{
620 return DoScheduleDestroy(MakeEvent(f, std::forward<Ts>(args)...));
621}
622
623} // namespace ns3
624
625#endif /* SIMULATOR_H */
An identifier for simulation events.
Definition event-id.h:45
A simulation event.
Definition event-impl.h:35
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Control the scheduling of simulation events.
Definition simulator.h:57
static EventId DoScheduleDestroy(EventImpl *event)
Implementation of the various ScheduleDestroy methods.
Definition simulator.cc:258
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static Ptr< SimulatorImpl > GetImplementation()
Get the SimulatorImpl singleton.
Definition simulator.cc:362
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:274
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:577
static EventId m_stopEvent
Stop event (if present)
Definition simulator.h:523
static bool IsFinished()
Check if the simulation should finish.
Definition simulator.cc:160
static uint32_t GetSystemId()
Get the system id of this simulator.
Definition simulator.cc:319
@ NO_CONTEXT
Flag for events not associated with any particular context.
Definition simulator.h:199
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition simulator.cc:284
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:611
static void SetScheduler(ObjectFactory schedulerFactory)
Set the scheduler type with an ObjectFactory.
Definition simulator.cc:153
static EventId DoScheduleNow(EventImpl *event)
Implementation of the various ScheduleNow methods.
Definition simulator.cc:249
static uint64_t GetEventCount()
Get the number of events executed.
Definition simulator.cc:313
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:594
~Simulator()=delete
static EventId DoSchedule(const Time &delay, EventImpl *event)
Implementation of the various Schedule methods.
Definition simulator.cc:240
static Time GetMaximumSimulationTime()
Get the maximum representable simulation time.
Definition simulator.cc:300
static void Remove(const EventId &id)
Remove an event from the event list.
Definition simulator.cc:264
static EventId GetStopEvent()
Returns the Stop Event, or an invalid event if the simulation does not have a scheduled stop time.
Definition simulator.cc:191
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
static void SetImplementation(Ptr< SimulatorImpl > impl)
Definition simulator.cc:334
static uint32_t GetContext()
Get the current simulation context.
Definition simulator.cc:307
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition simulator.cc:206
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
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:294
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.