A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
simulator-impl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 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_IMPL_H
10#define SIMULATOR_IMPL_H
11
12#include "event-id.h"
13#include "event-impl.h"
14#include "nstime.h"
15#include "object-factory.h"
16#include "object.h"
17#include "ptr.h"
18
19/**
20 * \file
21 * \ingroup simulator
22 * ns3::SimulatorImpl declaration.
23 */
24
25namespace ns3
26{
27
28class Scheduler;
29
30/**
31 * \ingroup simulator
32 *
33 * The SimulatorImpl base class.
34 *
35 * \todo Define what the simulation or event context means.
36 */
37class SimulatorImpl : public Object
38{
39 public:
40 /**
41 * Get the registered TypeId for this class.
42 * \return The object TypeId.
43 */
44 static TypeId GetTypeId();
45
46 /** \copydoc Simulator::Destroy */
47 virtual void Destroy() = 0;
48 /** \copydoc Simulator::IsFinished */
49 virtual bool IsFinished() const = 0;
50 /** \copydoc Simulator::Stop() */
51 virtual void Stop() = 0;
52 /** \copydoc Simulator::Stop(const Time&) */
53 virtual EventId Stop(const Time& delay) = 0;
54 /** \copydoc Simulator::Schedule(const Time&,const Ptr<EventImpl>&) */
55 virtual EventId Schedule(const Time& delay, EventImpl* event) = 0;
56 /** \copydoc Simulator::ScheduleWithContext(uint32_t,const Time&,EventImpl*) */
57 virtual void ScheduleWithContext(uint32_t context, const Time& delay, EventImpl* event) = 0;
58 /** \copydoc Simulator::ScheduleNow(const Ptr<EventImpl>&) */
59 virtual EventId ScheduleNow(EventImpl* event) = 0;
60 /** \copydoc Simulator::ScheduleDestroy(const Ptr<EventImpl>&) */
61 virtual EventId ScheduleDestroy(EventImpl* event) = 0;
62 /** \copydoc Simulator::Remove */
63 virtual void Remove(const EventId& id) = 0;
64 /** \copydoc Simulator::Cancel */
65 virtual void Cancel(const EventId& id) = 0;
66 /** \copydoc Simulator::IsExpired */
67 virtual bool IsExpired(const EventId& id) const = 0;
68 /** \copydoc Simulator::Run */
69 virtual void Run() = 0;
70 /** \copydoc Simulator::Now */
71 virtual Time Now() const = 0;
72 /** \copydoc Simulator::GetDelayLeft */
73 virtual Time GetDelayLeft(const EventId& id) const = 0;
74 /** \copydoc Simulator::GetMaximumSimulationTime */
75 virtual Time GetMaximumSimulationTime() const = 0;
76 /**
77 * Set the Scheduler to be used to manage the event list.
78 *
79 * \param [in] schedulerFactory A new event scheduler factory.
80 *
81 * The event scheduler can be set at any time: the events scheduled
82 * in the previous scheduler will be transferred to the new scheduler
83 * before we start to use it.
84 */
85 virtual void SetScheduler(ObjectFactory schedulerFactory) = 0;
86 /** \copydoc Simulator::GetSystemId */
87 virtual uint32_t GetSystemId() const = 0;
88 /** \copydoc Simulator::GetContext */
89 virtual uint32_t GetContext() const = 0;
90 /** \copydoc Simulator::GetEventCount */
91 virtual uint64_t GetEventCount() const = 0;
92
93 /**
94 * Hook called before processing each event.
95 *
96 * \param [in] id The event about to be processed.
97 */
98 virtual void PreEventHook(const EventId& id){};
99};
100
101} // namespace ns3
102
103#endif /* SIMULATOR_IMPL_H */
An identifier for simulation events.
Definition event-id.h:45
A simulation event.
Definition event-impl.h:35
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
Definition object.h:78
The SimulatorImpl base class.
virtual EventId ScheduleDestroy(EventImpl *event)=0
Schedule an event to run at the end of the simulation, after the Stop() time or condition has been re...
virtual Time GetDelayLeft(const EventId &id) const =0
Get the remaining time until this event will execute.
virtual void SetScheduler(ObjectFactory schedulerFactory)=0
Set the Scheduler to be used to manage the event list.
virtual uint32_t GetSystemId() const =0
Get the system id of this simulator.
virtual void Run()=0
Run the simulation.
virtual EventId Schedule(const Time &delay, EventImpl *event)=0
Schedule a future event execution (in the same context).
virtual void Destroy()=0
Execute the events scheduled with ScheduleDestroy().
virtual bool IsExpired(const EventId &id) const =0
Check if an event has already run or been cancelled.
virtual void Remove(const EventId &id)=0
Remove an event from the event list.
virtual Time GetMaximumSimulationTime() const =0
Get the maximum representable simulation time.
virtual void ScheduleWithContext(uint32_t context, const Time &delay, EventImpl *event)=0
Schedule a future event execution (in a different context).
virtual void PreEventHook(const EventId &id)
Hook called before processing each event.
virtual EventId ScheduleNow(EventImpl *event)=0
Schedule an event to run at the current virtual time.
virtual Time Now() const =0
Return the current simulation virtual time.
virtual bool IsFinished() const =0
Check if the simulation should finish.
virtual uint64_t GetEventCount() const =0
Get the number of events executed.
virtual void Cancel(const EventId &id)=0
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
virtual uint32_t GetContext() const =0
Get the current simulation context.
virtual EventId Stop(const Time &delay)=0
Schedule the time delay until the Simulator should stop.
virtual void Stop()=0
Tell the Simulator the calling event should be the last one executed.
static TypeId GetTypeId()
Get the registered TypeId for this class.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
ns3::EventId declarations.
ns3::EventImpl declarations.
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.
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
ns3::Ptr smart pointer declaration and implementation.