A Discrete-Event Network Simulator
API
simulator-impl.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef SIMULATOR_IMPL_H
22 #define SIMULATOR_IMPL_H
23 
24 #include "event-impl.h"
25 #include "event-id.h"
26 #include "nstime.h"
27 #include "object.h"
28 #include "object-factory.h"
29 #include "ptr.h"
30 
37 namespace ns3 {
38 
39 class Scheduler;
40 
48 class SimulatorImpl : public Object
49 {
50 public:
51 
56  static TypeId GetTypeId (void);
57 
59  virtual void Destroy () = 0;
61  virtual bool IsFinished (void) const = 0;
63  virtual void Stop (void) = 0;
65  virtual void Stop (const Time &delay) = 0;
67  virtual EventId Schedule (const Time &delay, EventImpl *event) = 0;
69  virtual void ScheduleWithContext (uint32_t context, const Time &delay, EventImpl *event) = 0;
71  virtual EventId ScheduleNow (EventImpl *event) = 0;
73  virtual EventId ScheduleDestroy (EventImpl *event) = 0;
75  virtual void Remove (const EventId &id) = 0;
77  virtual void Cancel (const EventId &id) = 0;
79  virtual bool IsExpired (const EventId &id) const = 0;
81  virtual void Run (void) = 0;
83  virtual Time Now (void) const = 0;
85  virtual Time GetDelayLeft (const EventId &id) const = 0;
87  virtual Time GetMaximumSimulationTime (void) const = 0;
97  virtual void SetScheduler (ObjectFactory schedulerFactory) = 0;
99  virtual uint32_t GetSystemId () const = 0;
101  virtual uint32_t GetContext (void) const = 0;
103  virtual uint64_t GetEventCount (void) const = 0;
104 
105 };
106 
107 } // namespace ns3
108 
109 #endif /* SIMULATOR_IMPL_H */
virtual uint64_t GetEventCount(void) const =0
Get the number of events executed.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
static TypeId GetTypeId(void)
Get the registered TypeId for this class.
ns3::EventImpl declarations.
virtual bool IsExpired(const EventId &id) const =0
Check if an event has already run or been cancelled.
ns3::Ptr smart pointer declaration and implementation.
virtual Time Now(void) const =0
Return the current simulation virtual time.
ns3::ObjectFactory class declaration.
virtual EventId ScheduleNow(EventImpl *event)=0
Schedule an event to run at the current virtual time.
virtual void ScheduleWithContext(uint32_t context, const Time &delay, EventImpl *event)=0
Schedule a future event execution (in a different context).
virtual void SetScheduler(ObjectFactory schedulerFactory)=0
Set the Scheduler to be used to manage the event list.
virtual void Cancel(const EventId &id)=0
Set the cancel bit on this event: the event&#39;s associated function will not be invoked when it expires...
virtual void Run(void)=0
Run the simulation.
virtual Time GetMaximumSimulationTime(void) const =0
Get the maximum representable simulation time.
virtual bool IsFinished(void) const =0
Check if the simulation should finish.
virtual void Remove(const EventId &id)=0
Remove an event from the event list.
virtual Time GetDelayLeft(const EventId &id) const =0
Get the remaining time until this event will execute.
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes...
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...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
Instantiate subclasses of ns3::Object.
A simulation event.
Definition: event-impl.h:44
virtual EventId Schedule(const Time &delay, EventImpl *event)=0
Schedule a future event execution (in the same context).
An identifier for simulation events.
Definition: event-id.h:53
virtual void Destroy()=0
Execute the events scheduled with ScheduleDestroy().
virtual void Stop(void)=0
Tell the Simulator the calling event should be the last one executed.
virtual uint32_t GetSystemId() const =0
Get the system id of this simulator.
A base class which provides memory management and object aggregation.
Definition: object.h:87
ns3::EventId declarations.
virtual uint32_t GetContext(void) const =0
Get the current simulation context.
a unique identifier for an interface.
Definition: type-id.h:58
The SimulatorImpl base class.