add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
This commit is contained in:
1 parent
906a9748b5
commit
6b0e717a19
77 files changed
+403
-359
No files matched your search
@@ -30,7 +30,6 @@ Channel::Channel ()
|
||||
: m_name("Channel")
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
SetInterfaceId (Channel::iid);
|
||||
}
|
||||
|
||||
Channel::Channel (std::string name)
|
||||
@@ -38,7 +37,6 @@ Channel::Channel (std::string name)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
NS_LOG_PARAMS (this << name);
|
||||
SetInterfaceId (Channel::iid);
|
||||
}
|
||||
|
||||
Channel::~Channel ()
|
||||
|
||||
+1
-3
@@ -28,9 +28,7 @@ namespace ns3 {
|
||||
const InterfaceId Ipv4::iid = MakeInterfaceId ("Ipv4", Object::iid);
|
||||
|
||||
Ipv4::Ipv4 ()
|
||||
{
|
||||
SetInterfaceId (Ipv4::iid);
|
||||
}
|
||||
{}
|
||||
|
||||
Ipv4::~Ipv4 ()
|
||||
{}
|
||||
|
||||
@@ -47,7 +47,6 @@ NetDevice::NetDevice(Ptr<Node> node, const Address& addr) :
|
||||
m_isPointToPoint (false)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
SetInterfaceId (NetDevice::iid);
|
||||
m_node->AddDevice (this);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -106,9 +106,8 @@ Node::Node(uint32_t sid)
|
||||
void
|
||||
Node::Construct (void)
|
||||
{
|
||||
SetInterfaceId (Node::iid);
|
||||
m_id = NodeList::Add (this);
|
||||
Ptr<PacketSocketFactory> socketFactory = Create<PacketSocketFactory> ();
|
||||
Ptr<PacketSocketFactory> socketFactory = CreateObject<PacketSocketFactory> ();
|
||||
AddInterface (socketFactory);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,12 @@ const InterfaceId PacketSocketFactory::iid = MakeInterfaceId ("Packet",
|
||||
SocketFactory::iid);
|
||||
|
||||
PacketSocketFactory::PacketSocketFactory ()
|
||||
{
|
||||
SetInterfaceId (PacketSocketFactory::iid);
|
||||
}
|
||||
{}
|
||||
|
||||
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
|
||||
{
|
||||
Ptr<Node> node = QueryInterface<Node> (Node::iid);
|
||||
Ptr<PacketSocket> socket = Create<PacketSocket> (node);
|
||||
Ptr<PacketSocket> socket = CreateObject<PacketSocket> (node);
|
||||
return socket;
|
||||
}
|
||||
} // namespace ns3
|
||||
@@ -106,7 +106,6 @@ Queue::Queue() :
|
||||
m_nTotalDroppedPackets(0)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
SetInterfaceId (Queue::iid);
|
||||
}
|
||||
|
||||
Queue::~Queue()
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace ns3 {
|
||||
const InterfaceId SocketFactory::iid = MakeInterfaceId ("SocketFactory", Object::iid);
|
||||
|
||||
SocketFactory::SocketFactory ()
|
||||
{
|
||||
SetInterfaceId (SocketFactory::iid);
|
||||
}
|
||||
{}
|
||||
|
||||
} // namespace ns3
|
||||
+1
-3
@@ -25,8 +25,6 @@ namespace ns3 {
|
||||
const InterfaceId Udp::iid = MakeInterfaceId ("Udp", SocketFactory::iid);
|
||||
|
||||
Udp::Udp ()
|
||||
{
|
||||
SetInterfaceId (Udp::iid);
|
||||
}
|
||||
{}
|
||||
|
||||
} // namespace ns3
|
||||
Reference in new issue
Block a user