Change nix-vector to use SimpleRefCount instead of Object
This commit is contained in:
@@ -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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h: ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h: ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [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<ns3::NixVector> >'])
|
||||
## output-stream-wrapper.h: ns3::OutputStreamWrapper [class]
|
||||
module.add_class('OutputStreamWrapper', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
|
||||
## 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> 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',
|
||||
|
||||
@@ -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<ns3::Ipv6MulticastRoute> >'])
|
||||
register_Ns3SimpleRefCount__Ns3Ipv6Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv6Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv6Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv6Route> >'])
|
||||
register_Ns3SimpleRefCount__Ns3MeshWifiInterfaceMacPlugin_Ns3Empty_Ns3DefaultDeleter__lt__ns3MeshWifiInterfaceMacPlugin__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> >'])
|
||||
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
|
||||
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
|
||||
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
|
||||
register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >'])
|
||||
@@ -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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
## simple-ref-count.h: ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > 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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::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<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
|
||||
@@ -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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h: ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h: ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [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<ns3::NixVector> >'])
|
||||
## output-stream-wrapper.h: ns3::OutputStreamWrapper [class]
|
||||
module.add_class('OutputStreamWrapper', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
|
||||
## 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> 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',
|
||||
|
||||
@@ -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<ns3::Ipv6MulticastRoute> >'])
|
||||
register_Ns3SimpleRefCount__Ns3Ipv6Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv6Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv6Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv6Route> >'])
|
||||
register_Ns3SimpleRefCount__Ns3MeshWifiInterfaceMacPlugin_Ns3Empty_Ns3DefaultDeleter__lt__ns3MeshWifiInterfaceMacPlugin__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> >'])
|
||||
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
|
||||
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
|
||||
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
|
||||
register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >'])
|
||||
@@ -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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
## simple-ref-count.h: ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > 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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::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<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
|
||||
@@ -26,8 +26,6 @@ NS_LOG_COMPONENT_DEFINE ("NixVector");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (NixVector);
|
||||
|
||||
typedef std::vector<uint32_t> NixBits_t;
|
||||
|
||||
NixVector::NixVector ()
|
||||
@@ -46,15 +44,6 @@ NixVector::~NixVector ()
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
Ptr<NixVector>
|
||||
NixVector::Copy (void) const
|
||||
{
|
||||
// we need to invoke the copy constructor directly
|
||||
// rather than calling Create because the copy constructor
|
||||
// is private.
|
||||
return Ptr<NixVector> (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<Object> ()
|
||||
.AddConstructor<NixVector> ()
|
||||
;
|
||||
|
||||
return tid;
|
||||
}
|
||||
|
||||
std::ostream & operator << (std::ostream &os, const NixVector &nix)
|
||||
{
|
||||
nix.DumpNixVector (os);
|
||||
|
||||
@@ -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<NixVector>
|
||||
{
|
||||
public:
|
||||
NixVector ();
|
||||
NixVector (const NixVector &o);
|
||||
~NixVector ();
|
||||
Ptr<NixVector> 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
|
||||
|
||||
@@ -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<NixVector> nix = CreateObject<NixVector> ();
|
||||
Ptr<NixVector> nix = Create<NixVector> ();
|
||||
uint32_t nixDeserialized = nix->Deserialize (p, nixSize);
|
||||
if (!nixDeserialized)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <fstream>
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "pcap-file.h"
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ Ipv4NixVectorRouting::GetNixVector (Ptr<Node> source, Ipv4Address dest, Ptr<NetD
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
Ptr<NixVector> nixVector = CreateObject<NixVector> ();
|
||||
Ptr<NixVector> nixVector = Create<NixVector> ();
|
||||
|
||||
// not in cache, must build the nix vector
|
||||
// First, we have to figure out the nodes
|
||||
@@ -509,8 +509,8 @@ Ipv4NixVectorRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<
|
||||
|
||||
// create a new nix vector to be used,
|
||||
// we want to keep the cached version clean
|
||||
nixVectorForPacket = CreateObject<NixVector> ();
|
||||
nixVectorForPacket = nixVectorInCache->Copy();
|
||||
nixVectorForPacket = Create<NixVector> ();
|
||||
nixVectorForPacket = nixVectorInCache;
|
||||
|
||||
// Get the interface number that we go out of, by extracting
|
||||
// from the nix-vector
|
||||
|
||||
Reference in New Issue
Block a user