diff --git a/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py b/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py index bca8685f2..8b1da8399 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']) + ## 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] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::OutputStreamWrapper', '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] @@ -120,7 +122,7 @@ def register_types(module): ## propagation-loss-model.h: ns3::NakagamiPropagationLossModel [class] module.add_class('NakagamiPropagationLossModel', parent=root_module['ns3::PropagationLossModel']) ## nix-vector.h: ns3::NixVector [class] - module.add_class('NixVector', parent=root_module['ns3::Object']) + module.add_class('NixVector', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter >']) ## output-stream-wrapper.h: ns3::OutputStreamWrapper [class] module.add_class('OutputStreamWrapper', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter >']) ## packet.h: ns3::Packet [class] @@ -2031,11 +2033,6 @@ def register_Ns3NixVector_methods(root_module, cls): 'uint32_t', [param('uint32_t', 'numberOfNeighbors')], is_const=True) - ## nix-vector.h: ns3::Ptr ns3::NixVector::Copy() const [member function] - cls.add_method('Copy', - 'ns3::Ptr< ns3::NixVector >', - [], - is_const=True) ## nix-vector.h: uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', @@ -2058,11 +2055,6 @@ def register_Ns3NixVector_methods(root_module, cls): 'uint32_t', [], is_const=True) - ## nix-vector.h: static ns3::TypeId ns3::NixVector::GetTypeId() [member function] - cls.add_method('GetTypeId', - 'ns3::TypeId', - [], - is_static=True) ## nix-vector.h: uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', diff --git a/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py b/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py index 43ac0aab7..06cd2479d 100644 --- a/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py +++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py @@ -399,6 +399,7 @@ def register_methods(root_module): register_Ns3SimpleRefCount__Ns3Ipv6MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv6MulticastRoute__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv6MulticastRoute, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3Ipv6Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv6Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv6Route, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3MeshWifiInterfaceMacPlugin_Ns3Empty_Ns3DefaultDeleter__lt__ns3MeshWifiInterfaceMacPlugin__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter >']) @@ -1973,6 +1974,18 @@ def register_Ns3SimpleRefCount__Ns3MeshWifiInterfaceMacPlugin_Ns3Empty_Ns3Defaul is_static=True) return +def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): + ## simple-ref-count.h: ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h: ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) + ## simple-ref-count.h: static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls): ## simple-ref-count.h: ns3::SimpleRefCount >::SimpleRefCount() [constructor] cls.add_constructor([]) diff --git a/bindings/python/apidefs/gcc-LP64/ns3_module_common.py b/bindings/python/apidefs/gcc-LP64/ns3_module_common.py index bca8685f2..8b1da8399 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']) + ## 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] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::OutputStreamWrapper', '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] @@ -120,7 +122,7 @@ def register_types(module): ## propagation-loss-model.h: ns3::NakagamiPropagationLossModel [class] module.add_class('NakagamiPropagationLossModel', parent=root_module['ns3::PropagationLossModel']) ## nix-vector.h: ns3::NixVector [class] - module.add_class('NixVector', parent=root_module['ns3::Object']) + module.add_class('NixVector', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter >']) ## output-stream-wrapper.h: ns3::OutputStreamWrapper [class] module.add_class('OutputStreamWrapper', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter >']) ## packet.h: ns3::Packet [class] @@ -2031,11 +2033,6 @@ def register_Ns3NixVector_methods(root_module, cls): 'uint32_t', [param('uint32_t', 'numberOfNeighbors')], is_const=True) - ## nix-vector.h: ns3::Ptr ns3::NixVector::Copy() const [member function] - cls.add_method('Copy', - 'ns3::Ptr< ns3::NixVector >', - [], - is_const=True) ## nix-vector.h: uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', @@ -2058,11 +2055,6 @@ def register_Ns3NixVector_methods(root_module, cls): 'uint32_t', [], is_const=True) - ## nix-vector.h: static ns3::TypeId ns3::NixVector::GetTypeId() [member function] - cls.add_method('GetTypeId', - 'ns3::TypeId', - [], - is_static=True) ## nix-vector.h: uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', diff --git a/bindings/python/apidefs/gcc-LP64/ns3_module_core.py b/bindings/python/apidefs/gcc-LP64/ns3_module_core.py index b72dac75f..42b1415f8 100644 --- a/bindings/python/apidefs/gcc-LP64/ns3_module_core.py +++ b/bindings/python/apidefs/gcc-LP64/ns3_module_core.py @@ -399,6 +399,7 @@ def register_methods(root_module): register_Ns3SimpleRefCount__Ns3Ipv6MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv6MulticastRoute__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv6MulticastRoute, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3Ipv6Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv6Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv6Route, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3MeshWifiInterfaceMacPlugin_Ns3Empty_Ns3DefaultDeleter__lt__ns3MeshWifiInterfaceMacPlugin__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter >']) register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter >']) @@ -1973,6 +1974,18 @@ def register_Ns3SimpleRefCount__Ns3MeshWifiInterfaceMacPlugin_Ns3Empty_Ns3Defaul is_static=True) return +def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): + ## simple-ref-count.h: ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h: ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) + ## simple-ref-count.h: static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls): ## simple-ref-count.h: ns3::SimpleRefCount >::SimpleRefCount() [constructor] cls.add_constructor([]) diff --git a/src/common/nix-vector.cc b/src/common/nix-vector.cc index 8d6415171..4cac8976b 100644 --- a/src/common/nix-vector.cc +++ b/src/common/nix-vector.cc @@ -26,8 +26,6 @@ NS_LOG_COMPONENT_DEFINE ("NixVector"); namespace ns3 { -NS_OBJECT_ENSURE_REGISTERED (NixVector); - typedef std::vector NixBits_t; NixVector::NixVector () @@ -46,15 +44,6 @@ NixVector::~NixVector () NS_LOG_FUNCTION_NOARGS (); } -Ptr -NixVector::Copy (void) const -{ - // we need to invoke the copy constructor directly - // rather than calling Create because the copy constructor - // is private. - return Ptr (new NixVector (*this), false); -} - NixVector::NixVector (const NixVector &o) : m_nixVector (o.m_nixVector), m_used (o.m_used), @@ -76,17 +65,6 @@ NixVector::operator = (const NixVector &o) return *this; } -TypeId -NixVector::GetTypeId(void) -{ - static TypeId tid = TypeId ("ns3::NixVector") - .SetParent () - .AddConstructor () - ; - - return tid; -} - std::ostream & operator << (std::ostream &os, const NixVector &nix) { nix.DumpNixVector (os); diff --git a/src/common/nix-vector.h b/src/common/nix-vector.h index 7f275ebfb..bdea091e8 100644 --- a/src/common/nix-vector.h +++ b/src/common/nix-vector.h @@ -21,7 +21,7 @@ #ifndef __NIX_VECTOR_H__ #define __NIX_VECTOR_H__ -#include "ns3/object.h" +#include "ns3/simple-ref-count.h" #include "ns3/buffer.h" namespace ns3 { @@ -59,15 +59,13 @@ namespace ns3 { * routed. */ -class NixVector : public Object +class NixVector : public SimpleRefCount { public: NixVector (); - NixVector (const NixVector &o); ~NixVector (); - Ptr Copy (void) const; + NixVector (const NixVector &o); NixVector &operator = (const NixVector &o); - static TypeId GetTypeId (void); /** * \param newBits the neighbor-index to be added to the vector * \param numberOfBits the number of bits that newBits contains diff --git a/src/common/packet.cc b/src/common/packet.cc index 3f4fbab86..b506f3e88 100644 --- a/src/common/packet.cc +++ b/src/common/packet.cc @@ -148,7 +148,7 @@ Packet::Packet (const Packet &o) m_packetTagList (o.m_packetTagList), m_metadata (o.m_metadata) { - o.m_nixVector ? m_nixVector = o.m_nixVector->Copy () + o.m_nixVector ? m_nixVector = o.m_nixVector : m_nixVector = 0; } @@ -163,7 +163,7 @@ Packet::operator = (const Packet &o) m_byteTagList = o.m_byteTagList; m_packetTagList = o.m_packetTagList; m_metadata = o.m_metadata; - o.m_nixVector ? m_nixVector = o.m_nixVector->Copy () + o.m_nixVector ? m_nixVector = o.m_nixVector : m_nixVector = 0; return *this; } @@ -739,7 +739,7 @@ Packet::Deserialize (const uint8_t* buffer, uint32_t size) if (nixSize > 4) { - Ptr nix = CreateObject (); + Ptr nix = Create (); uint32_t nixDeserialized = nix->Deserialize (p, nixSize); if (!nixDeserialized) { diff --git a/src/common/pcap-file-wrapper.h b/src/common/pcap-file-wrapper.h index 80cd8c2dc..e024c006d 100644 --- a/src/common/pcap-file-wrapper.h +++ b/src/common/pcap-file-wrapper.h @@ -24,6 +24,7 @@ #include #include "ns3/ptr.h" #include "ns3/packet.h" +#include "ns3/object.h" #include "ns3/nstime.h" #include "pcap-file.h" diff --git a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc b/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc index aa0c6936d..698c92d81 100644 --- a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc +++ b/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc @@ -121,7 +121,7 @@ Ipv4NixVectorRouting::GetNixVector (Ptr source, Ipv4Address dest, Ptr nixVector = CreateObject (); + Ptr nixVector = Create (); // not in cache, must build the nix vector // First, we have to figure out the nodes @@ -509,8 +509,8 @@ Ipv4NixVectorRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr< // create a new nix vector to be used, // we want to keep the cached version clean - nixVectorForPacket = CreateObject (); - nixVectorForPacket = nixVectorInCache->Copy(); + nixVectorForPacket = Create (); + nixVectorForPacket = nixVectorInCache; // Get the interface number that we go out of, by extracting // from the nix-vector