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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Gustavo Carneiro <gjcarneiro@gmail.com>
18 */
19
20#ifndef VISUAL_SIMULATOR_IMPL_H
21#define VISUAL_SIMULATOR_IMPL_H
22
23#include "ns3/simulator-impl.h"
24
25namespace ns3
26{
27
28/**
29 * \defgroup visualizer Visualizer
30 *
31 */
32
33/**
34 * \ingroup visualizer
35 * \ingroup simulator
36 *
37 * \brief A replacement simulator that starts the visualizer
38 *
39 * To use this class, run any ns-3 simulation with the command-line
40 * argument --SimulatorImplementationType=ns3::VisualSimulatorImpl.
41 * This causes the visualizer (PyViz) to start automatically.
42 **/
44{
45 public:
46 /**
47 * \brief Get the type ID.
48 * \return the object TypeId
49 */
50 static TypeId GetTypeId();
51
53 ~VisualSimulatorImpl() override;
54
55 // Inherited
56 void Destroy() override;
57 bool IsFinished() const override;
58 void Stop() override;
59 EventId Stop(const Time& delay) override;
60 EventId Schedule(const Time& delay, EventImpl* event) override;
61 void ScheduleWithContext(uint32_t context, const Time& delay, EventImpl* event) override;
62 EventId ScheduleNow(EventImpl* event) override;
63 EventId ScheduleDestroy(EventImpl* event) override;
64 void Remove(const EventId& id) override;
65 void Cancel(const EventId& id) override;
66 bool IsExpired(const EventId& id) const override;
67 void Run() override;
68 Time Now() const override;
69 Time GetDelayLeft(const EventId& id) const override;
70 Time GetMaximumSimulationTime() const override;
71 void SetScheduler(ObjectFactory schedulerFactory) override;
72 uint32_t GetSystemId() const override;
73 uint32_t GetContext() const override;
74 uint64_t GetEventCount() const override;
75
76 /// calls Run() in the wrapped simulator
77 void RunRealSimulator();
78
79 protected:
80 void DoDispose() override;
81 void NotifyConstructionCompleted() override;
82
83 private:
84 Ptr<SimulatorImpl> m_simulator; ///< the simulator implementation
85 ObjectFactory m_simulatorImplFactory; ///< simulator implementation factory
86};
87
88} // namespace ns3
89
90#endif /* DEFAULT_SIMULATOR_IMPL_H */
An identifier for simulation events.
Definition: event-id.h:55
A simulation event.
Definition: event-impl.h:46
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
The SimulatorImpl base class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
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.