1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2005,2006 INRIA
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;
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.
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
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21 #ifndef DEFAULT_SIMULATOR_IMPL_H
22 #define DEFAULT_SIMULATOR_IMPL_H
24 #include "simulator-impl.h"
25 #include "scheduler.h"
26 #include "event-impl.h"
29 #include "ns3/assert.h"
36 class DefaultSimulatorImpl : public SimulatorImpl
39 static TypeId GetTypeId (void);
41 DefaultSimulatorImpl ();
42 ~DefaultSimulatorImpl ();
44 virtual void Destroy ();
45 virtual bool IsFinished (void) const;
46 virtual Time Next (void) const;
47 virtual void Stop (void);
48 virtual EventId Schedule (Time const &time, EventImpl *event);
49 virtual EventId ScheduleNow (EventImpl *event);
50 virtual EventId ScheduleDestroy (EventImpl *event);
51 virtual void Remove (const EventId &ev);
52 virtual void Cancel (const EventId &ev);
53 virtual bool IsExpired (const EventId &ev) const;
54 virtual void Run (void);
55 virtual void RunOneEvent (void);
56 virtual Time Now (void) const;
57 virtual Time GetDelayLeft (const EventId &id) const;
58 virtual Time GetMaximumSimulationTime (void) const;
59 virtual void SetScheduler (ObjectFactory schedulerFactory);
62 void ProcessOneEvent (void);
63 uint64_t NextTs (void) const;
65 typedef std::list<EventId> DestroyEvents;
66 DestroyEvents m_destroyEvents;
68 Ptr<Scheduler> m_events;
70 uint32_t m_currentUid;
72 // number of events that have been inserted but not yet scheduled,
73 // not counting the "destroy" events; this is used for validation
74 int m_unscheduledEvents;
79 #endif /* DEFAULT_SIMULATOR_IMPL_H */