A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
visual-simulator-impl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 Gustavo Carneiro
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Gustavo Carneiro <gjcarneiro@gmail.com>
7 */
8
9#ifndef VISUAL_SIMULATOR_IMPL_H
10#define VISUAL_SIMULATOR_IMPL_H
11
12#include "ns3/simulator-impl.h"
13
14namespace ns3
15{
16
17/**
18 * \defgroup visualizer Visualizer
19 *
20 */
21
22/**
23 * \ingroup visualizer
24 * \ingroup simulator
25 *
26 * \brief A replacement simulator that starts the visualizer
27 *
28 * To use this class, run any ns-3 simulation with the command-line
29 * argument --SimulatorImplementationType=ns3::VisualSimulatorImpl.
30 * This causes the visualizer (PyViz) to start automatically.
31 **/
33{
34 public:
35 /**
36 * \brief Get the type ID.
37 * \return the object TypeId
38 */
39 static TypeId GetTypeId();
40
42 ~VisualSimulatorImpl() override;
43
44 // Inherited
45 void Destroy() override;
46 bool IsFinished() const override;
47 void Stop() override;
48 EventId Stop(const Time& delay) override;
49 EventId Schedule(const Time& delay, EventImpl* event) override;
50 void ScheduleWithContext(uint32_t context, const Time& delay, EventImpl* event) override;
51 EventId ScheduleNow(EventImpl* event) override;
52 EventId ScheduleDestroy(EventImpl* event) override;
53 void Remove(const EventId& id) override;
54 void Cancel(const EventId& id) override;
55 bool IsExpired(const EventId& id) const override;
56 void Run() override;
57 Time Now() const override;
58 Time GetDelayLeft(const EventId& id) const override;
59 Time GetMaximumSimulationTime() const override;
60 void SetScheduler(ObjectFactory schedulerFactory) override;
61 uint32_t GetSystemId() const override;
62 uint32_t GetContext() const override;
63 uint64_t GetEventCount() const override;
64
65 /// calls Run() in the wrapped simulator
66 void RunRealSimulator();
67
68 protected:
69 void DoDispose() override;
70 void NotifyConstructionCompleted() override;
71
72 private:
73 Ptr<SimulatorImpl> m_simulator; ///< the simulator implementation
74 ObjectFactory m_simulatorImplFactory; ///< simulator implementation factory
75};
76
77} // namespace ns3
78
79#endif /* DEFAULT_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.
Smart pointer class similar to boost::intrusive_ptr.
The SimulatorImpl base class.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
A replacement simulator that starts the visualizer.
static TypeId GetTypeId()
Get the type ID.
EventId Schedule(const Time &delay, EventImpl *event) override
Schedule a future event execution (in the same context).
void Cancel(const EventId &id) override
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
void Remove(const EventId &id) override
Remove an event from the event list.
Time Now() const override
Return the current simulation virtual time.
Time GetDelayLeft(const EventId &id) const override
Get the remaining time until this event will execute.
uint32_t GetSystemId() const override
Get the system id of this simulator.
ObjectFactory m_simulatorImplFactory
simulator implementation factory
uint32_t GetContext() const override
Get the current simulation context.
Ptr< SimulatorImpl > m_simulator
the simulator implementation
Time GetMaximumSimulationTime() const override
Get the maximum representable simulation time.
EventId ScheduleDestroy(EventImpl *event) override
Schedule an event to run at the end of the simulation, after the Stop() time or condition has been re...
void DoDispose() override
Destructor implementation.
bool IsFinished() const override
Check if the simulation should finish.
uint64_t GetEventCount() const override
Get the number of events executed.
void Destroy() override
Execute the events scheduled with ScheduleDestroy().
bool IsExpired(const EventId &id) const override
Check if an event has already run or been cancelled.
void SetScheduler(ObjectFactory schedulerFactory) override
Set the Scheduler to be used to manage the event list.
void ScheduleWithContext(uint32_t context, const Time &delay, EventImpl *event) override
Schedule a future event execution (in a different context).
void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
void Run() override
Run the simulation.
void RunRealSimulator()
calls Run() in the wrapped simulator
EventId ScheduleNow(EventImpl *event) override
Schedule an event to run at the current virtual time.
void Stop() override
Tell the Simulator the calling event should be the last one executed.
Every class exported by the ns3 library is enclosed in the ns3 namespace.