From 691ce0fdde990b0c94f7a64e71ba5bf0285299d8 Mon Sep 17 00:00:00 2001 From: "mathieu." Date: Wed, 10 Dec 2008 17:01:06 -0800 Subject: [PATCH] fix bug 230, rescan bindings --- bindings/python/ns3_module_core.py | 4 +-- bindings/python/ns3_module_simulator.py | 15 --------- bindings/python/ns3_module_stats.py | 29 ++++++++++++++++ src/simulator/default-simulator-impl.cc | 11 +------ src/simulator/default-simulator-impl.h | 2 -- src/simulator/realtime-simulator-impl.cc | 42 ------------------------ src/simulator/realtime-simulator-impl.h | 2 -- src/simulator/simulator-impl.h | 1 - src/simulator/simulator.cc | 2 +- 9 files changed, 33 insertions(+), 75 deletions(-) diff --git a/bindings/python/ns3_module_core.py b/bindings/python/ns3_module_core.py index 01760a016..86f397e24 100644 --- a/bindings/python/ns3_module_core.py +++ b/bindings/python/ns3_module_core.py @@ -1906,7 +1906,7 @@ def register_Ns3TracedValue__Unsigned_int_methods(root_module, cls): cls.add_method('ConnectWithoutContext', 'void', [param('ns3::CallbackBase const &', 'cb')]) - ## traced-value.h: void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::string path) [member function] + ## traced-value.h: void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] cls.add_method('Connect', 'void', [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) @@ -1914,7 +1914,7 @@ def register_Ns3TracedValue__Unsigned_int_methods(root_module, cls): cls.add_method('DisconnectWithoutContext', 'void', [param('ns3::CallbackBase const &', 'cb')]) - ## traced-value.h: void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::string path) [member function] + ## traced-value.h: void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] cls.add_method('Disconnect', 'void', [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) diff --git a/bindings/python/ns3_module_simulator.py b/bindings/python/ns3_module_simulator.py index 72d683694..47d80976d 100644 --- a/bindings/python/ns3_module_simulator.py +++ b/bindings/python/ns3_module_simulator.py @@ -764,11 +764,6 @@ def register_Ns3SimulatorImpl_methods(root_module, cls): '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 @@ def register_Ns3DefaultSimulatorImpl_methods(root_module, cls): '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 @@ def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls): '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', diff --git a/bindings/python/ns3_module_stats.py b/bindings/python/ns3_module_stats.py index 88fd9197b..6da736fe1 100644 --- a/bindings/python/ns3_module_stats.py +++ b/bindings/python/ns3_module_stats.py @@ -17,6 +17,8 @@ def register_types(module): 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 [class] @@ -72,6 +74,7 @@ def register_methods(root_module): 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 @@ def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls): 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')]) diff --git a/src/simulator/default-simulator-impl.cc b/src/simulator/default-simulator-impl.cc index d5afd743a..670413c71 100644 --- a/src/simulator/default-simulator-impl.cc +++ b/src/simulator/default-simulator-impl.cc @@ -49,7 +49,6 @@ DefaultSimulatorImpl::GetTypeId (void) 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 @@ void 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 @@ DefaultSimulatorImpl::Stop (void) 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. diff --git a/src/simulator/default-simulator-impl.h b/src/simulator/default-simulator-impl.h index 896977adb..3b31d4c75 100644 --- a/src/simulator/default-simulator-impl.h +++ b/src/simulator/default-simulator-impl.h @@ -45,7 +45,6 @@ public: 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 @@ private: typedef std::list DestroyEvents; DestroyEvents m_destroyEvents; - uint64_t m_stopAt; bool m_stop; Ptr m_events; uint32_t m_uid; diff --git a/src/simulator/realtime-simulator-impl.cc b/src/simulator/realtime-simulator-impl.cc index 1acec20b3..bd49d028d 100644 --- a/src/simulator/realtime-simulator-impl.cc +++ b/src/simulator/realtime-simulator-impl.cc @@ -68,7 +68,6 @@ RealtimeSimulatorImpl::RealtimeSimulatorImpl () 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 @@ RealtimeSimulatorImpl::Run (void) { 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 @@ RealtimeSimulatorImpl::Stop (void) 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. // diff --git a/src/simulator/realtime-simulator-impl.h b/src/simulator/realtime-simulator-impl.h index 48484c8a6..578901e6b 100644 --- a/src/simulator/realtime-simulator-impl.h +++ b/src/simulator/realtime-simulator-impl.h @@ -55,7 +55,6 @@ public: 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 @@ private: typedef std::list DestroyEvents; DestroyEvents m_destroyEvents; - uint64_t m_stopAt; bool m_stop; bool m_running; diff --git a/src/simulator/simulator-impl.h b/src/simulator/simulator-impl.h index c84d82f83..150b52387 100644 --- a/src/simulator/simulator-impl.h +++ b/src/simulator/simulator-impl.h @@ -38,7 +38,6 @@ public: 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; diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index 4e7fac31a..b399d806f 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -169,7 +169,7 @@ void Simulator::Stop (Time const &time) { NS_LOG_FUNCTION (time); - GetImpl ()->Stop (time); + Simulator::Schedule (time, &Simulator::Stop); } Time