add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
--- a/examples/csma-broadcast.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/csma-broadcast.cc Wed Jan 02 09:09:24 2008 +0100
@@ -107,9 +107,9 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -154,7 +154,7 @@
// Create the OnOff application to send UDP datagrams of size
// 512 bytes (default) at a rate of 500 Kb/s (default) from n0
NS_LOG_INFO ("Create Applications.");
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("255.255.255.255", port),
"Udp",
@@ -165,7 +165,7 @@
ooff->Stop (Seconds(10.0));
// Create an optional packet sink to receive these packets
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n1,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
@@ -174,7 +174,7 @@
sink->Stop (Seconds (10.0));
// Create an optional packet sink to receive these packets
- sink = Create<PacketSink> (
+ sink = CreateObject<PacketSink> (
n2,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
--- a/examples/csma-multicast.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/csma-multicast.cc Wed Jan 02 09:09:24 2008 +0100
@@ -106,11 +106,11 @@
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
- Ptr<Node> n4 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
+ Ptr<Node> n4 = CreateObject<InternetNode> ();
NS_LOG_INFO ("Create channels.");
//
@@ -281,7 +281,7 @@
// Configure a multicast packet generator that generates a packet
// every few seconds
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress (multicastGroup, port),
"Udp",
@@ -298,7 +298,7 @@
// Create an optional packet sink to receive these packets
// If you enable logging on this (above) it will print a log statement
// for every packet received
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n4,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
--- a/examples/csma-one-subnet.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/csma-one-subnet.cc Wed Jan 02 09:09:24 2008 +0100
@@ -100,10 +100,10 @@
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
NS_LOG_INFO ("Create channels.");
//
@@ -165,7 +165,7 @@
//
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("10.1.1.2", port),
"Udp",
@@ -179,7 +179,7 @@
//
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
//
- ooff = Create<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
n3,
InetSocketAddress ("10.1.1.1", port),
"Udp",
--- a/examples/csma-packet-socket.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/csma-packet-socket.cc Wed Jan 02 09:09:24 2008 +0100
@@ -61,7 +61,7 @@
static Ptr<CsmaNetDevice>
CreateCsmaDevice (Ptr<Node> node, Ptr<CsmaChannel> channel)
{
- Ptr<CsmaNetDevice> device = Create<CsmaNetDevice> (node);
+ Ptr<CsmaNetDevice> device = CreateObject<CsmaNetDevice> (node);
device->Attach (channel);
Ptr<Queue> queue = Queue::CreateDefault ();
device->AddQueue (queue);
@@ -102,14 +102,14 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<Node> ();
- Ptr<Node> n1 = Create<Node> ();
- Ptr<Node> n2 = Create<Node> ();
- Ptr<Node> n3 = Create<Node> ();
+ Ptr<Node> n0 = CreateObject<Node> ();
+ Ptr<Node> n1 = CreateObject<Node> ();
+ Ptr<Node> n2 = CreateObject<Node> ();
+ Ptr<Node> n3 = CreateObject<Node> ();
// create the shared medium used by all csma devices.
NS_LOG_INFO ("Create channels.");
- Ptr<CsmaChannel> channel = Create<CsmaChannel> (DataRate(5000000), MilliSeconds(2));
+ Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> (DataRate(5000000), MilliSeconds(2));
// use a helper function to connect our nodes to the shared channel.
NS_LOG_INFO ("Build Topology.");
@@ -134,7 +134,7 @@
// 210 bytes at a rate of 448 Kb/s
// from n0 to n1
NS_LOG_INFO ("Create Applications.");
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
n0ToN1,
"Packet",
@@ -145,7 +145,7 @@
ooff->Stop (Seconds(10.0));
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
- ooff = Create<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
n3,
n3ToN0,
"Packet",
--- a/examples/mixed-global-routing.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/mixed-global-routing.cc Wed Jan 02 09:09:24 2008 +0100
@@ -120,13 +120,13 @@
CommandLine::Parse (argc, argv);
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
- Ptr<Node> n4 = Create<InternetNode> ();
- Ptr<Node> n5 = Create<InternetNode> ();
- Ptr<Node> n6 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
+ Ptr<Node> n4 = CreateObject<InternetNode> ();
+ Ptr<Node> n5 = CreateObject<InternetNode> ();
+ Ptr<Node> n6 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -191,7 +191,7 @@
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("10.1.3.2", port),
"Udp",
--- a/examples/simple-alternate-routing.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/simple-alternate-routing.cc Wed Jan 02 09:09:24 2008 +0100
@@ -128,10 +128,10 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -182,7 +182,7 @@
uint16_t port = 9; // Discard port (RFC 863)
// Create a flow from n3 to n1, starting at time 1.1 seconds
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n3,
InetSocketAddress ("10.1.1.1", port),
"Udp",
@@ -193,7 +193,7 @@
ooff->Stop (Seconds (10.0));
// Create a packet sink to receive these packets
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n1,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
--- a/examples/simple-error-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/simple-error-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -97,10 +97,10 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -143,7 +143,7 @@
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("10.1.3.2", port),
"Udp",
@@ -154,7 +154,7 @@
ooff->Stop (Seconds(10.0));
// Create an optional packet sink to receive these packets
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n3,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
@@ -163,7 +163,7 @@
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = Create<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
n3,
InetSocketAddress ("10.1.2.1", port),
"Udp",
@@ -174,7 +174,7 @@
ooff->Stop (Seconds(10.0));
// Create a packet sink to receive these packets
- sink = Create<PacketSink> (
+ sink = CreateObject<PacketSink> (
n1,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
@@ -222,7 +222,7 @@
sampleList.push_back (11);
sampleList.push_back (17);
// This time, we'll explicitly create the error model we want
- Ptr<ListErrorModel> pem = Create<ListErrorModel> ();
+ Ptr<ListErrorModel> pem = CreateObject<ListErrorModel> ();
pem->SetList (sampleList);
nd2->AddReceiveErrorModel (pem);
--- a/examples/simple-global-routing.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/simple-global-routing.cc Wed Jan 02 09:09:24 2008 +0100
@@ -122,10 +122,10 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -163,7 +163,7 @@
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("10.1.3.2", port),
"Udp",
@@ -175,7 +175,7 @@
// Create a packet sink to receive these packets
// The last argument "true" disables output from the Receive callback
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n3,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
@@ -184,7 +184,7 @@
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = Create<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
n3,
InetSocketAddress ("10.1.2.1", port),
"Udp",
@@ -195,7 +195,7 @@
ooff->Stop (Seconds (10.0));
// Create a packet sink to receive these packets
- sink = Create<PacketSink> (
+ sink = CreateObject<PacketSink> (
n1,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
--- a/examples/simple-point-to-point-olsr.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/simple-point-to-point-olsr.cc Wed Jan 02 09:09:24 2008 +0100
@@ -118,10 +118,10 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -162,7 +162,7 @@
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("10.1.3.2", port),
"Udp",
@@ -173,7 +173,7 @@
ooff->Stop (Seconds(10.0));
// Create an optional packet sink to receive these packets
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n3,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
@@ -182,7 +182,7 @@
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = Create<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
n3,
InetSocketAddress ("10.1.2.1", port),
"Udp",
@@ -193,7 +193,7 @@
ooff->Stop (Seconds(10.0));
// Create a packet sink to receive these packets
- sink = Create<PacketSink> (
+ sink = CreateObject<PacketSink> (
n1,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
--- a/examples/simple-point-to-point.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/simple-point-to-point.cc Wed Jan 02 09:09:24 2008 +0100
@@ -117,10 +117,10 @@
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
@@ -163,7 +163,7 @@
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
- Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
+ Ptr<OnOffApplication> ooff = CreateObject<OnOffApplication> (
n0,
InetSocketAddress ("10.1.3.2", port),
"Udp",
@@ -174,7 +174,7 @@
ooff->Stop (Seconds(10.0));
// Create an optional packet sink to receive these packets
- Ptr<PacketSink> sink = Create<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
n3,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
@@ -183,7 +183,7 @@
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = Create<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
n3,
InetSocketAddress ("10.1.2.1", port),
"Udp",
@@ -194,7 +194,7 @@
ooff->Stop (Seconds(10.0));
// Create a packet sink to receive these packets
- sink = Create<PacketSink> (
+ sink = CreateObject<PacketSink> (
n1,
InetSocketAddress (Ipv4Address::GetAny (), port),
"Udp");
--- a/examples/udp-echo.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/examples/udp-echo.cc Wed Jan 02 09:09:24 2008 +0100
@@ -100,10 +100,10 @@
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
NS_LOG_INFO ("Create channels.");
//
@@ -167,7 +167,7 @@
//
uint16_t port = 9; // well-known echo port number
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
//
// Create a UdpEchoClient application to send UDP datagrams from node zero to
// node one.
@@ -176,7 +176,7 @@
uint32_t maxPacketCount = 1;
Time interPacketInterval = Seconds (1.);
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", port,
maxPacketCount, interPacketInterval, packetSize);
//
// Tell the applications when to start and stop.
--- a/samples/main-adhoc-wifi.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-adhoc-wifi.cc Wed Jan 02 09:09:24 2008 +0100
@@ -45,10 +45,10 @@
CreateAdhocNode (Ptr<WifiChannel> channel,
Vector position, const char *address)
{
- Ptr<Node> node = Create<Node> ();
- Ptr<AdhocWifiNetDevice> device = Create<AdhocWifiNetDevice> (node, Mac48Address (address));
+ Ptr<Node> node = CreateObject<Node> ();
+ Ptr<AdhocWifiNetDevice> device = CreateObject<AdhocWifiNetDevice> (node, Mac48Address (address));
device->Attach (channel);
- Ptr<MobilityModel> mobility = Create<StaticMobilityModel> ();
+ Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> ();
mobility->SetPosition (position);
node->AddInterface (mobility);
@@ -108,7 +108,7 @@
{
g_bytesTotal = 0;
- Ptr<WifiChannel> channel = Create<WifiChannel> ();
+ Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
Ptr<Node> a = CreateAdhocNode (channel,
Vector (5.0,0.0,0.0),
@@ -121,7 +121,7 @@
destination.SetProtocol (1);
destination.SetSingleDevice (0);
destination.SetPhysicalAddress (Mac48Address ("00:00:00:00:00:02"));
- Ptr<Application> app = Create<OnOffApplication> (a, destination,
+ Ptr<Application> app = CreateObject<OnOffApplication> (a, destination,
"Packet",
ConstantVariable (250),
ConstantVariable (0),
--- a/samples/main-ap-wifi.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-ap-wifi.cc Wed Jan 02 09:09:24 2008 +0100
@@ -71,12 +71,12 @@
Ssid ssid,
Time at)
{
- Ptr<Node> node = Create<Node> ();
- Ptr<NqapWifiNetDevice> device = Create<NqapWifiNetDevice> (node, Mac48Address (macAddress));
+ Ptr<Node> node = CreateObject<Node> ();
+ Ptr<NqapWifiNetDevice> device = CreateObject<NqapWifiNetDevice> (node, Mac48Address (macAddress));
device->SetSsid (ssid);
Simulator::Schedule (at, &NqapWifiNetDevice::StartBeaconing, device);
device->Attach (channel);
- Ptr<MobilityModel> mobility = Create<StaticMobilityModel> ();
+ Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> ();
mobility->SetPosition (position);
node->AddInterface (mobility);
return node;
@@ -88,12 +88,12 @@
const char *macAddress,
Ssid ssid)
{
- Ptr<Node> node = Create<Node> ();
- Ptr<NqstaWifiNetDevice> device = Create<NqstaWifiNetDevice> (node, Mac48Address (macAddress));
+ Ptr<Node> node = CreateObject<Node> ();
+ Ptr<NqstaWifiNetDevice> device = CreateObject<NqstaWifiNetDevice> (node, Mac48Address (macAddress));
Simulator::ScheduleNow (&NqstaWifiNetDevice::StartActiveAssociation, device,
ssid);
device->Attach (channel);
- Ptr<MobilityModel> mobility = Create<StaticMobilityModel> ();
+ Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> ();
mobility->SetPosition (position);
node->AddInterface (mobility);
return node;
@@ -146,7 +146,7 @@
DefaultValue::Bind ("WifiRateControlAlgorithm", "Aarf");
//DefaultValue::Bind ("WifiRateControlAlgorithm", "Arf");
- Ptr<WifiChannel> channel = Create<WifiChannel> ();
+ Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
Ssid ssid = Ssid ("mathieu");
Ptr<Node> a = CreateApNode (channel,
@@ -170,7 +170,7 @@
destination.SetProtocol (1);
destination.SetSingleDevice (0);
destination.SetPhysicalAddress (Mac48Address ("00:00:00:00:00:03"));
- Ptr<Application> app = Create<OnOffApplication> (b, destination,
+ Ptr<Application> app = CreateObject<OnOffApplication> (b, destination,
"Packet",
ConstantVariable (42),
ConstantVariable (0));
--- a/samples/main-component-manager.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-component-manager.cc Wed Jan 02 09:09:24 2008 +0100
@@ -17,10 +17,7 @@
const ClassId AnObject::cid = MakeClassId<AnObject, int, double> ("AnObject", AnObject::iid);
AnObject::AnObject (int a, double b)
-{
- // enable our interface
- SetInterfaceId (AnObject::iid);
-}
+{}
void
AnObject::DoDispose (void)
{
--- a/samples/main-grid-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-grid-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -17,7 +17,7 @@
// create an array of empty nodes for testing purposes
for (uint32_t i = 0; i < 120; i++)
{
- nodes.push_back (Create<InternetNode> ());
+ nodes.push_back (CreateObject<InternetNode> ());
}
// setup the grid itself: objects are layed out
--- a/samples/main-object.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-object.cc Wed Jan 02 09:09:24 2008 +0100
@@ -14,10 +14,7 @@
const InterfaceId AnObject::iid = MakeInterfaceId ("AnObject", Object::iid);
AnObject::AnObject ()
-{
- // enable our interface
- SetInterfaceId (AnObject::iid);
-}
+{}
void
AnObject::DoDispose (void)
{
@@ -68,7 +65,7 @@
// enable our interface
SetInterfaceId (YetAnotherObject::iid);
// aggregated directly to another object.
- AddInterface (Create<AnObject> ());
+ AddInterface (CreateObject<AnObject> ());
}
void
YetAnotherObject::DoDispose (void)
@@ -87,7 +84,7 @@
Ptr<AnotherObject> anotherObject;
Ptr<YetAnotherObject> yetAnotherObject;
- p = Create<AnObject> ();
+ p = CreateObject<AnObject> ();
// p gives you access to AnObject's interface
anObject = p->QueryInterface<AnObject> (AnObject::iid);
NS_ASSERT (anObject != 0);
@@ -95,7 +92,7 @@
anotherObject = p->QueryInterface<AnotherObject> (AnotherObject::iid);
NS_ASSERT (anotherObject == 0);
- anotherObject = Create<AnotherObject> (1);
+ anotherObject = CreateObject<AnotherObject> (1);
// AnotherObject does not give you access to AnObject's interface
anObject = anotherObject->QueryInterface<AnObject> (AnObject::iid);
NS_ASSERT (anObject == 0);
@@ -110,7 +107,7 @@
NS_ASSERT (anotherObject != 0);
- yetAnotherObject = Create<YetAnotherObject> (2);
+ yetAnotherObject = CreateObject<YetAnotherObject> (2);
// gives you acess to AnObject interface too.
anObject = yetAnotherObject->QueryInterface<AnObject> (AnObject::iid);
NS_ASSERT (anObject != 0);
--- a/samples/main-propagation-loss.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-propagation-loss.cc Wed Jan 02 09:09:24 2008 +0100
@@ -26,8 +26,8 @@
static void
PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, double max, double step)
{
- Ptr<StaticMobilityModel> a = Create<StaticMobilityModel> ();
- Ptr<StaticMobilityModel> b = Create<StaticMobilityModel> ();
+ Ptr<StaticMobilityModel> a = CreateObject<StaticMobilityModel> ();
+ Ptr<StaticMobilityModel> b = CreateObject<StaticMobilityModel> ();
Ptr<PropagationLossModel> model = PropagationLossModel::CreateDefault ();
a->SetPosition (Vector (0.0, 0.0, 0.0));
--- a/samples/main-ptr.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-ptr.cc Wed Jan 02 09:09:24 2008 +0100
@@ -49,7 +49,7 @@
{
// Create a new object of type A, store it in global
// variable g_a
- Ptr<A> a = Create<A> ();
+ Ptr<A> a = CreateObject<A> ();
a->Method ();
Ptr<A> prev = StoreA (a);
NS_ASSERT (prev == 0);
@@ -58,7 +58,7 @@
{
// Create a new object of type A, store it in global
// variable g_a, get a hold on the previous A object.
- Ptr<A> a = Create<A> ();
+ Ptr<A> a = CreateObject<A> ();
Ptr<A> prev = StoreA (a);
// call method on object
prev->Method ();
--- a/samples/main-query-interface.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-query-interface.cc Wed Jan 02 09:09:24 2008 +0100
@@ -122,8 +122,6 @@
AnImplementation::AnImplementation (void)
{
NS_LOG_FUNCTION;
- // enable our interface
- SetInterfaceId (AnImplementation::iid);
}
void
@@ -233,7 +231,7 @@
AnExtendedImplementation::AnExtendedImplementation (void)
{
- pImpl = Create<AnImplementation> ();
+ pImpl = CreateObject<AnImplementation> ();
SetInterfaceId (AnExtendedImplementation::iid);
}
--- a/samples/main-random-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-random-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -38,7 +38,7 @@
std::vector<Ptr<Object> > objects;
for (uint32_t i = 0; i < 10000; i++)
{
- Ptr<MobilityModelNotifier> notifier = Create<MobilityModelNotifier> ();
+ Ptr<MobilityModelNotifier> notifier = CreateObject<MobilityModelNotifier> ();
notifier->TraceConnect ("/course-change", MakeCallback (&CourseChange));
objects.push_back (notifier);
}
--- a/samples/main-random-walk.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-random-walk.cc Wed Jan 02 09:09:24 2008 +0100
@@ -45,8 +45,8 @@
for (uint32_t i = 0; i < 100; i++)
{
- Ptr<Node> node = Create<Node> ();
- node->AddInterface (Create<MobilityModelNotifier> ());
+ Ptr<Node> node = CreateObject<Node> ();
+ node->AddInterface (CreateObject<MobilityModelNotifier> ());
}
topology.Layout (NodeList::Begin (), NodeList::End ());
--- a/samples/main-simple.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/samples/main-simple.cc Wed Jan 02 09:09:24 2008 +0100
@@ -40,7 +40,7 @@
void
RunSimulation (void)
{
- Ptr<Node> a = Create<InternetNode> ();
+ Ptr<Node> a = CreateObject<InternetNode> ();
InterfaceId iid = InterfaceId::LookupByName ("Udp");
Ptr<SocketFactory> socketFactory = a->QueryInterface<SocketFactory> (iid);
--- a/src/common/error-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/common/error-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -43,7 +43,6 @@
m_enable (true)
{
NS_LOG_FUNCTION;
- SetInterfaceId (ErrorModel::iid);
}
ErrorModel::~ErrorModel ()
@@ -130,7 +129,6 @@
NS_LOG_FUNCTION;
// Assume a uniform random variable if user does not specify
m_ranvar = new UniformVariable ();
- SetInterfaceId (RateErrorModel::iid);
}
RateErrorModel::~RateErrorModel ()
@@ -244,7 +242,6 @@
ListErrorModel::ListErrorModel ()
{
NS_LOG_FUNCTION;
- SetInterfaceId (ListErrorModel::iid);
}
ListErrorModel::~ListErrorModel ()
--- a/src/common/error-model.h Sun Dec 30 19:36:44 2007 -0800
+++ b/src/common/error-model.h Wed Jan 02 09:09:24 2008 +0100
@@ -48,7 +48,7 @@
* Typical code (simplified) to use an ErrorModel may look something like
* this:
* \code
- * Ptr<ErrorModel> rem = Create<RateErrorModel> ();
+ * Ptr<ErrorModel> rem = CreateObject<RateErrorModel> ();
* rem->SetRandomVariable (UniformVariable ());
* rem->SetRate (0.001);
* ...
--- a/src/core/array-trace-resolver.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/core/array-trace-resolver.cc Wed Jan 02 09:09:24 2008 +0100
@@ -211,7 +211,7 @@
std::vector<Ptr<ObjectTraceTester> > vec;
for (uint32_t i = 0; i < n; i++)
{
- vec.push_back (Create<ObjectTraceTester> ());
+ vec.push_back (CreateObject<ObjectTraceTester> ());
}
ArrayTraceResolver<ObjectTraceTesterIndex> resolver;
resolver.SetIterators (vec.begin (), vec.end ());
--- a/src/core/component-manager.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/core/component-manager.cc Wed Jan 02 09:09:24 2008 +0100
@@ -241,9 +241,7 @@
const ns3::InterfaceId B::iid = MakeInterfaceId ("B", Object::iid);
B::B ()
-{
- SetInterfaceId (B::iid);
-}
+{}
class A : public ns3::Object
@@ -277,8 +275,7 @@
m_oneBoolInvoked (false),
m_oneUi32Invoked (false)
{
- SetInterfaceId (A::iid);
- ns3::Ptr<B> b = ns3::Create<B> ();
+ ns3::Ptr<B> b = ns3::CreateObject<B> ();
AddInterface (b);
}
@@ -288,8 +285,7 @@
m_oneUi32Invoked (false),
m_bool (bo)
{
- SetInterfaceId (A::iid);
- ns3::Ptr<B> b = ns3::Create<B> ();
+ ns3::Ptr<B> b = ns3::CreateObject<B> ();
AddInterface (b);
}
@@ -299,8 +295,7 @@
m_oneUi32Invoked (true),
m_ui32 (i)
{
- SetInterfaceId (A::iid);
- ns3::Ptr<B> b = ns3::Create<B> ();
+ ns3::Ptr<B> b = ns3::CreateObject<B> ();
AddInterface (b);
}
--- a/src/core/component-manager.h Sun Dec 30 19:36:44 2007 -0800
+++ b/src/core/component-manager.h Wed Jan 02 09:09:24 2008 +0100
@@ -428,7 +428,7 @@
struct ObjectMaker<T,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> {
static ns3::Ptr<ns3::Object>
MakeObject (void) {
- return ns3::Create<T> ();
+ return ns3::CreateObject<T> ();
}
};
@@ -436,7 +436,7 @@
struct ObjectMaker<T,T1,ns3::empty,ns3::empty,ns3::empty,ns3::empty> {
static ns3::Ptr<ns3::Object>
MakeObject (T1 a1) {
- return ns3::Create<T> (a1);
+ return ns3::CreateObject<T> (a1);
}
};
@@ -444,7 +444,7 @@
struct ObjectMaker<T,T1,T2,ns3::empty,ns3::empty,ns3::empty> {
static ns3::Ptr<ns3::Object>
MakeObject (T1 a1, T2 a2) {
- return ns3::Create<T> (a1, a2);
+ return ns3::CreateObject<T> (a1, a2);
}
};
@@ -452,7 +452,7 @@
struct ObjectMaker<T,T1,T2,T3,ns3::empty,ns3::empty> {
static ns3::Ptr<ns3::Object>
MakeObject (T1 a1, T2 a2, T3 a3) {
- return ns3::Create<T> (a1, a2, a3);
+ return ns3::CreateObject<T> (a1, a2, a3);
}
};
@@ -461,7 +461,7 @@
struct ObjectMaker<T,T1,T2,T3,T4,ns3::empty> {
static ns3::Ptr<ns3::Object>
MakeObject (T1 a1, T2 a2, T3 a3, T4 a4) {
- return ns3::Create<T> (a1, a2, a3, a4);
+ return ns3::CreateObject<T> (a1, a2, a3, a4);
}
};
@@ -470,7 +470,7 @@
struct ObjectMaker {
static ns3::Ptr<ns3::Object>
MakeObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
- return ns3::Create<T> (a1, a2, a3, a4, a5);
+ return ns3::CreateObject<T> (a1, a2, a3, a4, a5);
}
};
--- a/src/core/object.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/core/object.cc Wed Jan 02 09:09:24 2008 +0100
@@ -406,9 +406,7 @@
public:
static const ns3::InterfaceId iid;
BaseA ()
- {
- SetInterfaceId (BaseA::iid);
- }
+ {}
void BaseGenerateTrace (int16_t v)
{ m_source = v; }
virtual void Dispose (void) {}
@@ -428,9 +426,7 @@
public:
static const ns3::InterfaceId iid;
DerivedA (int v)
- {
- SetInterfaceId (DerivedA::iid);
- }
+ {}
void DerivedGenerateTrace (int16_t v)
{ m_sourceDerived = v; }
virtual void Dispose (void) {
@@ -457,9 +453,7 @@
public:
static const ns3::InterfaceId iid;
BaseB ()
- {
- SetInterfaceId (BaseB::iid);
- }
+ {}
void BaseGenerateTrace (int16_t v)
{ m_source = v; }
virtual void Dispose (void) {}
@@ -479,9 +473,7 @@
public:
static const ns3::InterfaceId iid;
DerivedB (int v)
- {
- SetInterfaceId (DerivedB::iid);
- }
+ {}
void DerivedGenerateTrace (int16_t v)
{ m_sourceDerived = v; }
virtual void Dispose (void) {
@@ -553,17 +545,17 @@
{
bool result = true;
- Ptr<BaseA> baseA = Create<BaseA> ();
+ Ptr<BaseA> baseA = CreateObject<BaseA> ();
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), baseA);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), 0);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
- baseA = Create<DerivedA> (10);
+ baseA = CreateObject<DerivedA> (10);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), baseA);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), baseA);
NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
- baseA = Create<BaseA> ();
- Ptr<BaseB> baseB = Create<BaseB> ();
+ baseA = CreateObject<BaseA> ();
+ Ptr<BaseB> baseB = CreateObject<BaseB> ();
Ptr<BaseB> baseBCopy = baseB;
baseA->AddInterface (baseB);
NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), 0);
@@ -576,8 +568,8 @@
NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedA> (DerivedA::iid), 0);
NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (BaseA::iid), 0);
- baseA = Create<DerivedA> (1);
- baseB = Create<DerivedB> (1);
+ baseA = CreateObject<DerivedA> (1);
+ baseB = CreateObject<DerivedB> (1);
baseBCopy = baseB;
baseA->AddInterface (baseB);
NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedB> (DerivedB::iid), 0);
@@ -589,20 +581,20 @@
NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedB> (DerivedB::iid), 0);
NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (BaseB::iid), 0)
- baseA = Create<BaseA> ();
- baseB = Create<BaseB> ();
+ baseA = CreateObject<BaseA> ();
+ baseB = CreateObject<BaseB> ();
baseA->AddInterface (baseB);
baseA = 0;
baseA = baseB->QueryInterface<BaseA> (BaseA::iid);
- baseA = Create<BaseA> ();
+ baseA = CreateObject<BaseA> ();
baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
m_baseATrace = false;
baseA->BaseGenerateTrace (1);
NS_TEST_ASSERT (m_baseATrace);
baseA->TraceDisconnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
- baseB = Create<BaseB> ();
+ baseB = CreateObject<BaseB> ();
baseB->TraceConnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this));
m_baseBTrace = false;
baseB->BaseGenerateTrace (2);
@@ -639,8 +631,8 @@
baseA->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
Ptr<DerivedA> derivedA;
- derivedA = Create<DerivedA> (1);
- baseB = Create<BaseB> ();
+ derivedA = CreateObject<DerivedA> (1);
+ baseB = CreateObject<BaseB> ();
derivedA->AddInterface (baseB);
baseB->TraceConnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::DerivedATrace, this));
baseB->TraceConnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
--- a/src/core/object.h Sun Dec 30 19:36:44 2007 -0800
+++ b/src/core/object.h Wed Jan 02 09:09:24 2008 +0100
@@ -166,6 +166,38 @@
virtual Ptr<TraceResolver> GetTraceResolver (void) const;
protected:
/**
+ * This method is called by Object::Dispose.
+ * Subclasses are expected to override this method and chain
+ * up to their parent's implementation once they are done.
+ */
+ virtual void DoDispose (void);
+private:
+ friend class InterfaceIdTraceResolver;
+ template <typename T>
+ friend Ptr<T> CreateObject (void);
+ template <typename T, typename T1>
+ friend Ptr<T> CreateObject (T1 a1);
+ template <typename T, typename T1, typename T2>
+ friend Ptr<T> CreateObject (T1 a1, T2 a2);
+ template <typename T, typename T1, typename T2, typename T3>
+ friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3);
+ template <typename T, typename T1, typename T2, typename T3, typename T4>
+ friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4);
+ template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
+ friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+ template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+ template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+ friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
+
+ Ptr<Object> DoQueryInterface (InterfaceId iid) const;
+ void DoCollectSources (std::string path, const TraceContext &context,
+ TraceResolver::SourceCollection *collection) const;
+ void DoTraceAll (std::ostream &os, const TraceContext &context) const;
+ bool Check (void) const;
+ bool CheckLoose (void) const;
+ void MaybeDelete (void) const;
+ /**
* \param iid an InterfaceId
*
* Every subclass which defines a new InterfaceId for itself
@@ -173,21 +205,7 @@
* from its constructor.
*/
void SetInterfaceId (InterfaceId iid);
- /**
- * This method is called by Object::Dispose.
- * Subclasses are expected to override this method and chain
- * up to their parent's implementation once they are done.
- */
- virtual void DoDispose (void);
-private:
- friend class InterfaceIdTraceResolver;
- Ptr<Object> DoQueryInterface (InterfaceId iid) const;
- void DoCollectSources (std::string path, const TraceContext &context,
- TraceResolver::SourceCollection *collection) const;
- void DoTraceAll (std::ostream &os, const TraceContext &context) const;
- bool Check (void) const;
- bool CheckLoose (void) const;
- void MaybeDelete (void) const;
+
mutable uint32_t m_count;
InterfaceId m_iid;
bool m_disposed;
@@ -195,6 +213,30 @@
Object *m_next;
};
+template <typename T>
+Ptr<T> CreateObject (void);
+
+template <typename T, typename T1>
+Ptr<T> CreateObject (T1 a1);
+
+template <typename T, typename T1, typename T2>
+Ptr<T> CreateObject (T1 a1, T2 a2);
+
+template <typename T, typename T1, typename T2, typename T3>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3);
+
+template <typename T, typename T1, typename T2, typename T3, typename T4>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4);
+
+template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
+template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
+
} // namespace ns3
namespace ns3 {
@@ -227,6 +269,71 @@
return 0;
}
+template <typename T>
+Ptr<T> CreateObject (void)
+{
+ Ptr<T> p = Ptr<T> (new T (), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1>
+Ptr<T> CreateObject (T1 a1)
+{
+ Ptr<T> p = Ptr<T> (new T (a1), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1, typename T2>
+Ptr<T> CreateObject (T1 a1, T2 a2)
+{
+ Ptr<T> p = Ptr<T> (new T (a1, a2), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1, typename T2, typename T3>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3)
+{
+ Ptr<T> p = Ptr<T> (new T (a1, a2, a3), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1, typename T2, typename T3, typename T4>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
+{
+ Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
+{
+ Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
+{
+ Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false);
+ p->SetInterfaceId (T::iid);
+ return p;
+}
+
+
} // namespace ns3
#endif /* OBJECT_H */
--- a/src/core/ptr.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/core/ptr.cc Wed Jan 02 09:09:24 2008 +0100
@@ -98,7 +98,7 @@
Callback<void> cb = MakeCallback (&PtrTest::DestroyNotify, this);
m_nDestroyed = false;
{
- Ptr<NoCount> p = Create<NoCount> (cb);
+ Ptr<NoCount> p = CreateObject<NoCount> (cb);
}
if (m_nDestroyed != 1)
{
@@ -108,7 +108,7 @@
m_nDestroyed = 0;
{
Ptr<NoCount> p;
- p = Create<NoCount> (cb);
+ p = CreateObject<NoCount> (cb);
p = p;
}
if (m_nDestroyed != 1)
@@ -119,7 +119,7 @@
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
- p1 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
Ptr<NoCount> p2 = p1;
}
if (m_nDestroyed != 1)
@@ -130,7 +130,7 @@
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
- p1 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
Ptr<NoCount> p2;
p2 = p1;
}
@@ -142,8 +142,8 @@
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
- p1 = Create<NoCount> (cb);
- Ptr<NoCount> p2 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
+ Ptr<NoCount> p2 = CreateObject<NoCount> (cb);
p2 = p1;
}
if (m_nDestroyed != 2)
@@ -154,9 +154,9 @@
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
- p1 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
Ptr<NoCount> p2;
- p2 = Create<NoCount> (cb);
+ p2 = CreateObject<NoCount> (cb);
p2 = p1;
}
if (m_nDestroyed != 2)
@@ -167,8 +167,8 @@
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
- p1 = Create<NoCount> (cb);
- p1 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
}
if (m_nDestroyed != 2)
{
@@ -180,8 +180,8 @@
Ptr<NoCount> p1;
{
Ptr<NoCount> p2;
- p1 = Create<NoCount> (cb);
- p2 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
+ p2 = CreateObject<NoCount> (cb);
p2 = p1;
}
if (m_nDestroyed != 1)
@@ -199,8 +199,8 @@
Ptr<NoCount> p1;
{
Ptr<NoCount> p2;
- p1 = Create<NoCount> (cb);
- p2 = Create<NoCount> (cb);
+ p1 = CreateObject<NoCount> (cb);
+ p2 = CreateObject<NoCount> (cb);
p2 = CallTest (p1);
}
if (m_nDestroyed != 1)
@@ -242,7 +242,7 @@
{
NoCount *raw;
{
- Ptr<NoCount> p = Create<NoCount> (cb);
+ Ptr<NoCount> p = CreateObject<NoCount> (cb);
{
Ptr<NoCount const> p1 = p;
}
@@ -259,7 +259,7 @@
m_nDestroyed = 0;
{
- Ptr<NoCount> p = Create<NoCount> (cb);
+ Ptr<NoCount> p = CreateObject<NoCount> (cb);
const NoCount *v1 = PeekPointer (p);
NoCount *v2 = PeekPointer (p);
v1->Nothing ();
@@ -271,8 +271,8 @@
}
{
- Ptr<Object> p0 = Create<NoCount> (cb);
- Ptr<NoCount> p1 = Create<NoCount> (cb);
+ Ptr<Object> p0 = CreateObject<NoCount> (cb);
+ Ptr<NoCount> p1 = CreateObject<NoCount> (cb);
if (p0 == p1)
{
ok = false;
@@ -287,12 +287,12 @@
}
{
- Ptr<NoCount> p = Create<NoCount> (cb);
+ Ptr<NoCount> p = CreateObject<NoCount> (cb);
Callback<void> callback = MakeCallback (&NoCount::Nothing, p);
callback ();
}
{
- Ptr<const NoCount> p = Create<NoCount> (cb);
+ Ptr<const NoCount> p = CreateObject<NoCount> (cb);
Callback<void> callback = MakeCallback (&NoCount::Nothing, p);
callback ();
}
@@ -301,7 +301,7 @@
#if 0
// as expected, fails compilation.
{
- Ptr<const Object> p = Create<NoCount> (cb);
+ Ptr<const Object> p = CreateObject<NoCount> (cb);
Callback<void> callback = MakeCallback (&NoCount::Nothing, p);
}
// local types are not allowed as arguments to a template.
--- a/src/devices/csma/csma-ipv4-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/devices/csma/csma-ipv4-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -42,7 +42,7 @@
Ptr<Queue> q = Queue::CreateDefault ();
// assume full-duplex
- Ptr<CsmaNetDevice> nd = Create<CsmaNetDevice> (node, addr,
+ Ptr<CsmaNetDevice> nd = CreateObject<CsmaNetDevice> (node, addr,
ns3::CsmaNetDevice::IP_ARP, true, true);
nd->AddQueue(q);
@@ -58,13 +58,13 @@
{
Ptr<Queue> q = Queue::CreateDefault ();
- Ptr<CsmaNetDevice> nd0 = Create<CsmaNetDevice> (n1, addr,
+ Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> (n1, addr,
ns3::CsmaNetDevice::LLC,
true, false);
nd0->AddQueue(q);
nd0->Attach (ch);
- Ptr<CsmaNetDevice> nd1 = Create<CsmaNetDevice> (n1, addr,
+ Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> (n1, addr,
ns3::CsmaNetDevice::LLC,
false, true);
nd1->AddQueue(q);
@@ -78,13 +78,13 @@
{
Ptr<Queue> q = Queue::CreateDefault ();
- Ptr<CsmaNetDevice> nd0 = Create<CsmaNetDevice> (n1, addr,
+ Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> (n1, addr,
ns3::CsmaNetDevice::RAW,
true, false);
nd0->AddQueue(q);
nd0->Attach (ch);
- Ptr<CsmaNetDevice> nd1 = Create<CsmaNetDevice> (n1, addr,
+ Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> (n1, addr,
ns3::CsmaNetDevice::RAW,
false, true);
nd1->AddQueue(q);
--- a/src/devices/csma/csma-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/devices/csma/csma-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -36,7 +36,7 @@
const DataRate& bps,
const Time& delay)
{
- Ptr<CsmaChannel> channel = Create<CsmaChannel> (bps, delay);
+ Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> (bps, delay);
return channel;
}
@@ -48,7 +48,7 @@
Ptr<CsmaChannel> ch,
MacAddress addr)
{
- Ptr<CsmaNetDevice> nd1 = Create<CsmaNetDevice> (n1, addr,
+ Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> (n1, addr,
ns3::CsmaNetDevice::ETHERNET_V1);
Ptr<Queue> q = Queue::CreateDefault ();
@@ -63,7 +63,7 @@
Ptr<CsmaNetDevice> ndSrc,
Ptr<CsmaNetDevice> ndDest)
{
- Ptr<PacketSocket> socket = Create<PacketSocket> ();
+ Ptr<PacketSocket> socket = CreateObject<PacketSocket> ();
socket->Bind(ndSrc);
socket->Connect(ndDest->GetAddress());
app->Connect(socket);
@@ -76,7 +76,7 @@
Ptr<CsmaNetDevice> ndSrc,
MacAddress macAddr)
{
- Ptr<PacketSocket> socket = Create<PacketSocket> ();
+ Ptr<PacketSocket> socket = CreateObject<PacketSocket> ();
socket->Bind(ndSrc);
socket->Connect(macAddr);
app->Connect(socket);
--- a/src/devices/point-to-point/point-to-point-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/devices/point-to-point/point-to-point-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -45,15 +45,15 @@
const DataRate& bps,
const Time& delay)
{
- Ptr<PointToPointChannel> channel = Create<PointToPointChannel> (bps, delay);
+ Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> (bps, delay);
- Ptr<PointToPointNetDevice> net1 = Create<PointToPointNetDevice> (n1);
+ Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> (n1);
Ptr<Queue> q = Queue::CreateDefault ();
net1->AddQueue(q);
net1->Attach (channel);
- Ptr<PointToPointNetDevice> net2 = Create<PointToPointNetDevice> (n2);
+ Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> (n2);
q = Queue::CreateDefault ();
net2->AddQueue(q);
--- a/src/devices/wifi/propagation-delay-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/devices/wifi/propagation-delay-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -56,10 +56,10 @@
{
switch (g_modelType.GetValue ()) {
case CONSTANT_SPEED:
- return Create<ConstantSpeedPropagationDelayModel> (g_speed.GetValue ());
+ return CreateObject<ConstantSpeedPropagationDelayModel> (g_speed.GetValue ());
break;
case RANDOM:
- return Create<RandomPropagationDelayModel> ();
+ return CreateObject<RandomPropagationDelayModel> ();
break;
default:
NS_ASSERT (false);
--- a/src/devices/wifi/propagation-loss-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/devices/wifi/propagation-loss-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -89,13 +89,13 @@
{
switch (g_modelType.GetValue ()) {
case FRIIS:
- return Create<FriisPropagationLossModel> ();
+ return CreateObject<FriisPropagationLossModel> ();
break;
case RANDOM:
- return Create<RandomPropagationLossModel> ();
+ return CreateObject<RandomPropagationLossModel> ();
break;
case LOG_DISTANCE:
- return Create<LogDistancePropagationLossModel> ();
+ return CreateObject<LogDistancePropagationLossModel> ();
break;
default:
NS_ASSERT (false);
@@ -251,10 +251,10 @@
{
switch (g_logDistanceReferenceType.GetValue ()) {
case RANDOM:
- return Create<RandomPropagationLossModel> ();
+ return CreateObject<RandomPropagationLossModel> ();
break;
case FRIIS:
- return Create<FriisPropagationLossModel> ();
+ return CreateObject<FriisPropagationLossModel> ();
break;
case LOG_DISTANCE:
default:
@@ -288,8 +288,8 @@
*
* rx = rx0(tx) - 10 * n * log (d/d0)
*/
- static Ptr<StaticMobilityModel> zero = Create<StaticMobilityModel> (Vector (0.0, 0.0, 0.0));
- static Ptr<StaticMobilityModel> reference = Create<StaticMobilityModel> (Vector (m_referenceDistance, 0.0, 0.0));
+ static Ptr<StaticMobilityModel> zero = CreateObject<StaticMobilityModel> (Vector (0.0, 0.0, 0.0));
+ static Ptr<StaticMobilityModel> reference = CreateObject<StaticMobilityModel> (Vector (m_referenceDistance, 0.0, 0.0));
double rx0 = m_reference->GetRxPower (txPowerDbm, zero, reference);
double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance);
double rxPowerDbm = rx0 - pathLossDb;
--- a/src/devices/wifi/wifi-net-device.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/devices/wifi/wifi-net-device.cc Wed Jan 02 09:09:24 2008 +0100
@@ -178,7 +178,7 @@
EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff"));
// the physical layer.
- m_phy = Create<WifiPhy> (this);
+ m_phy = CreateObject<WifiPhy> (this);
// the rate control algorithm
switch (WifiDefaultParameters::GetRateControlAlgorithm ()) {
--- a/src/internet-node/arp-l3-protocol.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/internet-node/arp-l3-protocol.cc Wed Jan 02 09:09:24 2008 +0100
@@ -40,7 +40,6 @@
: m_node (node)
{
NS_LOG_FUNCTION;
- SetInterfaceId (ArpL3Protocol::iid);
}
ArpL3Protocol::~ArpL3Protocol ()
--- a/src/internet-node/internet-node.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/internet-node/internet-node.cc Wed Jan 02 09:09:24 2008 +0100
@@ -51,8 +51,8 @@
void
InternetNode::Construct (void)
{
- Ptr<Ipv4L3Protocol> ipv4 = Create<Ipv4L3Protocol> (this);
- Ptr<ArpL3Protocol> arp = Create<ArpL3Protocol> (this);
+ Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> (this);
+ Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> (this);
// XXX remove the PeekPointer below.
RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, PeekPointer (ipv4)),
Ipv4L3Protocol::PROT_NUMBER, 0);
@@ -60,12 +60,12 @@
ArpL3Protocol::PROT_NUMBER, 0);
- Ptr<Ipv4L4Demux> ipv4L4Demux = Create<Ipv4L4Demux> (this);
- Ptr<UdpL4Protocol> udp = Create<UdpL4Protocol> (this);
+ Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObject<Ipv4L4Demux> (this);
+ Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> (this);
ipv4L4Demux->Insert (udp);
- Ptr<UdpImpl> udpImpl = Create<UdpImpl> (udp);
- Ptr<Ipv4Impl> ipv4Impl = Create<Ipv4Impl> (ipv4);
+ Ptr<UdpImpl> udpImpl = CreateObject<UdpImpl> (udp);
+ Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> (ipv4);
Object::AddInterface (ipv4);
Object::AddInterface (arp);
--- a/src/internet-node/ipv4-l3-protocol.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/internet-node/ipv4-l3-protocol.cc Wed Jan 02 09:09:24 2008 +0100
@@ -158,8 +158,7 @@
m_node (node)
{
NS_LOG_FUNCTION;
- SetInterfaceId (Ipv4L3Protocol::iid);
- m_staticRouting = Create<Ipv4StaticRouting> ();
+ m_staticRouting = CreateObject<Ipv4StaticRouting> ();
AddRoutingProtocol (m_staticRouting, 0);
SetupLoopback ();
}
@@ -185,7 +184,7 @@
{
NS_LOG_FUNCTION;
- Ptr<Ipv4LoopbackInterface> interface = Create<Ipv4LoopbackInterface> (m_node);
+ Ptr<Ipv4LoopbackInterface> interface = CreateObject<Ipv4LoopbackInterface> (m_node);
interface->SetAddress (Ipv4Address::GetLoopback ());
interface->SetNetworkMask (Ipv4Mask::GetLoopback ());
uint32_t index = AddIpv4Interface (interface);
@@ -433,7 +432,7 @@
{
NS_LOG_FUNCTION;
NS_LOG_PARAMS (this << &device);
- Ptr<Ipv4Interface> interface = Create<ArpIpv4Interface> (m_node, device);
+ Ptr<Ipv4Interface> interface = CreateObject<ArpIpv4Interface> (m_node, device);
return AddIpv4Interface (interface);
}
--- a/src/internet-node/ipv4-l4-demux.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/internet-node/ipv4-l4-demux.cc Wed Jan 02 09:09:24 2008 +0100
@@ -63,9 +63,7 @@
Ipv4L4Demux::Ipv4L4Demux (Ptr<Node> node)
: m_node (node)
-{
- SetInterfaceId (Ipv4L4Demux::iid);
-}
+{}
Ipv4L4Demux::~Ipv4L4Demux()
{}
--- a/src/internet-node/udp-l4-protocol.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/internet-node/udp-l4-protocol.cc Wed Jan 02 09:09:24 2008 +0100
@@ -68,7 +68,7 @@
UdpL4Protocol::CreateSocket (void)
{
NS_LOG_FUNCTION;
- Ptr<Socket> socket = Create<UdpSocket> (m_node, this);
+ Ptr<Socket> socket = CreateObject<UdpSocket> (m_node, this);
return socket;
}
--- a/src/internet-node/udp-socket.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/internet-node/udp-socket.cc Wed Jan 02 09:09:24 2008 +0100
@@ -383,9 +383,9 @@
// Create topology
// Receiver Node
- Ptr<Node> rxNode = Create<InternetNode> ();
- Ptr<PointToPointNetDevice> rxDev = Create<PointToPointNetDevice> (rxNode);
- rxDev->AddQueue(Create<DropTailQueue> ());
+ Ptr<Node> rxNode = CreateObject<InternetNode> ();
+ Ptr<PointToPointNetDevice> rxDev = CreateObject<PointToPointNetDevice> (rxNode);
+ rxDev->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = rxNode->QueryInterface<Ipv4> (Ipv4::iid);
uint32_t netdev_idx = ipv4->AddInterface (rxDev);
ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1"));
@@ -393,9 +393,9 @@
ipv4->SetUp (netdev_idx);
// Sender Node
- Ptr<Node> txNode = Create<InternetNode> ();
- Ptr<PointToPointNetDevice> txDev = Create<PointToPointNetDevice> (txNode);
- txDev->AddQueue(Create<DropTailQueue> ());
+ Ptr<Node> txNode = CreateObject<InternetNode> ();
+ Ptr<PointToPointNetDevice> txDev = CreateObject<PointToPointNetDevice> (txNode);
+ txDev->AddQueue(CreateObject<DropTailQueue> ());
ipv4 = txNode->QueryInterface<Ipv4> (Ipv4::iid);
netdev_idx = ipv4->AddInterface (txDev);
ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2"));
@@ -403,7 +403,7 @@
ipv4->SetUp (netdev_idx);
// link the two nodes
- Ptr<PointToPointChannel> channel = Create<PointToPointChannel> ();
+ Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> ();
rxDev->Attach (channel);
txDev->Attach (channel);
--- a/src/mobility/hierarchical-mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/hierarchical-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -32,12 +32,12 @@
m_parent->QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
if (childNotifier == 0)
{
- childNotifier = Create<MobilityModelNotifier> ();
+ childNotifier = CreateObject<MobilityModelNotifier> ();
child->AddInterface (childNotifier);
}
if (parentNotifier == 0)
{
- parentNotifier = Create<MobilityModelNotifier> ();
+ parentNotifier = CreateObject<MobilityModelNotifier> ();
parent->AddInterface (parentNotifier);
}
childNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this));
--- a/src/mobility/mobility-model-notifier.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/mobility-model-notifier.cc Wed Jan 02 09:09:24 2008 +0100
@@ -29,9 +29,7 @@
MobilityModelNotifier::iid);
MobilityModelNotifier::MobilityModelNotifier ()
-{
- SetInterfaceId (MobilityModelNotifier::iid);
-}
+{}
void
MobilityModelNotifier::Notify (Ptr<const MobilityModel> position) const
--- a/src/mobility/mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -26,9 +26,7 @@
const InterfaceId MobilityModel::iid = MakeInterfaceId ("MobilityModel", Object::iid);
MobilityModel::MobilityModel ()
-{
- SetInterfaceId (MobilityModel::iid);
-}
+{}
MobilityModel::~MobilityModel ()
{}
--- a/src/mobility/ns2-mobility-file-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/ns2-mobility-file-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -53,7 +53,7 @@
object->QueryInterface<StaticSpeedMobilityModel> (StaticSpeedMobilityModel::iid);
if (model == 0)
{
- model = Create<StaticSpeedMobilityModel> ();
+ model = CreateObject<StaticSpeedMobilityModel> ();
object->AddInterface (model);
}
return model;
--- a/src/mobility/random-direction-2d-mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/random-direction-2d-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -103,7 +103,7 @@
g_speedVariable.IsDirty () ||
g_pauseVariable.IsDirty ())
{
- parameters = Create<RandomDirection2dMobilityModelParameters> ();
+ parameters = CreateObject<RandomDirection2dMobilityModelParameters> ();
g_bounds.ClearDirtyFlag ();
g_speedVariable.ClearDirtyFlag ();
g_pauseVariable.ClearDirtyFlag ();
@@ -115,14 +115,12 @@
RandomDirection2dMobilityModel::RandomDirection2dMobilityModel ()
: m_parameters (RandomDirection2dMobilityModelParameters::GetCurrent ())
{
- SetInterfaceId (RandomDirection2dMobilityModel::iid);
m_event = Simulator::ScheduleNow (&RandomDirection2dMobilityModel::Start, this);
}
RandomDirection2dMobilityModel::RandomDirection2dMobilityModel
(Ptr<RandomDirection2dMobilityModelParameters> parameters)
: m_parameters (parameters)
{
- SetInterfaceId (RandomDirection2dMobilityModel::iid);
m_event = Simulator::ScheduleNow (&RandomDirection2dMobilityModel::Start, this);
}
void
--- a/src/mobility/random-position.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/random-position.cc Wed Jan 02 09:09:24 2008 +0100
@@ -69,7 +69,6 @@
RandomPosition::RandomPosition ()
{
- Object::SetInterfaceId (RandomPosition::iid);
}
RandomPosition::~RandomPosition ()
--- a/src/mobility/random-walk-2d-mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/random-walk-2d-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -126,7 +126,7 @@
g_modeTime.IsDirty () ||
g_rectangle.IsDirty ())
{
- parameters = Create<RandomWalk2dMobilityModelParameters> ();
+ parameters = CreateObject<RandomWalk2dMobilityModelParameters> ();
}
return parameters;
}
@@ -134,7 +134,6 @@
RandomWalk2dMobilityModel::RandomWalk2dMobilityModel ()
: m_parameters (RandomWalk2dMobilityModelParameters::GetCurrent ())
{
- SetInterfaceId (RandomWalk2dMobilityModel::iid);
m_event = Simulator::ScheduleNow (&RandomWalk2dMobilityModel::Start, this);
}
--- a/src/mobility/random-waypoint-mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/random-waypoint-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -96,7 +96,7 @@
g_pause.IsDirty () ||
g_speed.IsDirty ())
{
- parameters = Create<RandomWaypointMobilityModelParameters> ();
+ parameters = CreateObject<RandomWaypointMobilityModelParameters> ();
}
return parameters;
}
--- a/src/mobility/static-mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/static-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -25,14 +25,10 @@
MobilityModel::iid);
StaticMobilityModel::StaticMobilityModel ()
-{
- SetInterfaceId (StaticMobilityModel::iid);
-}
+{}
StaticMobilityModel::StaticMobilityModel (const Vector &position)
: m_position (position)
-{
- SetInterfaceId (StaticMobilityModel::iid);
-}
+{}
StaticMobilityModel::~StaticMobilityModel ()
{}
--- a/src/mobility/static-speed-mobility-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/mobility/static-speed-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -30,20 +30,14 @@
StaticSpeedMobilityModel::StaticSpeedMobilityModel ()
-{
- SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
+{}
StaticSpeedMobilityModel::StaticSpeedMobilityModel (const Vector &position)
: m_helper (position)
-{
- SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
+{}
StaticSpeedMobilityModel::StaticSpeedMobilityModel (const Vector &position,
const Vector &speed)
: m_helper (position, speed)
-{
- SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
+{}
StaticSpeedMobilityModel::~StaticSpeedMobilityModel ()
{}
--- a/src/node/channel.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/channel.cc Wed Jan 02 09:09:24 2008 +0100
@@ -30,7 +30,6 @@
: m_name("Channel")
{
NS_LOG_FUNCTION;
- SetInterfaceId (Channel::iid);
}
Channel::Channel (std::string name)
@@ -38,7 +37,6 @@
{
NS_LOG_FUNCTION;
NS_LOG_PARAMS (this << name);
- SetInterfaceId (Channel::iid);
}
Channel::~Channel ()
--- a/src/node/ipv4.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/ipv4.cc Wed Jan 02 09:09:24 2008 +0100
@@ -28,9 +28,7 @@
const InterfaceId Ipv4::iid = MakeInterfaceId ("Ipv4", Object::iid);
Ipv4::Ipv4 ()
-{
- SetInterfaceId (Ipv4::iid);
-}
+{}
Ipv4::~Ipv4 ()
{}
--- a/src/node/net-device.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/net-device.cc Wed Jan 02 09:09:24 2008 +0100
@@ -47,7 +47,6 @@
m_isPointToPoint (false)
{
NS_LOG_FUNCTION;
- SetInterfaceId (NetDevice::iid);
m_node->AddDevice (this);
}
--- a/src/node/node.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/node.cc Wed Jan 02 09:09:24 2008 +0100
@@ -106,9 +106,8 @@
void
Node::Construct (void)
{
- SetInterfaceId (Node::iid);
m_id = NodeList::Add (this);
- Ptr<PacketSocketFactory> socketFactory = Create<PacketSocketFactory> ();
+ Ptr<PacketSocketFactory> socketFactory = CreateObject<PacketSocketFactory> ();
AddInterface (socketFactory);
}
--- a/src/node/packet-socket-factory.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/packet-socket-factory.cc Wed Jan 02 09:09:24 2008 +0100
@@ -28,14 +28,12 @@
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
--- a/src/node/queue.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/queue.cc Wed Jan 02 09:09:24 2008 +0100
@@ -106,7 +106,6 @@
m_nTotalDroppedPackets(0)
{
NS_LOG_FUNCTION;
- SetInterfaceId (Queue::iid);
}
Queue::~Queue()
--- a/src/node/socket-factory.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/socket-factory.cc Wed Jan 02 09:09:24 2008 +0100
@@ -25,8 +25,6 @@
const InterfaceId SocketFactory::iid = MakeInterfaceId ("SocketFactory", Object::iid);
SocketFactory::SocketFactory ()
-{
- SetInterfaceId (SocketFactory::iid);
-}
+{}
} // namespace ns3
--- a/src/node/udp.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/node/udp.cc Wed Jan 02 09:09:24 2008 +0100
@@ -25,8 +25,6 @@
const InterfaceId Udp::iid = MakeInterfaceId ("Udp", SocketFactory::iid);
Udp::Udp ()
-{
- SetInterfaceId (Udp::iid);
-}
+{}
} // namespace ns3
--- a/src/routing/global-routing/global-route-manager-impl.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/routing/global-routing/global-route-manager-impl.cc Wed Jan 02 09:09:24 2008 +0100
@@ -366,7 +366,7 @@
NS_LOG_LOGIC ("Adding GlobalRouter interface to node " <<
node->GetId ());
- Ptr<GlobalRouter> globalRouter = Create<GlobalRouter> ();
+ Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> ();
node->AddInterface (globalRouter);
}
}
--- a/src/routing/global-routing/global-router-interface.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/routing/global-routing/global-router-interface.cc Wed Jan 02 09:09:24 2008 +0100
@@ -438,7 +438,6 @@
: m_LSAs()
{
NS_LOG_FUNCTION;
- SetInterfaceId (GlobalRouter::iid);
m_routerId.Set(GlobalRouteManager::AllocateRouterId ());
}
--- a/src/routing/olsr/olsr-agent-impl.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/src/routing/olsr/olsr-agent-impl.cc Wed Jan 02 09:09:24 2008 +0100
@@ -161,9 +161,6 @@
m_midTimer.SetFunction (&AgentImpl::MidTimerExpire, this);
m_queuedMessagesTimer.SetFunction (&AgentImpl::SendQueuedMessages, this);
-
- SetInterfaceId (AgentImpl::iid);
-
// Aggregate with the Node, so that OLSR dies when the node is destroyed.
node->AddInterface (this);
@@ -234,7 +231,7 @@
NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress);
- m_routingTable = Create<RoutingTable> (m_ipv4, m_mainAddress);
+ m_routingTable = CreateObject<RoutingTable> (m_ipv4, m_mainAddress);
// Add OLSR as routing protocol, with slightly lower priority than
// static routing.
m_ipv4->AddRoutingProtocol (m_routingTable, -10);
--- a/tutorial/ipv4-bus-network.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/ipv4-bus-network.cc Wed Jan 02 09:09:24 2008 +0100
@@ -56,7 +56,7 @@
for (uint32_t i = 0; i < n; ++i)
{
- Ptr<Node> node = Create<InternetNode> ();
+ Ptr<Node> node = CreateObject<InternetNode> ();
uint32_t nd = CsmaIpv4Topology::AddIpv4CsmaNetDevice (node, m_channel,
Mac48Address::Allocate ());
Ipv4Address address = Ipv4AddressGenerator::AllocateAddress (mask,
--- a/tutorial/point-to-point-ipv4-topology.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/point-to-point-ipv4-topology.cc Wed Jan 02 09:09:24 2008 +0100
@@ -33,7 +33,7 @@
const DataRate& bps,
const Time& delay)
{
- return Create<PointToPointChannel> (bps, delay);
+ return CreateObject<PointToPointChannel> (bps, delay);
}
uint32_t
@@ -43,7 +43,7 @@
{
NS_ASSERT (channel->GetNDevices () <= 1);
- Ptr<PointToPointNetDevice> nd = Create<PointToPointNetDevice> (node);
+ Ptr<PointToPointNetDevice> nd = CreateObject<PointToPointNetDevice> (node);
Ptr<Queue> q = Queue::CreateDefault ();
nd->AddQueue(q);
--- a/tutorial/tutorial-bus-network.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-bus-network.cc Wed Jan 02 09:09:24 2008 +0100
@@ -41,11 +41,11 @@
uint32_t port = 7;
Ptr<Node> n0 = bus.GetNode (0);
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.0.1", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.0.1", port,
1, Seconds(1.), 1024);
Ptr<Node> n1 = bus.GetNode (1);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/tutorial/tutorial-csma-echo-ascii-trace.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-csma-echo-ascii-trace.cc Wed Jan 02 09:09:24 2008 +0100
@@ -39,10 +39,10 @@
NS_LOG_INFO ("UDP Echo Simulation");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
Ptr<CsmaChannel> lan =
CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
@@ -66,10 +66,10 @@
uint16_t port = 7;
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", port,
1, Seconds(1.), 1024);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/tutorial/tutorial-csma-echo-pcap-trace.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-csma-echo-pcap-trace.cc Wed Jan 02 09:09:24 2008 +0100
@@ -40,10 +40,10 @@
NS_LOG_INFO ("UDP Echo Simulation");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
Ptr<CsmaChannel> lan =
CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
@@ -67,10 +67,10 @@
uint16_t port = 7;
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", port,
1, Seconds(1.), 1024);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/tutorial/tutorial-csma-echo.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-csma-echo.cc Wed Jan 02 09:09:24 2008 +0100
@@ -38,10 +38,10 @@
NS_LOG_INFO ("UDP Echo Simulation");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
Ptr<CsmaChannel> lan =
CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
@@ -65,10 +65,10 @@
uint16_t port = 7;
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", port,
1, Seconds(1.), 1024);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/tutorial/tutorial-linear-dumbbell.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-linear-dumbbell.cc Wed Jan 02 09:09:24 2008 +0100
@@ -56,10 +56,10 @@
//
// Create the lan on the left side of the dumbbell.
//
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
Ptr<CsmaChannel> lan1 =
CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2));
@@ -83,10 +83,10 @@
//
// Create the lan on the right side of the dumbbell.
//
- Ptr<Node> n4 = Create<InternetNode> ();
- Ptr<Node> n5 = Create<InternetNode> ();
- Ptr<Node> n6 = Create<InternetNode> ();
- Ptr<Node> n7 = Create<InternetNode> ();
+ Ptr<Node> n4 = CreateObject<InternetNode> ();
+ Ptr<Node> n5 = CreateObject<InternetNode> ();
+ Ptr<Node> n6 = CreateObject<InternetNode> ();
+ Ptr<Node> n7 = CreateObject<InternetNode> ();
Ptr<CsmaChannel> lan2 =
CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2));
@@ -124,19 +124,19 @@
//
uint16_t port = 7;
- Ptr<UdpEchoClient> client0 = Create<UdpEchoClient> (n0, "10.1.2.1", port,
+ Ptr<UdpEchoClient> client0 = CreateObject<UdpEchoClient> (n0, "10.1.2.1", port,
100, Seconds(.01), 1024);
- Ptr<UdpEchoClient> client1 = Create<UdpEchoClient> (n1, "10.1.2.2", port,
+ Ptr<UdpEchoClient> client1 = CreateObject<UdpEchoClient> (n1, "10.1.2.2", port,
100, Seconds(.01), 1024);
- Ptr<UdpEchoClient> client2 = Create<UdpEchoClient> (n2, "10.1.2.3", port,
+ Ptr<UdpEchoClient> client2 = CreateObject<UdpEchoClient> (n2, "10.1.2.3", port,
100, Seconds(.01), 1024);
- Ptr<UdpEchoClient> client3 = Create<UdpEchoClient> (n3, "10.1.2.4", port,
+ Ptr<UdpEchoClient> client3 = CreateObject<UdpEchoClient> (n3, "10.1.2.4", port,
100, Seconds(.01), 1024);
- Ptr<UdpEchoServer> server4 = Create<UdpEchoServer> (n4, port);
- Ptr<UdpEchoServer> server5 = Create<UdpEchoServer> (n5, port);
- Ptr<UdpEchoServer> server6 = Create<UdpEchoServer> (n6, port);
- Ptr<UdpEchoServer> server7 = Create<UdpEchoServer> (n7, port);
+ Ptr<UdpEchoServer> server4 = CreateObject<UdpEchoServer> (n4, port);
+ Ptr<UdpEchoServer> server5 = CreateObject<UdpEchoServer> (n5, port);
+ Ptr<UdpEchoServer> server6 = CreateObject<UdpEchoServer> (n6, port);
+ Ptr<UdpEchoServer> server7 = CreateObject<UdpEchoServer> (n7, port);
server4->Start(Seconds(1.));
server5->Start(Seconds(1.));
--- a/tutorial/tutorial-point-to-point.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-point-to-point.cc Wed Jan 02 09:09:24 2008 +0100
@@ -47,8 +47,8 @@
NS_LOG_INFO ("Point to Point Topology Simulation");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
Ptr<PointToPointChannel> link = PointToPointTopology::AddPointToPointLink (
n0, n1, DataRate (38400), MilliSeconds (20));
@@ -58,10 +58,10 @@
uint16_t port = 7;
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", port,
1, Seconds(1.), 1024);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/tutorial/tutorial-star-routing.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-star-routing.cc Wed Jan 02 09:09:24 2008 +0100
@@ -51,13 +51,13 @@
NS_LOG_INFO ("Star Topology with Routing Simulation");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
- Ptr<Node> n4 = Create<InternetNode> ();
- Ptr<Node> n5 = Create<InternetNode> ();
- Ptr<Node> n6 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
+ Ptr<Node> n4 = CreateObject<InternetNode> ();
+ Ptr<Node> n5 = CreateObject<InternetNode> ();
+ Ptr<Node> n6 = CreateObject<InternetNode> ();
Ptr<PointToPointChannel> link01 =
PointToPointIpv4Topology::CreateChannel (DataRate (38400),
@@ -145,10 +145,10 @@
uint16_t port = 7;
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n4, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n4, "10.1.1.2", port,
1, Seconds(1.), 1024);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/tutorial/tutorial-star.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/tutorial/tutorial-star.cc Wed Jan 02 09:09:24 2008 +0100
@@ -51,13 +51,13 @@
NS_LOG_INFO ("Star Topology Simulation");
- Ptr<Node> n0 = Create<InternetNode> ();
- Ptr<Node> n1 = Create<InternetNode> ();
- Ptr<Node> n2 = Create<InternetNode> ();
- Ptr<Node> n3 = Create<InternetNode> ();
- Ptr<Node> n4 = Create<InternetNode> ();
- Ptr<Node> n5 = Create<InternetNode> ();
- Ptr<Node> n6 = Create<InternetNode> ();
+ Ptr<Node> n0 = CreateObject<InternetNode> ();
+ Ptr<Node> n1 = CreateObject<InternetNode> ();
+ Ptr<Node> n2 = CreateObject<InternetNode> ();
+ Ptr<Node> n3 = CreateObject<InternetNode> ();
+ Ptr<Node> n4 = CreateObject<InternetNode> ();
+ Ptr<Node> n5 = CreateObject<InternetNode> ();
+ Ptr<Node> n6 = CreateObject<InternetNode> ();
Ptr<PointToPointChannel> link01 =
PointToPointIpv4Topology::CreateChannel (DataRate (38400),
@@ -145,10 +145,10 @@
uint16_t port = 7;
- Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port,
+ Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", port,
1, Seconds(1.), 1024);
- Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
server->Start(Seconds(1.));
client->Start(Seconds(2.));
--- a/utils/bench-object.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/utils/bench-object.cc Wed Jan 02 09:09:24 2008 +0100
@@ -28,7 +28,7 @@
std::vector< Ptr<BaseA> > objlist;
for (int i = 0; i < nobjects; ++i)
- objlist.push_back (Create<BaseA> ());
+ objlist.push_back (CreateObject<BaseA> ());
for (int swapCounter = nswaps; swapCounter; --swapCounter)
{
--- a/utils/mobility-generator.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/utils/mobility-generator.cc Wed Jan 02 09:09:24 2008 +0100
@@ -45,7 +45,7 @@
uint32_t n = atoi (*argv + strlen ("--n="));
for (uint32_t i = 0; i < n; i++)
{
- Ptr<MobilityModelNotifier> notifier = Create<MobilityModelNotifier> ();
+ Ptr<MobilityModelNotifier> notifier = CreateObject<MobilityModelNotifier> ();
notifier->RegisterListener (MakeCallback (&CourseChange));
objects.push_back (notifier);
}
--- a/utils/mobility-visualizer-model.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/utils/mobility-visualizer-model.cc Wed Jan 02 09:09:24 2008 +0100
@@ -92,8 +92,8 @@
for (uint32_t i = 0; i < g_numNodes; i++)
{
- Ptr<Node> node = Create<Node> ();
- node->AddInterface (Create<MobilityModelNotifier> ());
+ Ptr<Node> node = CreateObject<Node> ();
+ node->AddInterface (CreateObject<MobilityModelNotifier> ());
}
topology.Layout (NodeList::Begin (), NodeList::End ());
--- a/utils/print-introspected-doxygen.cc Sun Dec 30 19:36:44 2007 -0800
+++ b/utils/print-introspected-doxygen.cc Wed Jan 02 09:09:24 2008 +0100
@@ -116,12 +116,12 @@
int main (int argc, char *argv[])
{
- Ptr<Node> node = Create<InternetNode> ();
- node->AddInterface (Create<MobilityModelNotifier> ());
+ Ptr<Node> node = CreateObject<InternetNode> ();
+ node->AddInterface (CreateObject<MobilityModelNotifier> ());
- Ptr<PointToPointNetDevice> p2p = Create<PointToPointNetDevice> (node);
+ Ptr<PointToPointNetDevice> p2p = CreateObject<PointToPointNetDevice> (node);
p2p->AddQueue (Queue::CreateDefault ());
- Ptr<CsmaNetDevice> csma = Create<CsmaNetDevice> (node);
+ Ptr<CsmaNetDevice> csma = CreateObject<CsmaNetDevice> (node);
csma->AddQueue (Queue::CreateDefault ());
TraceResolver::SourceCollection collection;