diff --git a/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py b/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py index 30d61ac1f..4d873f266 100644 --- a/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py +++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py @@ -67,6 +67,8 @@ def register_types(module): module.add_class('RandomPropagationDelayModel', parent=root_module['ns3::PropagationDelayModel']) ## propagation-loss-model.h: ns3::RandomPropagationLossModel [class] module.add_class('RandomPropagationLossModel', parent=root_module['ns3::PropagationLossModel']) + ## propagation-loss-model.h: ns3::RangePropagationLossModel [class] + module.add_class('RangePropagationLossModel', parent=root_module['ns3::PropagationLossModel']) ## simple-ref-count.h: ns3::SimpleRefCount > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h: ns3::SimpleRefCount > [class] @@ -270,6 +272,7 @@ def register_methods(root_module): register_Ns3PropagationLossModel_methods(root_module, root_module['ns3::PropagationLossModel']) register_Ns3RandomPropagationDelayModel_methods(root_module, root_module['ns3::RandomPropagationDelayModel']) register_Ns3RandomPropagationLossModel_methods(root_module, root_module['ns3::RandomPropagationLossModel']) + register_Ns3RangePropagationLossModel_methods(root_module, root_module['ns3::RangePropagationLossModel']) register_Ns3SpectrumConverter_methods(root_module, root_module['ns3::SpectrumConverter']) register_Ns3SpectrumModel_methods(root_module, root_module['ns3::SpectrumModel']) register_Ns3SpectrumPropagationLossModel_methods(root_module, root_module['ns3::SpectrumPropagationLossModel']) @@ -311,14 +314,14 @@ def register_Ns3BandInfo_methods(root_module, cls): return def register_Ns3Buffer_methods(root_module, cls): - ## buffer.h: ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] - cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h: ns3::Buffer::Buffer() [constructor] cls.add_constructor([]) ## buffer.h: ns3::Buffer::Buffer(uint32_t dataSize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize')]) ## buffer.h: ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) + ## buffer.h: ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] + cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h: bool ns3::Buffer::AddAtEnd(uint32_t end) [member function] cls.add_method('AddAtEnd', 'bool', @@ -1372,6 +1375,21 @@ def register_Ns3RandomPropagationLossModel_methods(root_module, cls): is_const=True, visibility='private', is_virtual=True) return +def register_Ns3RangePropagationLossModel_methods(root_module, cls): + ## propagation-loss-model.h: static ns3::TypeId ns3::RangePropagationLossModel::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## propagation-loss-model.h: ns3::RangePropagationLossModel::RangePropagationLossModel() [constructor] + cls.add_constructor([]) + ## propagation-loss-model.h: double ns3::RangePropagationLossModel::DoCalcRxPower(double txPowerDbm, ns3::Ptr a, ns3::Ptr b) const [member function] + cls.add_method('DoCalcRxPower', + 'double', + [param('double', 'txPowerDbm'), param('ns3::Ptr< ns3::MobilityModel >', 'a'), param('ns3::Ptr< ns3::MobilityModel >', 'b')], + is_const=True, visibility='private', is_virtual=True) + return + def register_Ns3SpectrumConverter_methods(root_module, cls): ## spectrum-converter.h: ns3::SpectrumConverter::SpectrumConverter(ns3::SpectrumConverter const & arg0) [copy constructor] cls.add_constructor([param('ns3::SpectrumConverter const &', 'arg0')]) @@ -2042,11 +2060,6 @@ def register_Ns3NixVector_methods(root_module, cls): cls.add_method('Deserialize', 'uint32_t', [param('uint32_t const *', 'buffer'), param('uint32_t', 'size')]) - ## nix-vector.h: void ns3::NixVector::DumpNixVector(std::ostream & os) const [member function] - cls.add_method('DumpNixVector', - 'void', - [param('std::ostream &', 'os')], - is_const=True) ## nix-vector.h: uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function] cls.add_method('ExtractNeighborIndex', 'uint32_t', diff --git a/bindings/python/apidefs/gcc-ILP32/ns3_module_mpi.py b/bindings/python/apidefs/gcc-ILP32/ns3_module_mpi.py index 9d4958526..a0810b242 100644 --- a/bindings/python/apidefs/gcc-ILP32/ns3_module_mpi.py +++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_mpi.py @@ -144,10 +144,10 @@ def register_Ns3MpiInterface_methods(root_module, cls): 'void', [], is_static=True) - ## mpi-interface.h: static void ns3::MpiInterface::Enable(int * arg0, char * * * arg1) [member function] + ## mpi-interface.h: static void ns3::MpiInterface::Enable(int * pargc, char * * * pargv) [member function] cls.add_method('Enable', 'void', - [param('int *', 'arg0'), param('char * * *', 'arg1')], + [param('int *', 'pargc'), param('char * * *', 'pargv')], is_static=True) ## mpi-interface.h: static uint32_t ns3::MpiInterface::GetRxCount() [member function] cls.add_method('GetRxCount', @@ -204,10 +204,10 @@ def register_Ns3SentBuffer_methods(root_module, cls): cls.add_method('GetRequest', 'MPI_Request *', []) - ## mpi-interface.h: void ns3::SentBuffer::SetBuffer(uint8_t * arg0) [member function] + ## mpi-interface.h: void ns3::SentBuffer::SetBuffer(uint8_t * buffer) [member function] cls.add_method('SetBuffer', 'void', - [param('uint8_t *', 'arg0')]) + [param('uint8_t *', 'buffer')]) return def register_Ns3DistributedSimulatorImpl_methods(root_module, cls): diff --git a/bindings/python/apidefs/gcc-LP64/ns3_module_common.py b/bindings/python/apidefs/gcc-LP64/ns3_module_common.py index 30d61ac1f..4d873f266 100644 --- a/bindings/python/apidefs/gcc-LP64/ns3_module_common.py +++ b/bindings/python/apidefs/gcc-LP64/ns3_module_common.py @@ -67,6 +67,8 @@ def register_types(module): module.add_class('RandomPropagationDelayModel', parent=root_module['ns3::PropagationDelayModel']) ## propagation-loss-model.h: ns3::RandomPropagationLossModel [class] module.add_class('RandomPropagationLossModel', parent=root_module['ns3::PropagationLossModel']) + ## propagation-loss-model.h: ns3::RangePropagationLossModel [class] + module.add_class('RangePropagationLossModel', parent=root_module['ns3::PropagationLossModel']) ## simple-ref-count.h: ns3::SimpleRefCount > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h: ns3::SimpleRefCount > [class] @@ -270,6 +272,7 @@ def register_methods(root_module): register_Ns3PropagationLossModel_methods(root_module, root_module['ns3::PropagationLossModel']) register_Ns3RandomPropagationDelayModel_methods(root_module, root_module['ns3::RandomPropagationDelayModel']) register_Ns3RandomPropagationLossModel_methods(root_module, root_module['ns3::RandomPropagationLossModel']) + register_Ns3RangePropagationLossModel_methods(root_module, root_module['ns3::RangePropagationLossModel']) register_Ns3SpectrumConverter_methods(root_module, root_module['ns3::SpectrumConverter']) register_Ns3SpectrumModel_methods(root_module, root_module['ns3::SpectrumModel']) register_Ns3SpectrumPropagationLossModel_methods(root_module, root_module['ns3::SpectrumPropagationLossModel']) @@ -311,14 +314,14 @@ def register_Ns3BandInfo_methods(root_module, cls): return def register_Ns3Buffer_methods(root_module, cls): - ## buffer.h: ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] - cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h: ns3::Buffer::Buffer() [constructor] cls.add_constructor([]) ## buffer.h: ns3::Buffer::Buffer(uint32_t dataSize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize')]) ## buffer.h: ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) + ## buffer.h: ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] + cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h: bool ns3::Buffer::AddAtEnd(uint32_t end) [member function] cls.add_method('AddAtEnd', 'bool', @@ -1372,6 +1375,21 @@ def register_Ns3RandomPropagationLossModel_methods(root_module, cls): is_const=True, visibility='private', is_virtual=True) return +def register_Ns3RangePropagationLossModel_methods(root_module, cls): + ## propagation-loss-model.h: static ns3::TypeId ns3::RangePropagationLossModel::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## propagation-loss-model.h: ns3::RangePropagationLossModel::RangePropagationLossModel() [constructor] + cls.add_constructor([]) + ## propagation-loss-model.h: double ns3::RangePropagationLossModel::DoCalcRxPower(double txPowerDbm, ns3::Ptr a, ns3::Ptr b) const [member function] + cls.add_method('DoCalcRxPower', + 'double', + [param('double', 'txPowerDbm'), param('ns3::Ptr< ns3::MobilityModel >', 'a'), param('ns3::Ptr< ns3::MobilityModel >', 'b')], + is_const=True, visibility='private', is_virtual=True) + return + def register_Ns3SpectrumConverter_methods(root_module, cls): ## spectrum-converter.h: ns3::SpectrumConverter::SpectrumConverter(ns3::SpectrumConverter const & arg0) [copy constructor] cls.add_constructor([param('ns3::SpectrumConverter const &', 'arg0')]) @@ -2042,11 +2060,6 @@ def register_Ns3NixVector_methods(root_module, cls): cls.add_method('Deserialize', 'uint32_t', [param('uint32_t const *', 'buffer'), param('uint32_t', 'size')]) - ## nix-vector.h: void ns3::NixVector::DumpNixVector(std::ostream & os) const [member function] - cls.add_method('DumpNixVector', - 'void', - [param('std::ostream &', 'os')], - is_const=True) ## nix-vector.h: uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function] cls.add_method('ExtractNeighborIndex', 'uint32_t', diff --git a/bindings/python/apidefs/gcc-LP64/ns3_module_mpi.py b/bindings/python/apidefs/gcc-LP64/ns3_module_mpi.py index 9d4958526..a0810b242 100644 --- a/bindings/python/apidefs/gcc-LP64/ns3_module_mpi.py +++ b/bindings/python/apidefs/gcc-LP64/ns3_module_mpi.py @@ -144,10 +144,10 @@ def register_Ns3MpiInterface_methods(root_module, cls): 'void', [], is_static=True) - ## mpi-interface.h: static void ns3::MpiInterface::Enable(int * arg0, char * * * arg1) [member function] + ## mpi-interface.h: static void ns3::MpiInterface::Enable(int * pargc, char * * * pargv) [member function] cls.add_method('Enable', 'void', - [param('int *', 'arg0'), param('char * * *', 'arg1')], + [param('int *', 'pargc'), param('char * * *', 'pargv')], is_static=True) ## mpi-interface.h: static uint32_t ns3::MpiInterface::GetRxCount() [member function] cls.add_method('GetRxCount', @@ -204,10 +204,10 @@ def register_Ns3SentBuffer_methods(root_module, cls): cls.add_method('GetRequest', 'MPI_Request *', []) - ## mpi-interface.h: void ns3::SentBuffer::SetBuffer(uint8_t * arg0) [member function] + ## mpi-interface.h: void ns3::SentBuffer::SetBuffer(uint8_t * buffer) [member function] cls.add_method('SetBuffer', 'void', - [param('uint8_t *', 'arg0')]) + [param('uint8_t *', 'buffer')]) return def register_Ns3DistributedSimulatorImpl_methods(root_module, cls): diff --git a/src/applications/onoff/onoff-application.h b/src/applications/onoff/onoff-application.h index e2cb9b193..c7e43ec33 100644 --- a/src/applications/onoff/onoff-application.h +++ b/src/applications/onoff/onoff-application.h @@ -93,7 +93,14 @@ public: virtual ~OnOffApplication(); - void SetMaxBytes(uint32_t maxBytes); + /** + * \param maxBytes the total number of bytes to send + * + * Set the total number of bytes to send. Once these bytes are sent, no packet + * is sent again, even in on state. The value zero means that there is no + * limit. + */ + void SetMaxBytes (uint32_t maxBytes); protected: virtual void DoDispose (void); @@ -114,9 +121,9 @@ private: // Event handlers - void StartSending(); - void StopSending(); - void SendPacket(); + void StartSending (); + void StopSending (); + void SendPacket (); Ptr m_socket; // Associated socket Address m_peer; // Peer address diff --git a/src/applications/packet-sink/packet-sink.h b/src/applications/packet-sink/packet-sink.h index 535ffc39f..26338692f 100644 --- a/src/applications/packet-sink/packet-sink.h +++ b/src/applications/packet-sink/packet-sink.h @@ -73,8 +73,10 @@ public: virtual ~PacketSink (); - // Return the total bytes received in this sink app - uint32_t GetTotalRx() const; + /** + * \return the total bytes received in this sink app + */ + uint32_t GetTotalRx () const; protected: virtual void DoDispose (void); diff --git a/src/applications/udp-client-server/seq-ts-header.h b/src/applications/udp-client-server/seq-ts-header.h index 09a27c3a4..f734f0f80 100644 --- a/src/applications/udp-client-server/seq-ts-header.h +++ b/src/applications/udp-client-server/seq-ts-header.h @@ -41,7 +41,13 @@ public: * \param seq the sequence number */ void SetSeq (uint32_t seq); + /** + * \return the sequence number + */ uint32_t GetSeq (void) const; + /** + * \return the time stamp + */ Time GetTs (void) const; static TypeId GetTypeId (void); diff --git a/src/applications/udp-echo/udp-echo-client.h b/src/applications/udp-echo/udp-echo-client.h index faabcd781..16a8d0145 100644 --- a/src/applications/udp-echo/udp-echo-client.h +++ b/src/applications/udp-echo/udp-echo-client.h @@ -45,6 +45,10 @@ public: virtual ~UdpEchoClient (); + /** + * \param ip destination ipv4 address + * \param port destination port + */ void SetRemote (Ipv4Address ip, uint16_t port); /** diff --git a/src/common/nix-vector.h b/src/common/nix-vector.h index fd41fefa7..041e79c10 100644 --- a/src/common/nix-vector.h +++ b/src/common/nix-vector.h @@ -65,8 +65,19 @@ class NixVector : public SimpleRefCount public: NixVector (); ~NixVector (); + /** + * \return a copy of this nix-vector + */ Ptr Copy (void) const; + /** + * \param o the NixVector to copy to a new NixVector + * using a constructor + */ NixVector (const NixVector &o); + /** + * \param o the NixVector to copy to a new NixVector using the + * equals operator + */ NixVector &operator = (const NixVector &o); /** * \param newBits the neighbor-index to be added to the vector @@ -136,15 +147,16 @@ class NixVector : public SimpleRefCount * AddNeighborIndex or ExtractNeighborIndex. */ uint32_t BitCount (uint32_t numberOfNeighbors) const; - /* for printing of nix-vector */ - void DumpNixVector (std::ostream &os) const; - /* for printing of nix-vector */ - friend std::ostream & operator <<( std::ostream &outs, const NixVector &nix); private: typedef std::vector NixBits_t; + /* for printing of nix-vector */ + void DumpNixVector (std::ostream &os) const; + /* for printing of nix-vector */ + friend std::ostream & operator <<( std::ostream &outs, const NixVector &nix); + /* the actual nix-vector */ NixBits_t m_nixVector; diff --git a/src/mpi/distributed-simulator-impl.h b/src/mpi/distributed-simulator-impl.h index 16b4522d9..90457953e 100644 --- a/src/mpi/distributed-simulator-impl.h +++ b/src/mpi/distributed-simulator-impl.h @@ -28,7 +28,9 @@ namespace ns3 { -// Structure used for all-reduce LBTS computation +/** + * \brief Structure used for all-reduce LBTS computation + */ class LbtsMessage { public: @@ -39,6 +41,12 @@ public: { } + /** + * \param rxc received count + * \param txc transmitted count + * \param id mpi rank + * \param t smallest time + */ LbtsMessage (uint32_t rxc, uint32_t txc, uint32_t id, const Time& t) : m_txCount (txc), m_rxCount (rxc), @@ -49,9 +57,21 @@ public: ~LbtsMessage (); + /** + * \return smallest time + */ Time GetSmallestTime (); + /** + * \return transmitted count + */ uint32_t GetTxCount (); + /** + * \return receieved count + */ uint32_t GetRxCount (); + /** + * \return id which corresponds to mpi rank + */ uint32_t GetMyId (); private: @@ -61,6 +81,9 @@ private: Time m_smallestTime; }; +/** + * \brief distributed simulator implementation using lookahead + */ class DistributedSimulatorImpl : public SimulatorImpl { public: @@ -69,6 +92,7 @@ public: DistributedSimulatorImpl (); ~DistributedSimulatorImpl (); + // virtual from SimulatorImpl virtual void Destroy (); virtual bool IsFinished (void) const; virtual Time Next (void) const; diff --git a/src/mpi/mpi-interface.h b/src/mpi/mpi-interface.h index c2173398e..c29126758 100644 --- a/src/mpi/mpi-interface.h +++ b/src/mpi/mpi-interface.h @@ -33,16 +33,32 @@ typedef struct ompi_request_t* MPI_Request; namespace ns3 { +/** + * maximum MPI message size for easy + * buffer creation + */ const uint32_t MAX_MPI_MSG_SIZE = 2000; -// Define a class for tracking the non-block sends + +/** + * Define a class for tracking the non-block sends + */ class SentBuffer { public: SentBuffer (); ~SentBuffer (); + /** + * \return pointer to sent buffer + */ uint8_t* GetBuffer (); - void SetBuffer (uint8_t*); + /** + * \param buffer pointer to sent buffer + */ + void SetBuffer (uint8_t* buffer); + /** + * \return MPI request + */ MPI_Request* GetRequest (); private: @@ -52,32 +68,82 @@ private: class Packet; +/** + * Interface between ns-3 and MPI + */ class MpiInterface { public: - static void Destroy (); - static uint32_t GetSystemId (); // Get the MPI Rank (system id) - static uint32_t GetSize (); // Get the MPI Size (number of systems) - static bool IsEnabled (); // True if using MPI - static void Enable (int*, char***); // Called by ns3 main program + /** + * Delete all buffers + */ + static void Destroy (); + /** + * \return MPI rank + */ + static uint32_t GetSystemId (); + /** + * \return MPI size (number of systems) + */ + static uint32_t GetSize (); + /** + * \return true if using MPI + */ + static bool IsEnabled (); + /** + * \param pargc number of command line arguments + * \param pargv command line arguments + * + * Sets up MPI interface + */ + static void Enable (int* pargc, char*** pargv); - // Serialize and send a packet to the specified node and net device - static void SendPacket (Ptr, const Time &, uint32_t, uint32_t); - static void ReceiveMessages (); // Check for received messages complete - static void TestSendComplete (); // Check for completed sends + /** + * \param p packet to send + * \param rxTime received time at destination node + * \param node destination node + * \param dev destination device + * + * Serialize and send a packet to the specified node and net device + */ + static void SendPacket (Ptr p, const Time &rxTime, uint32_t node, uint32_t dev); + /** + * Check for received messages complete + */ + static void ReceiveMessages (); + /** + * Check for completed sends + */ + static void TestSendComplete (); + /** + * \return received count in packets + */ static uint32_t GetRxCount (); + /** + * \return transmitted count in packets + */ static uint32_t GetTxCount (); private: static uint32_t m_sid; static uint32_t m_size; - static uint32_t m_rxCount; // Total packets received - static uint32_t m_txCount; // Total packets sent + + // Total packets received + static uint32_t m_rxCount; + + // Total packets sent + static uint32_t m_txCount; static bool m_initialized; static bool m_enabled; - static MPI_Request* m_requests; // Pending non-blocking receives - static char** m_pRxBuffers; // Data buffers for non-blocking reads - static std::list m_pendingTx; // List of pending non-blocking sends + + // Pending non-blocking receives + static MPI_Request* m_requests; + + // Data buffers for non-blocking reads + static char** m_pRxBuffers; + + // List of pending non-blocking sends + static std::list m_pendingTx; }; } // namespace ns3 diff --git a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h b/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h index 34c04bc9c..8ff0a0bd2 100644 --- a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h +++ b/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h @@ -33,9 +33,18 @@ namespace ns3 { +/** + * Map of Ipv4Address to NixVector + */ typedef std::map > NixMap_t; +/** + * Map of Ipv4Address to Ipv4Route + */ typedef std::map > Ipv4RouteMap_t; +/** + * Nix-vector routing protocol + */ class Ipv4NixVectorRouting : public Ipv4RoutingProtocol { public: diff --git a/src/simulator/simulator-impl.h b/src/simulator/simulator-impl.h index 787769948..74f297aea 100644 --- a/src/simulator/simulator-impl.h +++ b/src/simulator/simulator-impl.h @@ -35,25 +35,163 @@ class Scheduler; class SimulatorImpl : public Object { public: + /** + * Every event scheduled by the Simulator::insertAtDestroy method is + * invoked. Then, we ensure that any memory allocated by the + * Simulator is freed. + * This method is typically invoked at the end of a simulation + * to avoid false-positive reports by a leak checker. + * After this method has been invoked, it is actually possible + * to restart a new simulation with a set of calls to Simulator::run + * and Simulator::insert_*. + */ virtual void Destroy () = 0; + /** + * If there are no more events lefts to be scheduled, or if simulation + * time has already reached the "stop time" (see Simulator::Stop()), + * return true. Return false otherwise. + */ virtual bool IsFinished (void) const = 0; + /** + * If Simulator::IsFinished returns true, the behavior of this + * method is undefined. Otherwise, it returns the microsecond-based + * time of the next event expected to be scheduled. + */ virtual Time Next (void) const = 0; + /** + * If an event invokes this method, it will be the last + * event scheduled by the Simulator::run method before + * returning to the caller. + */ virtual void Stop (void) = 0; + /** + * Force the Simulator::run method to return to the caller when the + * expiration time of the next event to be processed is greater than + * or equal to the stop time. The stop time is relative to the + * current simulation time. + * @param time the stop time, relative to the current time. + */ virtual void Stop (Time const &time) = 0; + /** + * \param time delay until the event expires + * \param event the event to schedule + * \returns a unique identifier for the newly-scheduled event. + * + * This method will be typically used by language bindings + * to delegate events to their own subclass of the EventImpl base class. + */ virtual EventId Schedule (Time const &time, EventImpl *event) = 0; + /** + * \param time delay until the event expires + * \param context event context + * \param event the event to schedule + * \returns a unique identifier for the newly-scheduled event. + * + * This method will be typically used by language bindings + * to delegate events to their own subclass of the EventImpl base class. + */ virtual void ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event) = 0; + /** + * \param event the event to schedule + * \returns a unique identifier for the newly-scheduled event. + * + * This method will be typically used by language bindings + * to delegate events to their own subclass of the EventImpl base class. + */ virtual EventId ScheduleNow (EventImpl *event) = 0; + /** + * \param event the event to schedule + * \returns a unique identifier for the newly-scheduled event. + * + * This method will be typically used by language bindings + * to delegate events to their own subclass of the EventImpl base class. + */ virtual EventId ScheduleDestroy (EventImpl *event) = 0; + /** + * Remove an event from the event list. + * This method has the same visible effect as the + * ns3::EventId::Cancel method + * but its algorithmic complexity is much higher: it has often + * O(log(n)) complexity, sometimes O(n), sometimes worse. + * Note that it is not possible to remove events which were scheduled + * for the "destroy" time. Doing so will result in a program error (crash). + * + * @param ev the event to remove from the list of scheduled events. + */ virtual void Remove (const EventId &ev) = 0; + /** + * Set the cancel bit on this event: the event's associated function + * will not be invoked when it expires. + * This method has the same visible effect as the + * ns3::Simulator::remove method but its algorithmic complexity is + * much lower: it has O(1) complexity. + * This method has the exact same semantics as ns3::EventId::cancel. + * Note that it is not possible to cancel events which were scheduled + * for the "destroy" time. Doing so will result in a program error (crash). + * + * @param ev the event to cancel + */ virtual void Cancel (const EventId &ev) = 0; + /** + * This method has O(1) complexity. + * Note that it is not possible to test for the expiration of + * events which were scheduled for the "destroy" time. Doing so + * will result in a program error (crash). + * An event is said to "expire" when it starts being scheduled + * which means that if the code executed by the event calls + * this function, it will get true. + * + * @param ev the event to test for expiration + * @returns true if the event has expired, false otherwise. + */ virtual bool IsExpired (const EventId &ev) const = 0; + /** + * Run the simulation until one of: + * - no events are present anymore + * - the user called Simulator::stop + * - the user called Simulator::stopAtUs and the + * expiration time of the next event to be processed + * is greater than or equal to the stop time. + */ virtual void Run (void) = 0; + /** + * Process only the next simulation event, then return immediately. + */ virtual void RunOneEvent (void) = 0; + /** + * Return the "current simulation time". + */ virtual Time Now (void) const = 0; + /** + * \param id the event id to analyse + * \return the delay left until the input event id expires. + * if the event is not running, this method returns + * zero. + */ virtual Time GetDelayLeft (const EventId &id) const = 0; + /** + * \return the maximum simulation time at which an event + * can be scheduled. + * + * The returned value will always be bigger than or equal to Simulator::Now. + */ virtual Time GetMaximumSimulationTime (void) const = 0; + /** + * \param schedulerFactory a new event scheduler factory + * + * The event scheduler can be set at any time: the events scheduled + * in the previous scheduler will be transfered to the new scheduler + * before we start to use it. + */ virtual void SetScheduler (ObjectFactory schedulerFactory) = 0; + /** + * \return the system id for this simulator; used for + * MPI or other distributed simulations + */ virtual uint32_t GetSystemId () const = 0; + /** + * \return the current simulation context + */ virtual uint32_t GetContext (void) const = 0; };