diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index 06775e26d..8592d9f5d 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -107,9 +107,9 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -154,7 +154,7 @@ main (int argc, char *argv[]) // 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 ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("255.255.255.255", port), "Udp", @@ -165,7 +165,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create an optional packet sink to receive these packets - Ptr sink = Create ( + Ptr sink = CreateObject ( n1, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); @@ -174,7 +174,7 @@ main (int argc, char *argv[]) sink->Stop (Seconds (10.0)); // Create an optional packet sink to receive these packets - sink = Create ( + sink = CreateObject ( n2, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 942485f50..f415ea52a 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -106,11 +106,11 @@ main (int argc, char *argv[]) // Explicitly create the nodes required by the topology (shown above). // NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); - Ptr n4 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); + Ptr n4 = CreateObject (); NS_LOG_INFO ("Create channels."); // @@ -281,7 +281,7 @@ main (int argc, char *argv[]) // Configure a multicast packet generator that generates a packet // every few seconds - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress (multicastGroup, port), "Udp", @@ -298,7 +298,7 @@ main (int argc, char *argv[]) // 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 sink = Create ( + Ptr sink = CreateObject ( n4, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index 76918cbb7..bb2cf5a2f 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -100,10 +100,10 @@ main (int argc, char *argv[]) // Explicitly create the nodes required by the topology (shown above). // NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); NS_LOG_INFO ("Create channels."); // @@ -165,7 +165,7 @@ main (int argc, char *argv[]) // NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("10.1.1.2", port), "Udp", @@ -179,7 +179,7 @@ main (int argc, char *argv[]) // // Create a similar flow from n3 to n0, starting at time 1.1 seconds // - ooff = Create ( + ooff = CreateObject ( n3, InetSocketAddress ("10.1.1.1", port), "Udp", diff --git a/examples/csma-packet-socket.cc b/examples/csma-packet-socket.cc index fde9a8f0b..6244ceaeb 100644 --- a/examples/csma-packet-socket.cc +++ b/examples/csma-packet-socket.cc @@ -61,7 +61,7 @@ NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample"); static Ptr CreateCsmaDevice (Ptr node, Ptr channel) { - Ptr device = Create (node); + Ptr device = CreateObject (node); device->Attach (channel); Ptr queue = Queue::CreateDefault (); device->AddQueue (queue); @@ -102,14 +102,14 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); // create the shared medium used by all csma devices. NS_LOG_INFO ("Create channels."); - Ptr channel = Create (DataRate(5000000), MilliSeconds(2)); + Ptr channel = CreateObject (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 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s // from n0 to n1 NS_LOG_INFO ("Create Applications."); - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, n0ToN1, "Packet", @@ -145,7 +145,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create a similar flow from n3 to n0, starting at time 1.1 seconds - ooff = Create ( + ooff = CreateObject ( n3, n3ToN0, "Packet", diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index e5eb8dd97..e2d39b30d 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -120,13 +120,13 @@ main (int argc, char *argv[]) CommandLine::Parse (argc, argv); NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -191,7 +191,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("10.1.3.2", port), "Udp", diff --git a/examples/simple-alternate-routing.cc b/examples/simple-alternate-routing.cc index e9cedff04..e8da2c244 100644 --- a/examples/simple-alternate-routing.cc +++ b/examples/simple-alternate-routing.cc @@ -128,10 +128,10 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -182,7 +182,7 @@ main (int argc, char *argv[]) uint16_t port = 9; // Discard port (RFC 863) // Create a flow from n3 to n1, starting at time 1.1 seconds - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n3, InetSocketAddress ("10.1.1.1", port), "Udp", @@ -193,7 +193,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds (10.0)); // Create a packet sink to receive these packets - Ptr sink = Create ( + Ptr sink = CreateObject ( n1, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); diff --git a/examples/simple-error-model.cc b/examples/simple-error-model.cc index 04b627e62..ca6f2b213 100644 --- a/examples/simple-error-model.cc +++ b/examples/simple-error-model.cc @@ -97,10 +97,10 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -143,7 +143,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("10.1.3.2", port), "Udp", @@ -154,7 +154,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create an optional packet sink to receive these packets - Ptr sink = Create ( + Ptr sink = CreateObject ( n3, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); @@ -163,7 +163,7 @@ main (int argc, char *argv[]) sink->Stop (Seconds (10.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds - ooff = Create ( + ooff = CreateObject ( n3, InetSocketAddress ("10.1.2.1", port), "Udp", @@ -174,7 +174,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create a packet sink to receive these packets - sink = Create ( + sink = CreateObject ( n1, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); @@ -222,7 +222,7 @@ main (int argc, char *argv[]) sampleList.push_back (11); sampleList.push_back (17); // This time, we'll explicitly create the error model we want - Ptr pem = Create (); + Ptr pem = CreateObject (); pem->SetList (sampleList); nd2->AddReceiveErrorModel (pem); diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 362ca7af3..70f5931b8 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -122,10 +122,10 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -163,7 +163,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("10.1.3.2", port), "Udp", @@ -175,7 +175,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets // The last argument "true" disables output from the Receive callback - Ptr sink = Create ( + Ptr sink = CreateObject ( n3, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); @@ -184,7 +184,7 @@ main (int argc, char *argv[]) sink->Stop (Seconds (10.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds - ooff = Create ( + ooff = CreateObject ( n3, InetSocketAddress ("10.1.2.1", port), "Udp", @@ -195,7 +195,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds (10.0)); // Create a packet sink to receive these packets - sink = Create ( + sink = CreateObject ( n1, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); diff --git a/examples/simple-point-to-point-olsr.cc b/examples/simple-point-to-point-olsr.cc index b4343acfe..ed42d9c69 100644 --- a/examples/simple-point-to-point-olsr.cc +++ b/examples/simple-point-to-point-olsr.cc @@ -118,10 +118,10 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -162,7 +162,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("10.1.3.2", port), "Udp", @@ -173,7 +173,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create an optional packet sink to receive these packets - Ptr sink = Create ( + Ptr sink = CreateObject ( n3, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); @@ -182,7 +182,7 @@ main (int argc, char *argv[]) sink->Stop (Seconds (10.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds - ooff = Create ( + ooff = CreateObject ( n3, InetSocketAddress ("10.1.2.1", port), "Udp", @@ -193,7 +193,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create a packet sink to receive these packets - sink = Create ( + sink = CreateObject ( n1, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index d1e132211..4bbb482be 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -117,10 +117,10 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); @@ -163,7 +163,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) - Ptr ooff = Create ( + Ptr ooff = CreateObject ( n0, InetSocketAddress ("10.1.3.2", port), "Udp", @@ -174,7 +174,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create an optional packet sink to receive these packets - Ptr sink = Create ( + Ptr sink = CreateObject ( n3, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); @@ -183,7 +183,7 @@ main (int argc, char *argv[]) sink->Stop (Seconds (10.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds - ooff = Create ( + ooff = CreateObject ( n3, InetSocketAddress ("10.1.2.1", port), "Udp", @@ -194,7 +194,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create a packet sink to receive these packets - sink = Create ( + sink = CreateObject ( n1, InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 8eebef638..295ab5a99 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -100,10 +100,10 @@ main (int argc, char *argv[]) // Explicitly create the nodes required by the topology (shown above). // NS_LOG_INFO ("Create nodes."); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); NS_LOG_INFO ("Create channels."); // @@ -167,7 +167,7 @@ main (int argc, char *argv[]) // uint16_t port = 9; // well-known echo port number - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); // // Create a UdpEchoClient application to send UDP datagrams from node zero to // node one. @@ -176,7 +176,7 @@ main (int argc, char *argv[]) uint32_t maxPacketCount = 1; Time interPacketInterval = Seconds (1.); - Ptr client = Create (n0, "10.1.1.2", port, + Ptr client = CreateObject (n0, "10.1.1.2", port, maxPacketCount, interPacketInterval, packetSize); // // Tell the applications when to start and stop. diff --git a/samples/main-adhoc-wifi.cc b/samples/main-adhoc-wifi.cc index b48ccf429..08661f8e3 100644 --- a/samples/main-adhoc-wifi.cc +++ b/samples/main-adhoc-wifi.cc @@ -45,10 +45,10 @@ static Ptr CreateAdhocNode (Ptr channel, Vector position, const char *address) { - Ptr node = Create (); - Ptr device = Create (node, Mac48Address (address)); + Ptr node = CreateObject (); + Ptr device = CreateObject (node, Mac48Address (address)); device->Attach (channel); - Ptr mobility = Create (); + Ptr mobility = CreateObject (); mobility->SetPosition (position); node->AddInterface (mobility); @@ -108,7 +108,7 @@ RunOneExperiment (void) { g_bytesTotal = 0; - Ptr channel = Create (); + Ptr channel = CreateObject (); Ptr a = CreateAdhocNode (channel, Vector (5.0,0.0,0.0), @@ -121,7 +121,7 @@ RunOneExperiment (void) destination.SetProtocol (1); destination.SetSingleDevice (0); destination.SetPhysicalAddress (Mac48Address ("00:00:00:00:00:02")); - Ptr app = Create (a, destination, + Ptr app = CreateObject (a, destination, "Packet", ConstantVariable (250), ConstantVariable (0), diff --git a/samples/main-ap-wifi.cc b/samples/main-ap-wifi.cc index a667013ac..25c0eb424 100644 --- a/samples/main-ap-wifi.cc +++ b/samples/main-ap-wifi.cc @@ -71,12 +71,12 @@ CreateApNode (Ptr channel, Ssid ssid, Time at) { - Ptr node = Create (); - Ptr device = Create (node, Mac48Address (macAddress)); + Ptr node = CreateObject (); + Ptr device = CreateObject (node, Mac48Address (macAddress)); device->SetSsid (ssid); Simulator::Schedule (at, &NqapWifiNetDevice::StartBeaconing, device); device->Attach (channel); - Ptr mobility = Create (); + Ptr mobility = CreateObject (); mobility->SetPosition (position); node->AddInterface (mobility); return node; @@ -88,12 +88,12 @@ CreateStaNode (Ptr channel, const char *macAddress, Ssid ssid) { - Ptr node = Create (); - Ptr device = Create (node, Mac48Address (macAddress)); + Ptr node = CreateObject (); + Ptr device = CreateObject (node, Mac48Address (macAddress)); Simulator::ScheduleNow (&NqstaWifiNetDevice::StartActiveAssociation, device, ssid); device->Attach (channel); - Ptr mobility = Create (); + Ptr mobility = CreateObject (); mobility->SetPosition (position); node->AddInterface (mobility); return node; @@ -146,7 +146,7 @@ int main (int argc, char *argv[]) DefaultValue::Bind ("WifiRateControlAlgorithm", "Aarf"); //DefaultValue::Bind ("WifiRateControlAlgorithm", "Arf"); - Ptr channel = Create (); + Ptr channel = CreateObject (); Ssid ssid = Ssid ("mathieu"); Ptr a = CreateApNode (channel, @@ -170,7 +170,7 @@ int main (int argc, char *argv[]) destination.SetProtocol (1); destination.SetSingleDevice (0); destination.SetPhysicalAddress (Mac48Address ("00:00:00:00:00:03")); - Ptr app = Create (b, destination, + Ptr app = CreateObject (b, destination, "Packet", ConstantVariable (42), ConstantVariable (0)); diff --git a/samples/main-component-manager.cc b/samples/main-component-manager.cc index 77c3fb9b3..506a246e0 100644 --- a/samples/main-component-manager.cc +++ b/samples/main-component-manager.cc @@ -17,10 +17,7 @@ const InterfaceId AnObject::iid = MakeInterfaceId ("AnObject", Object::iid); const ClassId AnObject::cid = MakeClassId ("AnObject", AnObject::iid); AnObject::AnObject (int a, double b) -{ - // enable our interface - SetInterfaceId (AnObject::iid); -} +{} void AnObject::DoDispose (void) { diff --git a/samples/main-grid-topology.cc b/samples/main-grid-topology.cc index 7d9f5bbe5..72ba14c88 100644 --- a/samples/main-grid-topology.cc +++ b/samples/main-grid-topology.cc @@ -17,7 +17,7 @@ int main (int argc, char *argv[]) // create an array of empty nodes for testing purposes for (uint32_t i = 0; i < 120; i++) { - nodes.push_back (Create ()); + nodes.push_back (CreateObject ()); } // setup the grid itself: objects are layed out diff --git a/samples/main-object.cc b/samples/main-object.cc index 46bd58272..5f983c8c7 100644 --- a/samples/main-object.cc +++ b/samples/main-object.cc @@ -14,10 +14,7 @@ protected: const InterfaceId AnObject::iid = MakeInterfaceId ("AnObject", Object::iid); AnObject::AnObject () -{ - // enable our interface - SetInterfaceId (AnObject::iid); -} +{} void AnObject::DoDispose (void) { @@ -68,7 +65,7 @@ YetAnotherObject::YetAnotherObject (int a) // enable our interface SetInterfaceId (YetAnotherObject::iid); // aggregated directly to another object. - AddInterface (Create ()); + AddInterface (CreateObject ()); } void YetAnotherObject::DoDispose (void) @@ -87,7 +84,7 @@ int main (int argc, char *argv[]) Ptr anotherObject; Ptr yetAnotherObject; - p = Create (); + p = CreateObject (); // p gives you access to AnObject's interface anObject = p->QueryInterface (AnObject::iid); NS_ASSERT (anObject != 0); @@ -95,7 +92,7 @@ int main (int argc, char *argv[]) anotherObject = p->QueryInterface (AnotherObject::iid); NS_ASSERT (anotherObject == 0); - anotherObject = Create (1); + anotherObject = CreateObject (1); // AnotherObject does not give you access to AnObject's interface anObject = anotherObject->QueryInterface (AnObject::iid); NS_ASSERT (anObject == 0); @@ -110,7 +107,7 @@ int main (int argc, char *argv[]) NS_ASSERT (anotherObject != 0); - yetAnotherObject = Create (2); + yetAnotherObject = CreateObject (2); // gives you acess to AnObject interface too. anObject = yetAnotherObject->QueryInterface (AnObject::iid); NS_ASSERT (anObject != 0); diff --git a/samples/main-propagation-loss.cc b/samples/main-propagation-loss.cc index 2df93d2f1..0af0f536f 100644 --- a/samples/main-propagation-loss.cc +++ b/samples/main-propagation-loss.cc @@ -26,8 +26,8 @@ using namespace ns3; static void PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, double max, double step) { - Ptr a = Create (); - Ptr b = Create (); + Ptr a = CreateObject (); + Ptr b = CreateObject (); Ptr model = PropagationLossModel::CreateDefault (); a->SetPosition (Vector (0.0, 0.0, 0.0)); diff --git a/samples/main-ptr.cc b/samples/main-ptr.cc index b3102338d..0c8c71e22 100644 --- a/samples/main-ptr.cc +++ b/samples/main-ptr.cc @@ -49,7 +49,7 @@ int main (int argc, char *argv[]) { // Create a new object of type A, store it in global // variable g_a - Ptr a = Create (); + Ptr a = CreateObject (); a->Method (); Ptr prev = StoreA (a); NS_ASSERT (prev == 0); @@ -58,7 +58,7 @@ int main (int argc, char *argv[]) { // Create a new object of type A, store it in global // variable g_a, get a hold on the previous A object. - Ptr a = Create (); + Ptr a = CreateObject (); Ptr prev = StoreA (a); // call method on object prev->Method (); diff --git a/samples/main-query-interface.cc b/samples/main-query-interface.cc index db23a5000..50b47f3bf 100644 --- a/samples/main-query-interface.cc +++ b/samples/main-query-interface.cc @@ -122,8 +122,6 @@ AnImplementation::methodImpl (void) AnImplementation::AnImplementation (void) { NS_LOG_FUNCTION; - // enable our interface - SetInterfaceId (AnImplementation::iid); } void @@ -233,7 +231,7 @@ private: AnExtendedImplementation::AnExtendedImplementation (void) { - pImpl = Create (); + pImpl = CreateObject (); SetInterfaceId (AnExtendedImplementation::iid); } diff --git a/samples/main-random-topology.cc b/samples/main-random-topology.cc index fe896278d..aaa38bed1 100644 --- a/samples/main-random-topology.cc +++ b/samples/main-random-topology.cc @@ -38,7 +38,7 @@ int main (int argc, char *argv[]) std::vector > objects; for (uint32_t i = 0; i < 10000; i++) { - Ptr notifier = Create (); + Ptr notifier = CreateObject (); notifier->TraceConnect ("/course-change", MakeCallback (&CourseChange)); objects.push_back (notifier); } diff --git a/samples/main-random-walk.cc b/samples/main-random-walk.cc index c4a0db34f..6be8b1f14 100644 --- a/samples/main-random-walk.cc +++ b/samples/main-random-walk.cc @@ -45,8 +45,8 @@ int main (int argc, char *argv[]) for (uint32_t i = 0; i < 100; i++) { - Ptr node = Create (); - node->AddInterface (Create ()); + Ptr node = CreateObject (); + node->AddInterface (CreateObject ()); } topology.Layout (NodeList::Begin (), NodeList::End ()); diff --git a/samples/main-simple.cc b/samples/main-simple.cc index 451665837..68147ae4a 100644 --- a/samples/main-simple.cc +++ b/samples/main-simple.cc @@ -40,7 +40,7 @@ PrintTraffic (Ptr socket) void RunSimulation (void) { - Ptr a = Create (); + Ptr a = CreateObject (); InterfaceId iid = InterfaceId::LookupByName ("Udp"); Ptr socketFactory = a->QueryInterface (iid); diff --git a/src/common/error-model.cc b/src/common/error-model.cc index 71b84d441..946f6c118 100644 --- a/src/common/error-model.cc +++ b/src/common/error-model.cc @@ -43,7 +43,6 @@ ErrorModel::ErrorModel () : m_enable (true) { NS_LOG_FUNCTION; - SetInterfaceId (ErrorModel::iid); } ErrorModel::~ErrorModel () @@ -130,7 +129,6 @@ RateErrorModel::RateErrorModel () : 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 @@ const ClassId ListErrorModel::cid = ListErrorModel::ListErrorModel () { NS_LOG_FUNCTION; - SetInterfaceId (ListErrorModel::iid); } ListErrorModel::~ListErrorModel () diff --git a/src/common/error-model.h b/src/common/error-model.h index 5ee063eca..6c61762e6 100644 --- a/src/common/error-model.h +++ b/src/common/error-model.h @@ -48,7 +48,7 @@ class RandomVariable; * Typical code (simplified) to use an ErrorModel may look something like * this: * \code - * Ptr rem = Create (); + * Ptr rem = CreateObject (); * rem->SetRandomVariable (UniformVariable ()); * rem->SetRate (0.001); * ... diff --git a/src/core/array-trace-resolver.cc b/src/core/array-trace-resolver.cc index 35ce97a20..93f5094d5 100644 --- a/src/core/array-trace-resolver.cc +++ b/src/core/array-trace-resolver.cc @@ -211,7 +211,7 @@ ArrayTraceResolverTest::RunOne (uint32_t n, std::string str, std::vector > vec; for (uint32_t i = 0; i < n; i++) { - vec.push_back (Create ()); + vec.push_back (CreateObject ()); } ArrayTraceResolver resolver; resolver.SetIterators (vec.begin (), vec.end ()); diff --git a/src/core/component-manager.cc b/src/core/component-manager.cc index ec78d708d..ba108781c 100644 --- a/src/core/component-manager.cc +++ b/src/core/component-manager.cc @@ -241,9 +241,7 @@ public: const ns3::InterfaceId B::iid = MakeInterfaceId ("B", Object::iid); B::B () -{ - SetInterfaceId (B::iid); -} +{} class A : public ns3::Object @@ -277,8 +275,7 @@ A::A () m_oneBoolInvoked (false), m_oneUi32Invoked (false) { - SetInterfaceId (A::iid); - ns3::Ptr b = ns3::Create (); + ns3::Ptr b = ns3::CreateObject (); AddInterface (b); } @@ -288,8 +285,7 @@ A::A (bool bo) m_oneUi32Invoked (false), m_bool (bo) { - SetInterfaceId (A::iid); - ns3::Ptr b = ns3::Create (); + ns3::Ptr b = ns3::CreateObject (); AddInterface (b); } @@ -299,8 +295,7 @@ A::A (uint32_t i) m_oneUi32Invoked (true), m_ui32 (i) { - SetInterfaceId (A::iid); - ns3::Ptr b = ns3::Create (); + ns3::Ptr b = ns3::CreateObject (); AddInterface (b); } diff --git a/src/core/component-manager.h b/src/core/component-manager.h index 863704da1..6dfa45e05 100644 --- a/src/core/component-manager.h +++ b/src/core/component-manager.h @@ -428,7 +428,7 @@ template struct ObjectMaker { static ns3::Ptr MakeObject (void) { - return ns3::Create (); + return ns3::CreateObject (); } }; @@ -436,7 +436,7 @@ template struct ObjectMaker { static ns3::Ptr MakeObject (T1 a1) { - return ns3::Create (a1); + return ns3::CreateObject (a1); } }; @@ -444,7 +444,7 @@ template struct ObjectMaker { static ns3::Ptr MakeObject (T1 a1, T2 a2) { - return ns3::Create (a1, a2); + return ns3::CreateObject (a1, a2); } }; @@ -452,7 +452,7 @@ template struct ObjectMaker { static ns3::Ptr MakeObject (T1 a1, T2 a2, T3 a3) { - return ns3::Create (a1, a2, a3); + return ns3::CreateObject (a1, a2, a3); } }; @@ -461,7 +461,7 @@ template { static ns3::Ptr MakeObject (T1 a1, T2 a2, T3 a3, T4 a4) { - return ns3::Create (a1, a2, a3, a4); + return ns3::CreateObject (a1, a2, a3, a4); } }; @@ -470,7 +470,7 @@ template MakeObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { - return ns3::Create (a1, a2, a3, a4, a5); + return ns3::CreateObject (a1, a2, a3, a4, a5); } }; diff --git a/src/core/object.cc b/src/core/object.cc index 1049b6cab..03ae6e7e6 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -406,9 +406,7 @@ class BaseA : public ns3::Object 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 @@ class DerivedA : public BaseA 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 @@ class BaseB : public ns3::Object 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 @@ class DerivedB : public BaseB 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 @@ ObjectTest::RunTests (void) { bool result = true; - Ptr baseA = Create (); + Ptr baseA = CreateObject (); NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (BaseA::iid), baseA); NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); - baseA = Create (10); + baseA = CreateObject (10); NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (BaseA::iid), baseA); NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), baseA); NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (DerivedA::iid), 0); - baseA = Create (); - Ptr baseB = Create (); + baseA = CreateObject (); + Ptr baseB = CreateObject (); Ptr baseBCopy = baseB; baseA->AddInterface (baseB); NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseA::iid), 0); @@ -576,8 +568,8 @@ ObjectTest::RunTests (void) NS_TEST_ASSERT_EQUAL (baseB->QueryInterface (DerivedA::iid), 0); NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (BaseA::iid), 0); - baseA = Create (1); - baseB = Create (1); + baseA = CreateObject (1); + baseB = CreateObject (1); baseBCopy = baseB; baseA->AddInterface (baseB); NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (DerivedB::iid), 0); @@ -589,20 +581,20 @@ ObjectTest::RunTests (void) NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (DerivedB::iid), 0); NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseB::iid), 0) - baseA = Create (); - baseB = Create (); + baseA = CreateObject (); + baseB = CreateObject (); baseA->AddInterface (baseB); baseA = 0; baseA = baseB->QueryInterface (BaseA::iid); - baseA = Create (); + baseA = CreateObject (); 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 = CreateObject (); baseB->TraceConnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); m_baseBTrace = false; baseB->BaseGenerateTrace (2); @@ -639,8 +631,8 @@ ObjectTest::RunTests (void) baseA->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); Ptr derivedA; - derivedA = Create (1); - baseB = Create (); + derivedA = CreateObject (1); + baseB = CreateObject (); derivedA->AddInterface (baseB); baseB->TraceConnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::DerivedATrace, this)); baseB->TraceConnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); diff --git a/src/core/object.h b/src/core/object.h index 34ce9fe38..f4609e09e 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -165,14 +165,6 @@ public: */ virtual Ptr GetTraceResolver (void) const; protected: - /** - * \param iid an InterfaceId - * - * Every subclass which defines a new InterfaceId for itself - * should register this InterfaceId by calling this method - * from its constructor. - */ - void SetInterfaceId (InterfaceId iid); /** * This method is called by Object::Dispose. * Subclasses are expected to override this method and chain @@ -181,6 +173,23 @@ protected: virtual void DoDispose (void); private: friend class InterfaceIdTraceResolver; + template + friend Ptr CreateObject (void); + template + friend Ptr CreateObject (T1 a1); + template + friend Ptr CreateObject (T1 a1, T2 a2); + template + friend Ptr CreateObject (T1 a1, T2 a2, T3 a3); + template + friend Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4); + template + friend Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + template + friend Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6); + template + friend Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7); + Ptr DoQueryInterface (InterfaceId iid) const; void DoCollectSources (std::string path, const TraceContext &context, TraceResolver::SourceCollection *collection) const; @@ -188,6 +197,15 @@ private: 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 + * should register this InterfaceId by calling this method + * from its constructor. + */ + void SetInterfaceId (InterfaceId iid); + mutable uint32_t m_count; InterfaceId m_iid; bool m_disposed; @@ -195,6 +213,30 @@ private: Object *m_next; }; +template +Ptr CreateObject (void); + +template +Ptr CreateObject (T1 a1); + +template +Ptr CreateObject (T1 a1, T2 a2); + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3); + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4); + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6); + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7); + } // namespace ns3 namespace ns3 { @@ -227,6 +269,71 @@ Object::QueryInterface (InterfaceId iid) const return 0; } +template +Ptr CreateObject (void) +{ + Ptr p = Ptr (new T (), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1) +{ + Ptr p = Ptr (new T (a1), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1, T2 a2) +{ + Ptr p = Ptr (new T (a1, a2), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3) +{ + Ptr p = Ptr (new T (a1, a2, a3), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4) +{ + Ptr p = Ptr (new T (a1, a2, a3, a4), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + Ptr p = Ptr (new T (a1, a2, a3, a4, a5), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + Ptr p = Ptr (new T (a1, a2, a3, a4, a5, a6), false); + p->SetInterfaceId (T::iid); + return p; +} + +template +Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + Ptr p = Ptr (new T (a1, a2, a3, a4, a5, a6, a7), false); + p->SetInterfaceId (T::iid); + return p; +} + + } // namespace ns3 #endif /* OBJECT_H */ diff --git a/src/core/ptr.cc b/src/core/ptr.cc index cee3f59e2..feb09ad61 100644 --- a/src/core/ptr.cc +++ b/src/core/ptr.cc @@ -98,7 +98,7 @@ PtrTest::RunTests (void) Callback cb = MakeCallback (&PtrTest::DestroyNotify, this); m_nDestroyed = false; { - Ptr p = Create (cb); + Ptr p = CreateObject (cb); } if (m_nDestroyed != 1) { @@ -108,7 +108,7 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { Ptr p; - p = Create (cb); + p = CreateObject (cb); p = p; } if (m_nDestroyed != 1) @@ -119,7 +119,7 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { Ptr p1; - p1 = Create (cb); + p1 = CreateObject (cb); Ptr p2 = p1; } if (m_nDestroyed != 1) @@ -130,7 +130,7 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { Ptr p1; - p1 = Create (cb); + p1 = CreateObject (cb); Ptr p2; p2 = p1; } @@ -142,8 +142,8 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { Ptr p1; - p1 = Create (cb); - Ptr p2 = Create (cb); + p1 = CreateObject (cb); + Ptr p2 = CreateObject (cb); p2 = p1; } if (m_nDestroyed != 2) @@ -154,9 +154,9 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { Ptr p1; - p1 = Create (cb); + p1 = CreateObject (cb); Ptr p2; - p2 = Create (cb); + p2 = CreateObject (cb); p2 = p1; } if (m_nDestroyed != 2) @@ -167,8 +167,8 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { Ptr p1; - p1 = Create (cb); - p1 = Create (cb); + p1 = CreateObject (cb); + p1 = CreateObject (cb); } if (m_nDestroyed != 2) { @@ -180,8 +180,8 @@ PtrTest::RunTests (void) Ptr p1; { Ptr p2; - p1 = Create (cb); - p2 = Create (cb); + p1 = CreateObject (cb); + p2 = CreateObject (cb); p2 = p1; } if (m_nDestroyed != 1) @@ -199,8 +199,8 @@ PtrTest::RunTests (void) Ptr p1; { Ptr p2; - p1 = Create (cb); - p2 = Create (cb); + p1 = CreateObject (cb); + p2 = CreateObject (cb); p2 = CallTest (p1); } if (m_nDestroyed != 1) @@ -242,7 +242,7 @@ PtrTest::RunTests (void) { NoCount *raw; { - Ptr p = Create (cb); + Ptr p = CreateObject (cb); { Ptr p1 = p; } @@ -259,7 +259,7 @@ PtrTest::RunTests (void) m_nDestroyed = 0; { - Ptr p = Create (cb); + Ptr p = CreateObject (cb); const NoCount *v1 = PeekPointer (p); NoCount *v2 = PeekPointer (p); v1->Nothing (); @@ -271,8 +271,8 @@ PtrTest::RunTests (void) } { - Ptr p0 = Create (cb); - Ptr p1 = Create (cb); + Ptr p0 = CreateObject (cb); + Ptr p1 = CreateObject (cb); if (p0 == p1) { ok = false; @@ -287,12 +287,12 @@ PtrTest::RunTests (void) } { - Ptr p = Create (cb); + Ptr p = CreateObject (cb); Callback callback = MakeCallback (&NoCount::Nothing, p); callback (); } { - Ptr p = Create (cb); + Ptr p = CreateObject (cb); Callback callback = MakeCallback (&NoCount::Nothing, p); callback (); } @@ -301,7 +301,7 @@ PtrTest::RunTests (void) #if 0 // as expected, fails compilation. { - Ptr p = Create (cb); + Ptr p = CreateObject (cb); Callback callback = MakeCallback (&NoCount::Nothing, p); } // local types are not allowed as arguments to a template. diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index 43e8bcf42..e17aaa9ca 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -42,7 +42,7 @@ CsmaIpv4Topology::AddIpv4CsmaNetDevice( Ptr q = Queue::CreateDefault (); // assume full-duplex - Ptr nd = Create (node, addr, + Ptr nd = CreateObject (node, addr, ns3::CsmaNetDevice::IP_ARP, true, true); nd->AddQueue(q); @@ -58,13 +58,13 @@ CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, { Ptr q = Queue::CreateDefault (); - Ptr nd0 = Create (n1, addr, + Ptr nd0 = CreateObject (n1, addr, ns3::CsmaNetDevice::LLC, true, false); nd0->AddQueue(q); nd0->Attach (ch); - Ptr nd1 = Create (n1, addr, + Ptr nd1 = CreateObject (n1, addr, ns3::CsmaNetDevice::LLC, false, true); nd1->AddQueue(q); @@ -78,13 +78,13 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, { Ptr q = Queue::CreateDefault (); - Ptr nd0 = Create (n1, addr, + Ptr nd0 = CreateObject (n1, addr, ns3::CsmaNetDevice::RAW, true, false); nd0->AddQueue(q); nd0->Attach (ch); - Ptr nd1 = Create (n1, addr, + Ptr nd1 = CreateObject (n1, addr, ns3::CsmaNetDevice::RAW, false, true); nd1->AddQueue(q); diff --git a/src/devices/csma/csma-topology.cc b/src/devices/csma/csma-topology.cc index 48a96ec2a..67071c0ae 100644 --- a/src/devices/csma/csma-topology.cc +++ b/src/devices/csma/csma-topology.cc @@ -36,7 +36,7 @@ CsmaTopology::CreateCsmaChannel( const DataRate& bps, const Time& delay) { - Ptr channel = Create (bps, delay); + Ptr channel = CreateObject (bps, delay); return channel; } @@ -48,7 +48,7 @@ CsmaTopology::AddCsmaEthernetNode( Ptr ch, MacAddress addr) { - Ptr nd1 = Create (n1, addr, + Ptr nd1 = CreateObject (n1, addr, ns3::CsmaNetDevice::ETHERNET_V1); Ptr q = Queue::CreateDefault (); @@ -63,7 +63,7 @@ CsmaTopology::ConnectPacketSocket(Ptr app, Ptr ndSrc, Ptr ndDest) { - Ptr socket = Create (); + Ptr socket = CreateObject (); socket->Bind(ndSrc); socket->Connect(ndDest->GetAddress()); app->Connect(socket); @@ -76,7 +76,7 @@ CsmaTopology::ConnectPacketSocket(Ptr app, Ptr ndSrc, MacAddress macAddr) { - Ptr socket = Create (); + Ptr socket = CreateObject (); socket->Bind(ndSrc); socket->Connect(macAddr); app->Connect(socket); diff --git a/src/devices/point-to-point/point-to-point-topology.cc b/src/devices/point-to-point/point-to-point-topology.cc index 0c0459fdc..d5c6c08b0 100644 --- a/src/devices/point-to-point/point-to-point-topology.cc +++ b/src/devices/point-to-point/point-to-point-topology.cc @@ -45,15 +45,15 @@ PointToPointTopology::AddPointToPointLink( const DataRate& bps, const Time& delay) { - Ptr channel = Create (bps, delay); + Ptr channel = CreateObject (bps, delay); - Ptr net1 = Create (n1); + Ptr net1 = CreateObject (n1); Ptr q = Queue::CreateDefault (); net1->AddQueue(q); net1->Attach (channel); - Ptr net2 = Create (n2); + Ptr net2 = CreateObject (n2); q = Queue::CreateDefault (); net2->AddQueue(q); diff --git a/src/devices/wifi/propagation-delay-model.cc b/src/devices/wifi/propagation-delay-model.cc index 0c5c1007b..e62edf12c 100644 --- a/src/devices/wifi/propagation-delay-model.cc +++ b/src/devices/wifi/propagation-delay-model.cc @@ -56,10 +56,10 @@ PropagationDelayModel::CreateDefault (void) { switch (g_modelType.GetValue ()) { case CONSTANT_SPEED: - return Create (g_speed.GetValue ()); + return CreateObject (g_speed.GetValue ()); break; case RANDOM: - return Create (); + return CreateObject (); break; default: NS_ASSERT (false); diff --git a/src/devices/wifi/propagation-loss-model.cc b/src/devices/wifi/propagation-loss-model.cc index 98490c738..c74e258b7 100644 --- a/src/devices/wifi/propagation-loss-model.cc +++ b/src/devices/wifi/propagation-loss-model.cc @@ -89,13 +89,13 @@ PropagationLossModel::CreateDefault (void) { switch (g_modelType.GetValue ()) { case FRIIS: - return Create (); + return CreateObject (); break; case RANDOM: - return Create (); + return CreateObject (); break; case LOG_DISTANCE: - return Create (); + return CreateObject (); break; default: NS_ASSERT (false); @@ -251,10 +251,10 @@ LogDistancePropagationLossModel::CreateDefaultReference (void) { switch (g_logDistanceReferenceType.GetValue ()) { case RANDOM: - return Create (); + return CreateObject (); break; case FRIIS: - return Create (); + return CreateObject (); break; case LOG_DISTANCE: default: @@ -288,8 +288,8 @@ LogDistancePropagationLossModel::GetRxPower (double txPowerDbm, * * rx = rx0(tx) - 10 * n * log (d/d0) */ - static Ptr zero = Create (Vector (0.0, 0.0, 0.0)); - static Ptr reference = Create (Vector (m_referenceDistance, 0.0, 0.0)); + static Ptr zero = CreateObject (Vector (0.0, 0.0, 0.0)); + static Ptr reference = CreateObject (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; diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc index ce8df3abf..6e77478d4 100644 --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -178,7 +178,7 @@ WifiNetDevice::Construct (void) EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); // the physical layer. - m_phy = Create (this); + m_phy = CreateObject (this); // the rate control algorithm switch (WifiDefaultParameters::GetRateControlAlgorithm ()) { diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 129a64dca..3eaa2a3a8 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -40,7 +40,6 @@ ArpL3Protocol::ArpL3Protocol (Ptr node) : m_node (node) { NS_LOG_FUNCTION; - SetInterfaceId (ArpL3Protocol::iid); } ArpL3Protocol::~ArpL3Protocol () diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index 5a927b55f..6e31292fd 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -51,8 +51,8 @@ InternetNode::~InternetNode () void InternetNode::Construct (void) { - Ptr ipv4 = Create (this); - Ptr arp = Create (this); + Ptr ipv4 = CreateObject (this); + Ptr arp = CreateObject (this); // XXX remove the PeekPointer below. RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, PeekPointer (ipv4)), Ipv4L3Protocol::PROT_NUMBER, 0); @@ -60,12 +60,12 @@ InternetNode::Construct (void) ArpL3Protocol::PROT_NUMBER, 0); - Ptr ipv4L4Demux = Create (this); - Ptr udp = Create (this); + Ptr ipv4L4Demux = CreateObject (this); + Ptr udp = CreateObject (this); ipv4L4Demux->Insert (udp); - Ptr udpImpl = Create (udp); - Ptr ipv4Impl = Create (ipv4); + Ptr udpImpl = CreateObject (udp); + Ptr ipv4Impl = CreateObject (ipv4); Object::AddInterface (ipv4); Object::AddInterface (arp); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index f824abf6e..d0b11583b 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -158,8 +158,7 @@ Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) m_node (node) { NS_LOG_FUNCTION; - SetInterfaceId (Ipv4L3Protocol::iid); - m_staticRouting = Create (); + m_staticRouting = CreateObject (); AddRoutingProtocol (m_staticRouting, 0); SetupLoopback (); } @@ -185,7 +184,7 @@ Ipv4L3Protocol::SetupLoopback (void) { NS_LOG_FUNCTION; - Ptr interface = Create (m_node); + Ptr interface = CreateObject (m_node); interface->SetAddress (Ipv4Address::GetLoopback ()); interface->SetNetworkMask (Ipv4Mask::GetLoopback ()); uint32_t index = AddIpv4Interface (interface); @@ -433,7 +432,7 @@ Ipv4L3Protocol::AddInterface (Ptr device) { NS_LOG_FUNCTION; NS_LOG_PARAMS (this << &device); - Ptr interface = Create (m_node, device); + Ptr interface = CreateObject (m_node, device); return AddIpv4Interface (interface); } diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index ae4a09e42..e0b63cc18 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -63,9 +63,7 @@ Ipv4L4ProtocolTraceContextElement::GetTypeName (void) const Ipv4L4Demux::Ipv4L4Demux (Ptr node) : m_node (node) -{ - SetInterfaceId (Ipv4L4Demux::iid); -} +{} Ipv4L4Demux::~Ipv4L4Demux() {} diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index beb925e87..d3a90ca98 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -68,7 +68,7 @@ Ptr UdpL4Protocol::CreateSocket (void) { NS_LOG_FUNCTION; - Ptr socket = Create (m_node, this); + Ptr socket = CreateObject (m_node, this); return socket; } diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 5a56673b3..5dcc67059 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -383,9 +383,9 @@ UdpSocketTest::RunTests (void) // Create topology // Receiver Node - Ptr rxNode = Create (); - Ptr rxDev = Create (rxNode); - rxDev->AddQueue(Create ()); + Ptr rxNode = CreateObject (); + Ptr rxDev = CreateObject (rxNode); + rxDev->AddQueue(CreateObject ()); Ptr ipv4 = rxNode->QueryInterface (Ipv4::iid); uint32_t netdev_idx = ipv4->AddInterface (rxDev); ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1")); @@ -393,9 +393,9 @@ UdpSocketTest::RunTests (void) ipv4->SetUp (netdev_idx); // Sender Node - Ptr txNode = Create (); - Ptr txDev = Create (txNode); - txDev->AddQueue(Create ()); + Ptr txNode = CreateObject (); + Ptr txDev = CreateObject (txNode); + txDev->AddQueue(CreateObject ()); ipv4 = txNode->QueryInterface (Ipv4::iid); netdev_idx = ipv4->AddInterface (txDev); ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2")); @@ -403,7 +403,7 @@ UdpSocketTest::RunTests (void) ipv4->SetUp (netdev_idx); // link the two nodes - Ptr channel = Create (); + Ptr channel = CreateObject (); rxDev->Attach (channel); txDev->Attach (channel); diff --git a/src/mobility/hierarchical-mobility-model.cc b/src/mobility/hierarchical-mobility-model.cc index 3f72ba1e7..9243623df 100644 --- a/src/mobility/hierarchical-mobility-model.cc +++ b/src/mobility/hierarchical-mobility-model.cc @@ -32,12 +32,12 @@ HierarchicalMobilityModel::HierarchicalMobilityModel (Ptr child, m_parent->QueryInterface (MobilityModelNotifier::iid); if (childNotifier == 0) { - childNotifier = Create (); + childNotifier = CreateObject (); child->AddInterface (childNotifier); } if (parentNotifier == 0) { - parentNotifier = Create (); + parentNotifier = CreateObject (); parent->AddInterface (parentNotifier); } childNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this)); diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index a32d629d1..8f48509b8 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -29,9 +29,7 @@ const ClassId MobilityModelNotifier::cid = MobilityModelNotifier::iid); MobilityModelNotifier::MobilityModelNotifier () -{ - SetInterfaceId (MobilityModelNotifier::iid); -} +{} void MobilityModelNotifier::Notify (Ptr position) const diff --git a/src/mobility/mobility-model.cc b/src/mobility/mobility-model.cc index c08d51619..f746e9a39 100644 --- a/src/mobility/mobility-model.cc +++ b/src/mobility/mobility-model.cc @@ -26,9 +26,7 @@ namespace ns3 { const InterfaceId MobilityModel::iid = MakeInterfaceId ("MobilityModel", Object::iid); MobilityModel::MobilityModel () -{ - SetInterfaceId (MobilityModel::iid); -} +{} MobilityModel::~MobilityModel () {} diff --git a/src/mobility/ns2-mobility-file-topology.cc b/src/mobility/ns2-mobility-file-topology.cc index 44a31d8a3..12663aa01 100644 --- a/src/mobility/ns2-mobility-file-topology.cc +++ b/src/mobility/ns2-mobility-file-topology.cc @@ -53,7 +53,7 @@ Ns2MobilityFileTopology::GetMobilityModel (std::string idString, const ObjectSto object->QueryInterface (StaticSpeedMobilityModel::iid); if (model == 0) { - model = Create (); + model = CreateObject (); object->AddInterface (model); } return model; diff --git a/src/mobility/random-direction-2d-mobility-model.cc b/src/mobility/random-direction-2d-mobility-model.cc index cb91c7144..0f21b6ff3 100644 --- a/src/mobility/random-direction-2d-mobility-model.cc +++ b/src/mobility/random-direction-2d-mobility-model.cc @@ -103,7 +103,7 @@ RandomDirection2dMobilityModelParameters::GetCurrent (void) g_speedVariable.IsDirty () || g_pauseVariable.IsDirty ()) { - parameters = Create (); + parameters = CreateObject (); g_bounds.ClearDirtyFlag (); g_speedVariable.ClearDirtyFlag (); g_pauseVariable.ClearDirtyFlag (); @@ -115,14 +115,12 @@ RandomDirection2dMobilityModelParameters::GetCurrent (void) RandomDirection2dMobilityModel::RandomDirection2dMobilityModel () : m_parameters (RandomDirection2dMobilityModelParameters::GetCurrent ()) { - SetInterfaceId (RandomDirection2dMobilityModel::iid); m_event = Simulator::ScheduleNow (&RandomDirection2dMobilityModel::Start, this); } RandomDirection2dMobilityModel::RandomDirection2dMobilityModel (Ptr parameters) : m_parameters (parameters) { - SetInterfaceId (RandomDirection2dMobilityModel::iid); m_event = Simulator::ScheduleNow (&RandomDirection2dMobilityModel::Start, this); } void diff --git a/src/mobility/random-position.cc b/src/mobility/random-position.cc index 2dab23144..56ebf36f3 100644 --- a/src/mobility/random-position.cc +++ b/src/mobility/random-position.cc @@ -69,7 +69,6 @@ const ClassId RandomDiscPosition::cid = RandomPosition::RandomPosition () { - Object::SetInterfaceId (RandomPosition::iid); } RandomPosition::~RandomPosition () diff --git a/src/mobility/random-walk-2d-mobility-model.cc b/src/mobility/random-walk-2d-mobility-model.cc index bf24e9003..342bfb150 100644 --- a/src/mobility/random-walk-2d-mobility-model.cc +++ b/src/mobility/random-walk-2d-mobility-model.cc @@ -126,7 +126,7 @@ RandomWalk2dMobilityModelParameters::GetCurrent (void) g_modeTime.IsDirty () || g_rectangle.IsDirty ()) { - parameters = Create (); + parameters = CreateObject (); } return parameters; } @@ -134,7 +134,6 @@ RandomWalk2dMobilityModelParameters::GetCurrent (void) RandomWalk2dMobilityModel::RandomWalk2dMobilityModel () : m_parameters (RandomWalk2dMobilityModelParameters::GetCurrent ()) { - SetInterfaceId (RandomWalk2dMobilityModel::iid); m_event = Simulator::ScheduleNow (&RandomWalk2dMobilityModel::Start, this); } diff --git a/src/mobility/random-waypoint-mobility-model.cc b/src/mobility/random-waypoint-mobility-model.cc index 01478cc6a..be5f43ada 100644 --- a/src/mobility/random-waypoint-mobility-model.cc +++ b/src/mobility/random-waypoint-mobility-model.cc @@ -96,7 +96,7 @@ RandomWaypointMobilityModelParameters::GetCurrent (void) g_pause.IsDirty () || g_speed.IsDirty ()) { - parameters = Create (); + parameters = CreateObject (); } return parameters; } diff --git a/src/mobility/static-mobility-model.cc b/src/mobility/static-mobility-model.cc index 6e39678df..1b7c18775 100644 --- a/src/mobility/static-mobility-model.cc +++ b/src/mobility/static-mobility-model.cc @@ -25,14 +25,10 @@ const ClassId StaticMobilityModel::cid = MakeClassId ("Stat MobilityModel::iid); StaticMobilityModel::StaticMobilityModel () -{ - SetInterfaceId (StaticMobilityModel::iid); -} +{} StaticMobilityModel::StaticMobilityModel (const Vector &position) : m_position (position) -{ - SetInterfaceId (StaticMobilityModel::iid); -} +{} StaticMobilityModel::~StaticMobilityModel () {} diff --git a/src/mobility/static-speed-mobility-model.cc b/src/mobility/static-speed-mobility-model.cc index 779aeae9a..49e764be1 100644 --- a/src/mobility/static-speed-mobility-model.cc +++ b/src/mobility/static-speed-mobility-model.cc @@ -30,20 +30,14 @@ const ClassId StaticSpeedMobilityModel::cid = 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 () {} diff --git a/src/node/channel.cc b/src/node/channel.cc index 740b8edec..dd60b06c4 100644 --- a/src/node/channel.cc +++ b/src/node/channel.cc @@ -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 () diff --git a/src/node/ipv4.cc b/src/node/ipv4.cc index b0e5f9349..0e51fdbe0 100644 --- a/src/node/ipv4.cc +++ b/src/node/ipv4.cc @@ -28,9 +28,7 @@ namespace ns3 { const InterfaceId Ipv4::iid = MakeInterfaceId ("Ipv4", Object::iid); Ipv4::Ipv4 () -{ - SetInterfaceId (Ipv4::iid); -} +{} Ipv4::~Ipv4 () {} diff --git a/src/node/net-device.cc b/src/node/net-device.cc index cf2a38977..a2142dcdf 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -47,7 +47,6 @@ NetDevice::NetDevice(Ptr node, const Address& addr) : m_isPointToPoint (false) { NS_LOG_FUNCTION; - SetInterfaceId (NetDevice::iid); m_node->AddDevice (this); } diff --git a/src/node/node.cc b/src/node/node.cc index 1ac13b522..43d2aa977 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -106,9 +106,8 @@ Node::Node(uint32_t sid) void Node::Construct (void) { - SetInterfaceId (Node::iid); m_id = NodeList::Add (this); - Ptr socketFactory = Create (); + Ptr socketFactory = CreateObject (); AddInterface (socketFactory); } diff --git a/src/node/packet-socket-factory.cc b/src/node/packet-socket-factory.cc index 74d74a8f4..2c417b37f 100644 --- a/src/node/packet-socket-factory.cc +++ b/src/node/packet-socket-factory.cc @@ -28,14 +28,12 @@ const InterfaceId PacketSocketFactory::iid = MakeInterfaceId ("Packet", SocketFactory::iid); PacketSocketFactory::PacketSocketFactory () -{ - SetInterfaceId (PacketSocketFactory::iid); -} +{} Ptr PacketSocketFactory::CreateSocket (void) { Ptr node = QueryInterface (Node::iid); - Ptr socket = Create (node); + Ptr socket = CreateObject (node); return socket; } } // namespace ns3 diff --git a/src/node/queue.cc b/src/node/queue.cc index 95811683f..5e3238290 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -106,7 +106,6 @@ Queue::Queue() : m_nTotalDroppedPackets(0) { NS_LOG_FUNCTION; - SetInterfaceId (Queue::iid); } Queue::~Queue() diff --git a/src/node/socket-factory.cc b/src/node/socket-factory.cc index d77cff2e1..ba6689f6d 100644 --- a/src/node/socket-factory.cc +++ b/src/node/socket-factory.cc @@ -25,8 +25,6 @@ namespace ns3 { const InterfaceId SocketFactory::iid = MakeInterfaceId ("SocketFactory", Object::iid); SocketFactory::SocketFactory () -{ - SetInterfaceId (SocketFactory::iid); -} +{} } // namespace ns3 diff --git a/src/node/udp.cc b/src/node/udp.cc index 911ab0330..a604ea698 100644 --- a/src/node/udp.cc +++ b/src/node/udp.cc @@ -25,8 +25,6 @@ namespace ns3 { const InterfaceId Udp::iid = MakeInterfaceId ("Udp", SocketFactory::iid); Udp::Udp () -{ - SetInterfaceId (Udp::iid); -} +{} } // namespace ns3 diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 8892af4bf..ad4eb3441 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -366,7 +366,7 @@ GlobalRouteManagerImpl::SelectRouterNodes () NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << node->GetId ()); - Ptr globalRouter = Create (); + Ptr globalRouter = CreateObject (); node->AddInterface (globalRouter); } } diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index 754724b4a..23f56ee6a 100644 --- a/src/routing/global-routing/global-router-interface.cc +++ b/src/routing/global-routing/global-router-interface.cc @@ -438,7 +438,6 @@ GlobalRouter::GlobalRouter () : m_LSAs() { NS_LOG_FUNCTION; - SetInterfaceId (GlobalRouter::iid); m_routerId.Set(GlobalRouteManager::AllocateRouterId ()); } diff --git a/src/routing/olsr/olsr-agent-impl.cc b/src/routing/olsr/olsr-agent-impl.cc index f0be4cd50..27f4c8c9f 100644 --- a/src/routing/olsr/olsr-agent-impl.cc +++ b/src/routing/olsr/olsr-agent-impl.cc @@ -161,9 +161,6 @@ AgentImpl::AgentImpl (Ptr node) 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 @@ void AgentImpl::Start () NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress); - m_routingTable = Create (m_ipv4, m_mainAddress); + m_routingTable = CreateObject (m_ipv4, m_mainAddress); // Add OLSR as routing protocol, with slightly lower priority than // static routing. m_ipv4->AddRoutingProtocol (m_routingTable, -10); diff --git a/tutorial/ipv4-bus-network.cc b/tutorial/ipv4-bus-network.cc index 898816c1b..fdb1af5e9 100644 --- a/tutorial/ipv4-bus-network.cc +++ b/tutorial/ipv4-bus-network.cc @@ -56,7 +56,7 @@ Ipv4BusNetwork::Ipv4BusNetwork ( for (uint32_t i = 0; i < n; ++i) { - Ptr node = Create (); + Ptr node = CreateObject (); uint32_t nd = CsmaIpv4Topology::AddIpv4CsmaNetDevice (node, m_channel, Mac48Address::Allocate ()); Ipv4Address address = Ipv4AddressGenerator::AllocateAddress (mask, diff --git a/tutorial/point-to-point-ipv4-topology.cc b/tutorial/point-to-point-ipv4-topology.cc index d508f84d5..54f84398f 100644 --- a/tutorial/point-to-point-ipv4-topology.cc +++ b/tutorial/point-to-point-ipv4-topology.cc @@ -33,7 +33,7 @@ PointToPointIpv4Topology::CreateChannel ( const DataRate& bps, const Time& delay) { - return Create (bps, delay); + return CreateObject (bps, delay); } uint32_t @@ -43,7 +43,7 @@ PointToPointIpv4Topology::AddNetDevice ( { NS_ASSERT (channel->GetNDevices () <= 1); - Ptr nd = Create (node); + Ptr nd = CreateObject (node); Ptr q = Queue::CreateDefault (); nd->AddQueue(q); diff --git a/tutorial/tutorial-bus-network.cc b/tutorial/tutorial-bus-network.cc index 7013eadbe..056d4c16d 100644 --- a/tutorial/tutorial-bus-network.cc +++ b/tutorial/tutorial-bus-network.cc @@ -41,11 +41,11 @@ main (int argc, char *argv[]) uint32_t port = 7; Ptr n0 = bus.GetNode (0); - Ptr client = Create (n0, "10.1.0.1", port, + Ptr client = CreateObject (n0, "10.1.0.1", port, 1, Seconds(1.), 1024); Ptr n1 = bus.GetNode (1); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/tutorial/tutorial-csma-echo-ascii-trace.cc b/tutorial/tutorial-csma-echo-ascii-trace.cc index e8f9f07cb..ce17a1753 100644 --- a/tutorial/tutorial-csma-echo-ascii-trace.cc +++ b/tutorial/tutorial-csma-echo-ascii-trace.cc @@ -39,10 +39,10 @@ main (int argc, char *argv[]) NS_LOG_INFO ("UDP Echo Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); Ptr lan = CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); @@ -66,10 +66,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, + Ptr client = CreateObject (n0, "10.1.1.2", port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/tutorial/tutorial-csma-echo-pcap-trace.cc b/tutorial/tutorial-csma-echo-pcap-trace.cc index 1e68275ac..f96388c2a 100644 --- a/tutorial/tutorial-csma-echo-pcap-trace.cc +++ b/tutorial/tutorial-csma-echo-pcap-trace.cc @@ -40,10 +40,10 @@ main (int argc, char *argv[]) NS_LOG_INFO ("UDP Echo Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); Ptr lan = CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); @@ -67,10 +67,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, + Ptr client = CreateObject (n0, "10.1.1.2", port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/tutorial/tutorial-csma-echo.cc b/tutorial/tutorial-csma-echo.cc index 972a753bb..7f5a678ad 100644 --- a/tutorial/tutorial-csma-echo.cc +++ b/tutorial/tutorial-csma-echo.cc @@ -38,10 +38,10 @@ main (int argc, char *argv[]) NS_LOG_INFO ("UDP Echo Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); Ptr lan = CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); @@ -65,10 +65,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, + Ptr client = CreateObject (n0, "10.1.1.2", port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/tutorial/tutorial-linear-dumbbell.cc b/tutorial/tutorial-linear-dumbbell.cc index c39abd963..59bef5b3b 100644 --- a/tutorial/tutorial-linear-dumbbell.cc +++ b/tutorial/tutorial-linear-dumbbell.cc @@ -56,10 +56,10 @@ main (int argc, char *argv[]) // // Create the lan on the left side of the dumbbell. // - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); Ptr lan1 = CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2)); @@ -83,10 +83,10 @@ main (int argc, char *argv[]) // // Create the lan on the right side of the dumbbell. // - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); - Ptr n7 = Create (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); + Ptr n7 = CreateObject (); Ptr lan2 = CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2)); @@ -124,19 +124,19 @@ main (int argc, char *argv[]) // uint16_t port = 7; - Ptr client0 = Create (n0, "10.1.2.1", port, + Ptr client0 = CreateObject (n0, "10.1.2.1", port, 100, Seconds(.01), 1024); - Ptr client1 = Create (n1, "10.1.2.2", port, + Ptr client1 = CreateObject (n1, "10.1.2.2", port, 100, Seconds(.01), 1024); - Ptr client2 = Create (n2, "10.1.2.3", port, + Ptr client2 = CreateObject (n2, "10.1.2.3", port, 100, Seconds(.01), 1024); - Ptr client3 = Create (n3, "10.1.2.4", port, + Ptr client3 = CreateObject (n3, "10.1.2.4", port, 100, Seconds(.01), 1024); - Ptr server4 = Create (n4, port); - Ptr server5 = Create (n5, port); - Ptr server6 = Create (n6, port); - Ptr server7 = Create (n7, port); + Ptr server4 = CreateObject (n4, port); + Ptr server5 = CreateObject (n5, port); + Ptr server6 = CreateObject (n6, port); + Ptr server7 = CreateObject (n7, port); server4->Start(Seconds(1.)); server5->Start(Seconds(1.)); diff --git a/tutorial/tutorial-point-to-point.cc b/tutorial/tutorial-point-to-point.cc index 30e1b02d7..8c42eded7 100644 --- a/tutorial/tutorial-point-to-point.cc +++ b/tutorial/tutorial-point-to-point.cc @@ -47,8 +47,8 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Point to Point Topology Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); Ptr link = PointToPointTopology::AddPointToPointLink ( n0, n1, DataRate (38400), MilliSeconds (20)); @@ -58,10 +58,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, + Ptr client = CreateObject (n0, "10.1.1.2", port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/tutorial/tutorial-star-routing.cc b/tutorial/tutorial-star-routing.cc index 765b3ee4c..e0a91cf14 100644 --- a/tutorial/tutorial-star-routing.cc +++ b/tutorial/tutorial-star-routing.cc @@ -51,13 +51,13 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Star Topology with Routing Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); Ptr link01 = PointToPointIpv4Topology::CreateChannel (DataRate (38400), @@ -145,10 +145,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n4, "10.1.1.2", port, + Ptr client = CreateObject (n4, "10.1.1.2", port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/tutorial/tutorial-star.cc b/tutorial/tutorial-star.cc index fbcccf5a9..073d7c6c9 100644 --- a/tutorial/tutorial-star.cc +++ b/tutorial/tutorial-star.cc @@ -51,13 +51,13 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Star Topology Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); Ptr link01 = PointToPointIpv4Topology::CreateChannel (DataRate (38400), @@ -145,10 +145,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, + Ptr client = CreateObject (n0, "10.1.1.2", port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); diff --git a/utils/bench-object.cc b/utils/bench-object.cc index 81d632dca..171611309 100644 --- a/utils/bench-object.cc +++ b/utils/bench-object.cc @@ -28,7 +28,7 @@ int main (int argc, char *argv[]) std::vector< Ptr > objlist; for (int i = 0; i < nobjects; ++i) - objlist.push_back (Create ()); + objlist.push_back (CreateObject ()); for (int swapCounter = nswaps; swapCounter; --swapCounter) { diff --git a/utils/mobility-generator.cc b/utils/mobility-generator.cc index 7c7a7159c..7cb62c2bf 100644 --- a/utils/mobility-generator.cc +++ b/utils/mobility-generator.cc @@ -45,7 +45,7 @@ int main (int argc, char *argv[]) uint32_t n = atoi (*argv + strlen ("--n=")); for (uint32_t i = 0; i < n; i++) { - Ptr notifier = Create (); + Ptr notifier = CreateObject (); notifier->RegisterListener (MakeCallback (&CourseChange)); objects.push_back (notifier); } diff --git a/utils/mobility-visualizer-model.cc b/utils/mobility-visualizer-model.cc index 8b48c6b69..81d621dd1 100644 --- a/utils/mobility-visualizer-model.cc +++ b/utils/mobility-visualizer-model.cc @@ -92,8 +92,8 @@ int model_init (int argc, char *argv[], double *x1, double *y1, double *x2, doub for (uint32_t i = 0; i < g_numNodes; i++) { - Ptr node = Create (); - node->AddInterface (Create ()); + Ptr node = CreateObject (); + node->AddInterface (CreateObject ()); } topology.Layout (NodeList::Begin (), NodeList::End ()); diff --git a/utils/print-introspected-doxygen.cc b/utils/print-introspected-doxygen.cc index ed9411535..971ff8a64 100644 --- a/utils/print-introspected-doxygen.cc +++ b/utils/print-introspected-doxygen.cc @@ -116,12 +116,12 @@ PrintDefaultValuesDoxygen (std::ostream &os) int main (int argc, char *argv[]) { - Ptr node = Create (); - node->AddInterface (Create ()); + Ptr node = CreateObject (); + node->AddInterface (CreateObject ()); - Ptr p2p = Create (node); + Ptr p2p = CreateObject (node); p2p->AddQueue (Queue::CreateDefault ()); - Ptr csma = Create (node); + Ptr csma = CreateObject (node); csma->AddQueue (Queue::CreateDefault ()); TraceResolver::SourceCollection collection;