src/simulator/simulator.cc
changeset 3801 dc1f5e534e56
parent 3796 75c6a3d424d9
child 3808 ace932ee6eef
equal deleted inserted replaced
3800:804beebf1ba5 3801:dc1f5e534e56
    17  *
    17  *
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    19  */
    19  */
    20 
    20 
    21 #include "simulator.h"
    21 #include "simulator.h"
       
    22 #include "realtime-simulator.h"
    22 #include "simulator-impl.h"
    23 #include "simulator-impl.h"
    23 #include "default-simulator-impl.h"
    24 #include "default-simulator-impl.h"
       
    25 #include "realtime-simulator-impl.h"
    24 #include "scheduler.h"
    26 #include "scheduler.h"
    25 #include "map-scheduler.h"
    27 #include "map-scheduler.h"
    26 #include "event-impl.h"
    28 #include "event-impl.h"
    27 
    29 
    28 #include "ns3/ptr.h"
    30 #include "ns3/ptr.h"
   284 
   286 
   285 void
   287 void
   286 Simulator::SetImplementation (Ptr<SimulatorImpl> impl)
   288 Simulator::SetImplementation (Ptr<SimulatorImpl> impl)
   287 {
   289 {
   288   NS_FATAL_ERROR ("TODO");
   290   NS_FATAL_ERROR ("TODO");
       
   291 }
       
   292 
       
   293 RealtimeSimulatorImpl *
       
   294 RealtimeSimulator::GetRealtimeImpl (void)
       
   295 {
       
   296   RealtimeSimulatorImpl *impl = dynamic_cast<RealtimeSimulatorImpl *>(Simulator::GetImpl ());
       
   297   NS_ASSERT_MSG (impl, 
       
   298                  "RealtimeSimulator::GetImpl (): Underlying simulator implementation not realtime");
       
   299   return impl;
       
   300 }
       
   301 
       
   302 Time
       
   303 RealtimeSimulator::RealtimeNow (void)
       
   304 {
       
   305   return GetRealtimeImpl ()->RealtimeNow ();
       
   306 }
       
   307 
       
   308 EventId
       
   309 RealtimeSimulator::ScheduleRealtime (Time const &time, const Ptr<EventImpl> &ev)
       
   310 {
       
   311   NS_LOG_FUNCTION (time << ev);
       
   312   return GetRealtimeImpl ()->ScheduleRealtime (time, ev);
       
   313 }
       
   314 
       
   315 EventId
       
   316 RealtimeSimulator::ScheduleRealtimeNow (const Ptr<EventImpl> &ev)
       
   317 {
       
   318   NS_LOG_FUNCTION (ev);
       
   319   return GetRealtimeImpl ()->ScheduleRealtimeNow (ev);
       
   320 }
       
   321 
       
   322 EventId
       
   323 RealtimeSimulator::ScheduleRealtime (Time const &time, void (*f) (void))
       
   324 {
       
   325   NS_LOG_FUNCTION (time << f);
       
   326   return ScheduleRealtime (time, Simulator::MakeEvent (f));
       
   327 }
       
   328 
       
   329 EventId
       
   330 RealtimeSimulator::ScheduleRealtimeNow (void (*f) (void))
       
   331 {
       
   332   NS_LOG_FUNCTION (f);
       
   333   return ScheduleRealtimeNow (Simulator::MakeEvent (f));
   289 }
   334 }
   290 
   335 
   291 
   336 
   292 } // namespace ns3
   337 } // namespace ns3
   293 
   338