fix bug 230, rescan bindings
authormathieu.lacage@sophia.inria.fr
Wed, 10 Dec 2008 17:01:06 -0800
changeset 4009 76cb8ed8fe98
parent 4008 b8feac108e89
child 4010 0aab87b46780
fix bug 230, rescan bindings
bindings/python/ns3_module_core.py
bindings/python/ns3_module_simulator.py
bindings/python/ns3_module_stats.py
src/simulator/default-simulator-impl.cc
src/simulator/default-simulator-impl.h
src/simulator/realtime-simulator-impl.cc
src/simulator/realtime-simulator-impl.h
src/simulator/simulator-impl.h
src/simulator/simulator.cc
--- a/bindings/python/ns3_module_core.py	Wed Dec 10 16:47:44 2008 -0800
+++ b/bindings/python/ns3_module_core.py	Wed Dec 10 17:01:06 2008 -0800
@@ -1906,7 +1906,7 @@
     cls.add_method('ConnectWithoutContext', 
                    'void', 
                    [param('ns3::CallbackBase const &', 'cb')])
-    ## traced-value.h: void ns3::TracedValue<unsigned int>::Connect(ns3::CallbackBase const & cb, std::string path) [member function]
+    ## traced-value.h: void ns3::TracedValue<unsigned int>::Connect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > path) [member function]
     cls.add_method('Connect', 
                    'void', 
                    [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
@@ -1914,7 +1914,7 @@
     cls.add_method('DisconnectWithoutContext', 
                    'void', 
                    [param('ns3::CallbackBase const &', 'cb')])
-    ## traced-value.h: void ns3::TracedValue<unsigned int>::Disconnect(ns3::CallbackBase const & cb, std::string path) [member function]
+    ## traced-value.h: void ns3::TracedValue<unsigned int>::Disconnect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > path) [member function]
     cls.add_method('Disconnect', 
                    'void', 
                    [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
--- a/bindings/python/ns3_module_simulator.py	Wed Dec 10 16:47:44 2008 -0800
+++ b/bindings/python/ns3_module_simulator.py	Wed Dec 10 17:01:06 2008 -0800
@@ -764,11 +764,6 @@
                    'void', 
                    [], 
                    is_pure_virtual=True, is_virtual=True)
-    ## simulator-impl.h: void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function]
-    cls.add_method('Stop', 
-                   'void', 
-                   [param('ns3::Time const &', 'time')], 
-                   is_pure_virtual=True, is_virtual=True)
     ## simulator-impl.h: ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
     cls.add_method('Schedule', 
                    'ns3::EventId', 
@@ -1101,11 +1096,6 @@
                    'void', 
                    [], 
                    is_virtual=True)
-    ## default-simulator-impl.h: void ns3::DefaultSimulatorImpl::Stop(ns3::Time const & time) [member function]
-    cls.add_method('Stop', 
-                   'void', 
-                   [param('ns3::Time const &', 'time')], 
-                   is_virtual=True)
     ## default-simulator-impl.h: ns3::EventId ns3::DefaultSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
     cls.add_method('Schedule', 
                    'ns3::EventId', 
@@ -1299,11 +1289,6 @@
                    'void', 
                    [], 
                    is_virtual=True)
-    ## realtime-simulator-impl.h: void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function]
-    cls.add_method('Stop', 
-                   'void', 
-                   [param('ns3::Time const &', 'time')], 
-                   is_virtual=True)
     ## realtime-simulator-impl.h: ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
     cls.add_method('Schedule', 
                    'ns3::EventId', 
--- a/bindings/python/ns3_module_stats.py	Wed Dec 10 16:47:44 2008 -0800
+++ b/bindings/python/ns3_module_stats.py	Wed Dec 10 17:01:06 2008 -0800
@@ -17,6 +17,8 @@
     module.add_class('OmnetDataOutput', parent=root_module['ns3::DataOutputInterface'])
     ## packet-data-calculators.h: ns3::PacketSizeMinMaxAvgTotalCalculator [class]
     module.add_class('PacketSizeMinMaxAvgTotalCalculator', parent=root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
+    ## sqlite-data-output.h: ns3::SqliteDataOutput [class]
+    module.add_class('SqliteDataOutput', parent=root_module['ns3::DataOutputInterface'])
     ## time-data-calculators.h: ns3::TimeMinMaxAvgTotalCalculator [class]
     module.add_class('TimeMinMaxAvgTotalCalculator', parent=root_module['ns3::DataCalculator'])
     ## basic-data-calculators.h: ns3::CounterCalculator<unsigned int> [class]
@@ -72,6 +74,7 @@
     register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
     register_Ns3OmnetDataOutput_methods(root_module, root_module['ns3::OmnetDataOutput'])
     register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, root_module['ns3::PacketSizeMinMaxAvgTotalCalculator'])
+    register_Ns3SqliteDataOutput_methods(root_module, root_module['ns3::SqliteDataOutput'])
     register_Ns3TimeMinMaxAvgTotalCalculator_methods(root_module, root_module['ns3::TimeMinMaxAvgTotalCalculator'])
     register_Ns3CounterCalculator__Unsigned_int_methods(root_module, root_module['ns3::CounterCalculator< unsigned int >'])
     register_Ns3PacketCounterCalculator_methods(root_module, root_module['ns3::PacketCounterCalculator'])
@@ -315,6 +318,32 @@
                    visibility='protected', is_virtual=True)
     return
 
+def register_Ns3SqliteDataOutput_methods(root_module, cls):
+    ## sqlite-data-output.h: ns3::SqliteDataOutput::SqliteDataOutput(ns3::SqliteDataOutput const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::SqliteDataOutput const &', 'arg0')])
+    ## sqlite-data-output.h: ns3::SqliteDataOutput::SqliteDataOutput() [constructor]
+    cls.add_constructor([])
+    ## sqlite-data-output.h: void ns3::SqliteDataOutput::Output(ns3::DataCollector & dc) [member function]
+    cls.add_method('Output', 
+                   'void', 
+                   [param('ns3::DataCollector &', 'dc')], 
+                   is_virtual=True)
+    ## sqlite-data-output.h: void ns3::SqliteDataOutput::SetDBFile(std::string const file) [member function]
+    cls.add_method('SetDBFile', 
+                   'void', 
+                   [param('std::string const', 'file')])
+    ## sqlite-data-output.h: std::string ns3::SqliteDataOutput::GetDBFile() const [member function]
+    cls.add_method('GetDBFile', 
+                   'std::string', 
+                   [], 
+                   is_const=True)
+    ## sqlite-data-output.h: void ns3::SqliteDataOutput::DoDispose() [member function]
+    cls.add_method('DoDispose', 
+                   'void', 
+                   [], 
+                   visibility='protected', is_virtual=True)
+    return
+
 def register_Ns3TimeMinMaxAvgTotalCalculator_methods(root_module, cls):
     ## time-data-calculators.h: ns3::TimeMinMaxAvgTotalCalculator::TimeMinMaxAvgTotalCalculator(ns3::TimeMinMaxAvgTotalCalculator const & arg0) [copy constructor]
     cls.add_constructor([param('ns3::TimeMinMaxAvgTotalCalculator const &', 'arg0')])
--- a/src/simulator/default-simulator-impl.cc	Wed Dec 10 16:47:44 2008 -0800
+++ b/src/simulator/default-simulator-impl.cc	Wed Dec 10 17:01:06 2008 -0800
@@ -49,7 +49,6 @@
 DefaultSimulatorImpl::DefaultSimulatorImpl ()
 {
   m_stop = false;
-  m_stopAt = 0;
   // uids are allocated from 4.
   // uid 0 is "invalid" events
   // uid 1 is "now" events
@@ -146,8 +145,7 @@
 DefaultSimulatorImpl::Run (void)
 {
 
-  while (!m_events->IsEmpty () && !m_stop && 
-         (m_stopAt == 0 || m_stopAt > NextTs ())) 
+  while (!m_events->IsEmpty () && !m_stop) 
     {
       ProcessOneEvent ();
     }
@@ -169,13 +167,6 @@
   m_stop = true;
 }
 
-void 
-DefaultSimulatorImpl::Stop (Time const &time)
-{
-  NS_ASSERT (time.IsPositive ());
-  Time absolute = Simulator::Now () + time;
-  m_stopAt = absolute.GetTimeStep ();
-}
 
 //
 // Schedule an event for a _relative_ time in the future.
--- a/src/simulator/default-simulator-impl.h	Wed Dec 10 16:47:44 2008 -0800
+++ b/src/simulator/default-simulator-impl.h	Wed Dec 10 17:01:06 2008 -0800
@@ -45,7 +45,6 @@
   virtual bool IsFinished (void) const;
   virtual Time Next (void) const;
   virtual void Stop (void);
-  virtual void Stop (Time const &time);
   virtual EventId Schedule (Time const &time, EventImpl *event);
   virtual EventId ScheduleNow (EventImpl *event);
   virtual EventId ScheduleDestroy (EventImpl *event);
@@ -66,7 +65,6 @@
 
   typedef std::list<EventId> DestroyEvents;
   DestroyEvents m_destroyEvents;
-  uint64_t m_stopAt;
   bool m_stop;
   Ptr<Scheduler> m_events;
   uint32_t m_uid;
--- a/src/simulator/realtime-simulator-impl.cc	Wed Dec 10 16:47:44 2008 -0800
+++ b/src/simulator/realtime-simulator-impl.cc	Wed Dec 10 17:01:06 2008 -0800
@@ -68,7 +68,6 @@
   NS_LOG_FUNCTION_NOARGS ();
 
   m_stop = false;
-  m_stopAt = 0;
   m_running = false;
   // uids are allocated from 4.
   // uid 0 is "invalid" events
@@ -441,16 +440,6 @@
           {
             done = true;
           }
-        //
-        // We also want to stop the simulator at some time even if there are events 
-        // that have been scheduled out in the future.  If we're in realtime mode, we 
-        // actually have time passing, so we must look at the realtime clock to see if 
-        // we're past the end time.
-        //
-        if (m_stopAt && m_stopAt <= m_synchronizer->GetCurrentRealtime ())
-          {
-            done = true;
-          }
       }
 
       if (done)
@@ -539,37 +528,6 @@
   m_stop = true;
 }
 
-static void Placeholder (void) {}
-
-//
-// Schedule a stop for a _relative_ time in the future.  If the simulation
-// hasn't started yet, this will effectively be an absolute time.
-//
-void 
-RealtimeSimulatorImpl::Stop (Time const &time)
-{
-  NS_LOG_FUNCTION (time);
-
-  Time tAbsolute = Simulator::Now () + time;
-  NS_ASSERT (tAbsolute.IsPositive ());
-  NS_ASSERT (tAbsolute >= TimeStep (m_currentTs));
-  m_stopAt = tAbsolute.GetTimeStep ();
-
-  //
-  // For the realtime case, we need a real event sitting out at the end of time
-  // to keep the simulator running (sleeping) while there are no other events 
-  // present.  If an "external" device in another thread decides to schedule an
-  // event, the sleeping synchronizer will be awakened and the new event will
-  // be run.
-  //
-  // The easiest thing to do is to call back up into the simulator to take 
-  // advantage of all of the nice event wrappers.  This will call back down into
-  // RealtimeSimulatorImpl::Schedule to do the work.  This path interprets the 
-  // time as relative, so pass the relative time.
-  //
-  Simulator::Schedule (time, &Placeholder);
-}
-
 //
 // Schedule an event for a _relative_ time in the future.
 //
--- a/src/simulator/realtime-simulator-impl.h	Wed Dec 10 16:47:44 2008 -0800
+++ b/src/simulator/realtime-simulator-impl.h	Wed Dec 10 17:01:06 2008 -0800
@@ -55,7 +55,6 @@
   virtual bool IsFinished (void) const;
   virtual Time Next (void) const;
   virtual void Stop (void);
-  virtual void Stop (Time const &time);
   virtual EventId Schedule (Time const &time, EventImpl *event);
   virtual EventId ScheduleNow (EventImpl *event);
   virtual EventId ScheduleDestroy (EventImpl *event);
@@ -89,7 +88,6 @@
 
   typedef std::list<EventId> DestroyEvents;
   DestroyEvents m_destroyEvents;
-  uint64_t m_stopAt;
   bool m_stop;
   bool m_running;
 
--- a/src/simulator/simulator-impl.h	Wed Dec 10 16:47:44 2008 -0800
+++ b/src/simulator/simulator-impl.h	Wed Dec 10 17:01:06 2008 -0800
@@ -38,7 +38,6 @@
   virtual bool IsFinished (void) const = 0;
   virtual Time Next (void) const = 0;
   virtual void Stop (void) = 0;
-  virtual void Stop (Time const &time) = 0;
   virtual EventId Schedule (Time const &time, EventImpl *event) = 0;
   virtual EventId ScheduleNow (EventImpl *event) = 0;
   virtual EventId ScheduleDestroy (EventImpl *event) = 0;
--- a/src/simulator/simulator.cc	Wed Dec 10 16:47:44 2008 -0800
+++ b/src/simulator/simulator.cc	Wed Dec 10 17:01:06 2008 -0800
@@ -169,7 +169,7 @@
 Simulator::Stop (Time const &time)
 {
   NS_LOG_FUNCTION (time);
-  GetImpl ()->Stop (time);
+  Simulator::Schedule (time, &Simulator::Stop);
 }
 
 Time