diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index c63d30af3..7475fe02f 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -149,7 +149,7 @@ main (int argc, char *argv[]) // 512 bytes (default) at a rate of 500 Kb/s (default) from n0 NS_LOG_INFO ("Create Applications."); Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("255.255.255.255", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -162,7 +162,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n1, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); @@ -172,7 +172,7 @@ main (int argc, char *argv[]) sink->Stop (Seconds (10.0)); // Create an optional packet sink to receive these packets - sink = CreateObjectWith ( + sink = CreateObject ( "Node", n2, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index fa1a203e2..f6d3a18af 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -278,7 +278,7 @@ main (int argc, char *argv[]) // Configure a multicast packet generator that generates a packet // every few seconds Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress (multicastGroup, port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -297,7 +297,7 @@ main (int argc, char *argv[]) // If you enable logging on this (above) it will print a log statement // for every packet received Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n4, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index f661f62b1..076f1edd0 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -160,7 +160,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("10.1.1.2", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -176,7 +176,7 @@ main (int argc, char *argv[]) // // Create a similar flow from n3 to n0, starting at time 1.1 seconds // - ooff = CreateObjectWith ( + ooff = CreateObject ( "Node", n3, "Remote", Address (InetSocketAddress ("10.1.1.1", port)), "Protocol", TypeId::LookupByName ("Udp"), diff --git a/examples/csma-packet-socket.cc b/examples/csma-packet-socket.cc index 87bda6856..82c2ddb68 100644 --- a/examples/csma-packet-socket.cc +++ b/examples/csma-packet-socket.cc @@ -62,9 +62,9 @@ NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample"); static Ptr CreateCsmaDevice (Ptr node, Ptr channel) { - Ptr device = CreateObjectWith ("Node", node, - "Address", Mac48Address::Allocate (), - "EncapsulationMode", String ("Llc")); + Ptr device = CreateObject ("Node", node, + "Address", Mac48Address::Allocate (), + "EncapsulationMode", String ("Llc")); node->AddDevice (device); device->Attach (channel); Ptr queue = CreateObject (); @@ -114,7 +114,8 @@ main (int argc, char *argv[]) // create the shared medium used by all csma devices. NS_LOG_INFO ("Create channels."); - Ptr channel = CreateObject (DataRate(5000000), MilliSeconds(2)); + Ptr channel = CreateObject ("BitRate", DataRate(5000000), + "Delay", MilliSeconds(2)); // use a helper function to connect our nodes to the shared channel. NS_LOG_INFO ("Build Topology."); @@ -140,7 +141,7 @@ main (int argc, char *argv[]) // from n0 to n1 NS_LOG_INFO ("Create Applications."); Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (n0ToN1), "Protocol", TypeId::LookupByName ("Packet"), @@ -152,7 +153,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 = CreateObjectWith ( + ooff = CreateObject ( "Node", n3, "Remote", Address (n3ToN0), "Protocol", TypeId::LookupByName ("Packet"), diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index 742e9dd47..fa63f8ac5 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -186,7 +186,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("10.1.3.2", port)), "Protocol", TypeId::LookupByName ("Udp"), diff --git a/examples/simple-alternate-routing.cc b/examples/simple-alternate-routing.cc index 203603559..f9a3a1bc3 100644 --- a/examples/simple-alternate-routing.cc +++ b/examples/simple-alternate-routing.cc @@ -183,7 +183,7 @@ main (int argc, char *argv[]) // Create a flow from n3 to n1, starting at time 1.1 seconds Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n3, "Remote", Address (InetSocketAddress ("10.1.1.1", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -196,7 +196,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n1, "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); diff --git a/examples/simple-error-model.cc b/examples/simple-error-model.cc index 3c688f3ad..b73b4c7a1 100644 --- a/examples/simple-error-model.cc +++ b/examples/simple-error-model.cc @@ -143,7 +143,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("10.1.3.2", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -155,7 +155,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create an optional packet sink to receive these packets - Ptr sink = CreateObjectWith ( + Ptr sink = CreateObject ( "Node", n3, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); @@ -165,7 +165,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 = CreateObjectWith ( + ooff = CreateObject ( "Node", n3, "Remote", Address (InetSocketAddress ("10.1.2.1", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -177,7 +177,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(10.0)); // Create a packet sink to receive these packets - sink = CreateObjectWith ( + sink = CreateObject ( "Node", n1, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); @@ -205,7 +205,7 @@ main (int argc, char *argv[]) (n3, channel2); // Create an ErrorModel based on the implementation (constructor) // specified by the default classId - Ptr em = CreateObjectWith ("RanVar", UniformVariable (0.0, 1.0), + Ptr em = CreateObject ("RanVar", UniformVariable (0.0, 1.0), "Rate", Double (0.001)); nd3->AddReceiveErrorModel (em); diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 8d591a6cb..40693f41c 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -160,7 +160,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "Remote", Address (InetSocketAddress ("10.1.3.2", port)), "Protocol", TypeId::LookupByName ("Udp"), "OnTime", ConstantVariable (1), @@ -173,7 +173,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 = - CreateObjectWith ("Node", n3, + CreateObject ("Node", n3, "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); n3->AddApplication (sink); @@ -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 = CreateObjectWith ( + ooff = CreateObject ( "Node", n3, "Remote", Address (InetSocketAddress ("10.1.2.1", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -194,7 +194,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds (10.0)); // Create a packet sink to receive these packets - sink = CreateObjectWith ("Node", n1, + sink = CreateObject ("Node", n1, "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); n1->AddApplication (sink); diff --git a/examples/simple-point-to-point-olsr.cc b/examples/simple-point-to-point-olsr.cc index a5756a793..998ca406d 100644 --- a/examples/simple-point-to-point-olsr.cc +++ b/examples/simple-point-to-point-olsr.cc @@ -167,7 +167,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("10.1.4.2", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -179,7 +179,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n4, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); @@ -188,7 +188,7 @@ main (int argc, char *argv[]) sink->Start (Seconds (1.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds - ooff = CreateObjectWith ( + ooff = CreateObject ( "Node", n4, "Remote", Address (InetSocketAddress ("10.1.2.1", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -199,7 +199,7 @@ main (int argc, char *argv[]) ooff->Start (Seconds(1.1)); // Create a packet sink to receive these packets - sink = CreateObjectWith ( + sink = CreateObject ( "Node", n1, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 46c8801f4..39f90ac0c 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -136,7 +136,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObjectWith ( + CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("10.1.3.2", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -148,7 +148,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n3, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); @@ -157,7 +157,7 @@ main (int argc, char *argv[]) sink->Start (Seconds (1.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds - ooff = CreateObjectWith ( + ooff = CreateObject ( "Node", n3, "Remote", Address (InetSocketAddress ("10.1.2.1", port)), "Protocol", TypeId::LookupByName ("Udp"), @@ -168,7 +168,7 @@ main (int argc, char *argv[]) ooff->Start(Seconds(1.1)); // Create a packet sink to receive these packets - sink = CreateObjectWith ( + sink = CreateObject ( "Node", n1, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); @@ -180,7 +180,7 @@ main (int argc, char *argv[]) // Create a file transfer from n0 to n3, starting at time 1.2 uint16_t servPort = 500; - ooff = CreateObjectWith ( + ooff = CreateObject ( "Node", n0, "Remote", Address (InetSocketAddress ("10.1.3.2", servPort)), "Protocol", TypeId::LookupByName ("Tcp"), @@ -192,7 +192,7 @@ main (int argc, char *argv[]) ooff->Stop (Seconds(1.35)); // Create a packet sink to receive these TCP packets - sink = CreateObjectWith ( + sink = CreateObject ( "Node", n3, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), "Protocol", TypeId::LookupByName ("Tcp")); diff --git a/examples/tcp-large-transfer-errors.cc b/examples/tcp-large-transfer-errors.cc index f0fbbbf6d..17e69d612 100644 --- a/examples/tcp-large-transfer-errors.cc +++ b/examples/tcp-large-transfer-errors.cc @@ -198,7 +198,7 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n2, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), "Protocol", TypeId::LookupByName ("Tcp")); diff --git a/examples/tcp-large-transfer.cc b/examples/tcp-large-transfer.cc index 004af1599..3a4021d23 100644 --- a/examples/tcp-large-transfer.cc +++ b/examples/tcp-large-transfer.cc @@ -198,7 +198,7 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n2, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), "Protocol", TypeId::LookupByName ("Tcp")); diff --git a/examples/tcp-small-transfer-oneloss.cc b/examples/tcp-small-transfer-oneloss.cc index aab8ca3e7..60020d137 100644 --- a/examples/tcp-small-transfer-oneloss.cc +++ b/examples/tcp-small-transfer-oneloss.cc @@ -180,7 +180,7 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n2, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), "Protocol", TypeId::LookupByName ("Tcp")); diff --git a/examples/tcp-small-transfer.cc b/examples/tcp-small-transfer.cc index d86aa72d8..8efed8d11 100644 --- a/examples/tcp-small-transfer.cc +++ b/examples/tcp-small-transfer.cc @@ -190,7 +190,7 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObjectWith ( + CreateObject ( "Node", n2, "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), "Protocol", TypeId::LookupByName ("Tcp")); diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 43f55cefb..2700bf45b 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -161,7 +161,7 @@ main (int argc, char *argv[]) // uint16_t port = 9; // well-known echo port number - Ptr server = CreateObjectWith ("Node", n1, + Ptr server = CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); // @@ -173,7 +173,7 @@ main (int argc, char *argv[]) Time interPacketInterval = Seconds (1.); Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (maxPacketCount), diff --git a/samples/main-adhoc-wifi.cc b/samples/main-adhoc-wifi.cc index 89f8c1c3a..32a23526c 100644 --- a/samples/main-adhoc-wifi.cc +++ b/samples/main-adhoc-wifi.cc @@ -136,7 +136,7 @@ Experiment::Run (const WifiHelper &wifi) NetDeviceContainer devices = wifi.Build (c); MobilityHelper mobility; - Ptr positionAlloc = CreateObjectWith (); + Ptr positionAlloc = CreateObject (); positionAlloc->Add (Vector (0.0, 0.0, 0.0)); positionAlloc->Add (Vector (5.0, 0.0, 0.0)); mobility.SetPositionAllocator (positionAlloc); @@ -149,7 +149,7 @@ Experiment::Run (const WifiHelper &wifi) destination.SetSingleDevice (0); destination.SetPhysicalAddress (devices.Get (1)->GetAddress ()); Ptr app = - CreateObjectWith ("Node", c.Get (0), + CreateObject ("Node", c.Get (0), "Remote", Address (destination), "Protocol", TypeId::LookupByName ("Packet"), "OnTime", ConstantVariable (250), diff --git a/samples/main-ap-wifi.cc b/samples/main-ap-wifi.cc index 5dc54d506..61cdbc8e5 100644 --- a/samples/main-ap-wifi.cc +++ b/samples/main-ap-wifi.cc @@ -144,7 +144,7 @@ int main (int argc, char *argv[]) destination.SetSingleDevice (0); destination.SetPhysicalAddress (staDevs.Get(1)->GetAddress ()); Ptr app = - CreateObjectWith ("Node", stas.Get (0), + CreateObject ("Node", stas.Get (0), "Remote", Address (destination), "Protocol", TypeId::LookupByName ("Packet"), "OnTime", ConstantVariable (42), diff --git a/samples/main-propagation-loss.cc b/samples/main-propagation-loss.cc index 487495988..0972153b0 100644 --- a/samples/main-propagation-loss.cc +++ b/samples/main-propagation-loss.cc @@ -29,8 +29,8 @@ PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, { Ptr a = CreateObject (); Ptr b = CreateObject (); - Ptr log = CreateObjectWith (); - log->SetReferenceModel (CreateObjectWith ()); + Ptr log = CreateObject (); + log->SetReferenceModel (CreateObject ()); Ptr model = log; diff --git a/src/core/attribute-test.cc b/src/core/attribute-test.cc index 780af44ca..6a7a280fd 100644 --- a/src/core/attribute-test.cc +++ b/src/core/attribute-test.cc @@ -272,11 +272,11 @@ AttributeTest::RunTests (void) CHECK_GET_STR (p, "TestBoolName", "false"); CHECK_GET_PARAM (p, "TestBoolName", Boolean, false); - p = CreateObjectWith ("TestBoolName", String ("true")); + p = CreateObject ("TestBoolName", String ("true")); CHECK_GET_STR (p, "TestBoolName", "true"); CHECK_GET_PARAM (p, "TestBoolName", Boolean, true); - p = CreateObjectWith ("TestBoolName", Boolean (true)); + p = CreateObject ("TestBoolName", Boolean (true)); CHECK_GET_STR (p, "TestBoolName", "true"); CHECK_GET_PARAM (p, "TestBoolName", Boolean, true); @@ -300,7 +300,7 @@ AttributeTest::RunTests (void) Ptr x = p->GetAttribute ("TestPtr"); NS_TEST_ASSERT (x == 0); - p = CreateObjectWith ("TestPtr", Create ()); + p = CreateObject ("TestPtr", Create ()); NS_TEST_ASSERT (p != 0); derived = 0; derived = p->GetAttribute ("TestPtr"); @@ -428,12 +428,12 @@ AttributeTest::RunTests (void) } NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("AttributeObjectTest::TestBoolName", String ("true"))); - p = CreateObjectWith (); + p = CreateObject (); Boolean boolV = p->GetAttribute ("TestBoolName"); NS_TEST_ASSERT_EQUAL (boolV, Boolean (true)); NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("AttributeObjectTest::TestBoolName", String ("false"))); - p = CreateObjectWith (); + p = CreateObject (); boolV = p->GetAttribute ("TestBoolName"); NS_TEST_ASSERT_EQUAL (boolV, Boolean (false)); diff --git a/src/core/object.h b/src/core/object.h index 3016d1e74..be5c1a785 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -507,24 +507,6 @@ private: template friend Ptr CreateObject (const AttributeList &attributes); - 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); - - bool DoSet (Ptr spec, Attribute intialValue, Ptr checker, Attribute value); Ptr DoGetObject (TypeId tid) const; @@ -670,85 +652,18 @@ Ptr CreateObject (const AttributeList &attributes) return p; } -template -Ptr CreateObject (void) -{ - Ptr p = Ptr (new T (), false); - p->SetTypeId (T::GetTypeId ()); - p->Object::Construct (AttributeList ()); - return p; -} - -template -Ptr CreateObject (T1 a1) -{ - Ptr p = Ptr (new T (a1), false); - p->SetTypeId (T::GetTypeId ()); - p->Object::Construct (AttributeList ()); - return p; -} - -template -Ptr CreateObject (T1 a1, T2 a2) -{ - Ptr p = Ptr (new T (a1, a2), false); - p->SetTypeId (T::GetTypeId ()); - p->Object::Construct (AttributeList ()); - return p; -} -template -Ptr CreateObject (T1 a1, T2 a2, T3 a3) -{ - Ptr p = Ptr (new T (a1, a2, a3), false); - p->SetTypeId (T::GetTypeId ()); - return p; -} - -template -Ptr CreateObject (T1 a1, T2 a2, T3 a3, T4 a4) -{ - Ptr p = Ptr (new T (a1, a2, a3, a4), false); - p->SetTypeId (T::GetTypeId ()); - 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->SetTypeId (T::GetTypeId ()); - 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->SetTypeId (T::GetTypeId ()); - 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->SetTypeId (T::GetTypeId ()); - return p; -} - - template Ptr -CreateObjectWith (std::string n1 = "", Attribute v1 = Attribute (), - std::string n2 = "", Attribute v2 = Attribute (), - std::string n3 = "", Attribute v3 = Attribute (), - std::string n4 = "", Attribute v4 = Attribute (), - std::string n5 = "", Attribute v5 = Attribute (), - std::string n6 = "", Attribute v6 = Attribute (), - std::string n7 = "", Attribute v7 = Attribute (), - std::string n8 = "", Attribute v8 = Attribute (), - std::string n9 = "", Attribute v9 = Attribute ()) - +CreateObject (std::string n1 = "", Attribute v1 = Attribute (), + std::string n2 = "", Attribute v2 = Attribute (), + std::string n3 = "", Attribute v3 = Attribute (), + std::string n4 = "", Attribute v4 = Attribute (), + std::string n5 = "", Attribute v5 = Attribute (), + std::string n6 = "", Attribute v6 = Attribute (), + std::string n7 = "", Attribute v7 = Attribute (), + std::string n8 = "", Attribute v8 = Attribute (), + std::string n9 = "", Attribute v9 = Attribute ()) + { AttributeList attributes; if (n1 == "") diff --git a/src/devices/csma/csma-channel.cc b/src/devices/csma/csma-channel.cc index 185d7b8ab..5d51c15a3 100644 --- a/src/devices/csma/csma-channel.cc +++ b/src/devices/csma/csma-channel.cc @@ -45,48 +45,32 @@ CsmaDeviceRec::IsActive() { return active; } +TypeId +CsmaChannel::GetTypeId (void) +{ + static TypeId tid = TypeId ("CsmaChannel") + .SetParent () + .AddConstructor () + .AddAttribute ("BitRate", "The maximum bitrate of the channel", + DataRate (0xffffffff), + MakeDataRateAccessor (&CsmaChannel::m_bps), + MakeDataRateChecker ()) + .AddAttribute ("Delay", "Transmission delay through the channel", + Seconds (0), + MakeTimeAccessor (&CsmaChannel::m_delay), + MakeTimeChecker ()) + ; + return tid; +} // // By default, you get a channel with the name "Csma Channel" that // has an "infitely" fast transmission speed and zero delay. CsmaChannel::CsmaChannel() : - Channel ("Csma Channel"), - m_bps (DataRate(0xffffffff)), - m_delay (Seconds(0)) + Channel ("Csma Channel") { NS_LOG_FUNCTION; - Init(); -} - -CsmaChannel::CsmaChannel( - const DataRate& bps, - const Time& delay) -: - Channel ("Csma Channel"), - m_bps (bps), - m_delay (delay) -{ - NS_LOG_FUNCTION; - NS_LOG_PARAMS (this << Channel::GetName() << bps.GetBitRate() << delay); - Init(); -} - -CsmaChannel::CsmaChannel( - const std::string& name, - const DataRate& bps, - const Time& delay) -: - Channel (name), - m_bps (bps), - m_delay (delay) -{ - NS_LOG_FUNCTION; - NS_LOG_PARAMS (this << name << bps.GetBitRate() << delay); - Init(); -} - -void CsmaChannel::Init() { m_state = IDLE; m_deviceList.clear(); } diff --git a/src/devices/csma/csma-channel.h b/src/devices/csma/csma-channel.h index 5ad34f4fd..6e6c0846e 100644 --- a/src/devices/csma/csma-channel.h +++ b/src/devices/csma/csma-channel.h @@ -85,8 +85,10 @@ class CsmaNetDevice; * packet to the channel is really connected to this channel * */ -class CsmaChannel : public Channel { +class CsmaChannel : public Channel +{ public: + static TypeId GetTypeId (void); /** * \brief Create a CsmaChannel * @@ -94,24 +96,6 @@ public: * has an "infitely" fast transmission speed and zero delay. */ CsmaChannel (); - - /** - * \brief Create a CsmaChannel - * - * \param bps The bitrate of the channel - * \param delay Transmission delay through the channel - */ - CsmaChannel (const DataRate& bps, const Time& delay); - - /** - * \brief Create a CsmaChannel - * - * \param name the name of the channel for identification purposes - * \param bps The bitrate of the channel - * \param delay Transmission delay through the channel - */ - CsmaChannel (const std::string& name, - const DataRate& bps, const Time& delay); /** * \brief Attach a given netdevice to this channel @@ -298,11 +282,6 @@ private: * Current state of the channel */ WireState m_state; - /** - * Initializes the channel when it is constructed. Resets the - * deviceList and sets the channel state to IDLE. - */ - void Init (void); }; } // namespace ns3 diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index de9e38c31..4c0db9e9d 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -41,10 +41,10 @@ CsmaIpv4Topology::AddIpv4CsmaNetDevice( Ptr channel, Mac48Address addr) { - Ptr q = CreateObjectWith (); + Ptr q = CreateObject (); // assume full-duplex - Ptr nd = CreateObjectWith ("Node", node, + Ptr nd = CreateObject ("Node", node, "Address", addr, "EncapsulationMode", String ("IpArp")); node->AddDevice (nd); @@ -60,9 +60,9 @@ CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, Ptr ch, Mac48Address addr) { - Ptr q = CreateObjectWith (); + Ptr q = CreateObject (); - Ptr nd0 = CreateObjectWith ("Node", n1, + Ptr nd0 = CreateObject ("Node", n1, "Address", addr, "EncapsulationMode", String ("Llc")); n1->AddDevice (nd0); @@ -71,7 +71,7 @@ CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, nd0->AddQueue(q); nd0->Attach (ch); - Ptr nd1 = CreateObjectWith ("Node", n1, + Ptr nd1 = CreateObject ("Node", n1, "Address", addr, "EncapsulationMode", String ("Llc")); n1->AddDevice (nd1); @@ -86,9 +86,9 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, Ptr ch, Mac48Address addr) { - Ptr q = CreateObjectWith (); + Ptr q = CreateObject (); - Ptr nd0 = CreateObjectWith ("Node", n1, + Ptr nd0 = CreateObject ("Node", n1, "Address", addr, "EncapsulationMode", String ("Raw")); n1->AddDevice (nd0); @@ -97,7 +97,7 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, nd0->AddQueue(q); nd0->Attach (ch); - Ptr nd1 = CreateObjectWith ("Node", n1, + Ptr nd1 = CreateObject ("Node", n1, "Address", addr, "EncapsulationMode", String ("Raw")); n1->AddDevice (nd1); diff --git a/src/devices/csma/csma-topology.cc b/src/devices/csma/csma-topology.cc index 9892a55d1..2d5547d24 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 = CreateObject (bps, delay); + Ptr channel = CreateObject ("BitRate", bps, "Delay", delay); return channel; } @@ -48,7 +48,7 @@ CsmaTopology::AddCsmaEthernetNode( Ptr ch, Mac48Address addr) { - Ptr nd1 = CreateObjectWith ("Node", Ptr (n1), + Ptr nd1 = CreateObject ("Node", Ptr (n1), "Address", addr, "EncapsulationMode", "EthernetV1"); diff --git a/src/devices/point-to-point/point-to-point-channel.cc b/src/devices/point-to-point/point-to-point-channel.cc index d8018af1c..8a9c5a68c 100644 --- a/src/devices/point-to-point/point-to-point-channel.cc +++ b/src/devices/point-to-point/point-to-point-channel.cc @@ -29,46 +29,35 @@ NS_LOG_COMPONENT_DEFINE ("PointToPointChannel"); namespace ns3 { +TypeId +PointToPointChannel::GetTypeId (void) +{ + static TypeId tid = TypeId ("PointToPointChannel") + .SetParent () + .AddConstructor () + .AddAttribute ("BitRate", "The maximum bitrate of the channel", + DataRate (0xffffffff), + MakeDataRateAccessor (&PointToPointChannel::m_bps), + MakeDataRateChecker ()) + .AddAttribute ("Delay", "Transmission delay through the channel", + Seconds (0), + MakeTimeAccessor (&PointToPointChannel::m_delay), + MakeTimeChecker ()) + ; + return tid; +} + // // By default, you get a channel with the name "PointToPoint Channel" that // has an "infitely" fast transmission speed and zero delay. PointToPointChannel::PointToPointChannel() : Channel ("PointToPoint Channel"), - m_bps (DataRate(0xffffffff)), - m_delay (Seconds(0)), m_nDevices(0) { NS_LOG_FUNCTION; } -PointToPointChannel::PointToPointChannel( - const DataRate& bps, - const Time& delay) -: - Channel ("PointToPoint Channel"), - m_bps (bps), - m_delay (delay), - m_nDevices(0) -{ - NS_LOG_FUNCTION; - NS_LOG_PARAMS (this << Channel::GetName() << bps.GetBitRate() << delay); -} - -PointToPointChannel::PointToPointChannel( - const std::string& name, - const DataRate& bps, - const Time& delay) -: - Channel (name), - m_bps (bps), - m_delay (delay), - m_nDevices(0) -{ - NS_LOG_FUNCTION; - NS_LOG_PARAMS (this << name << bps.GetBitRate() << delay); -} - void PointToPointChannel::Attach(Ptr device) { diff --git a/src/devices/point-to-point/point-to-point-channel.h b/src/devices/point-to-point/point-to-point-channel.h index 8fe9d27a0..1b339cc63 100644 --- a/src/devices/point-to-point/point-to-point-channel.h +++ b/src/devices/point-to-point/point-to-point-channel.h @@ -49,8 +49,11 @@ class Packet; * [0] wire to transmit on. The second device gets the [1] wire. There is a * state (IDLE, TRANSMITTING) associated with each wire. */ -class PointToPointChannel : public Channel { +class PointToPointChannel : public Channel +{ public: + static TypeId GetTypeId (void); + /** * \brief Create a PointToPointChannel * @@ -58,24 +61,6 @@ public: * has an "infitely" fast transmission speed and zero delay. */ PointToPointChannel (); - - /** - * \brief Create a PointToPointChannel - * - * \param bps The maximum bitrate of the channel - * \param delay Transmission delay through the channel - */ - PointToPointChannel (const DataRate& bps, const Time& delay); - - /** - * \brief Create a PointToPointChannel - * - * \param name the name of the channel for identification purposes - * \param bps The maximum bitrate of the channel - * \param delay Transmission delay through the channel - */ - PointToPointChannel (const std::string& name, - const DataRate& bps, const Time& delay); /** * \brief Attach a given netdevice to this channel 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 cbb2f6ec5..877d0789f 100644 --- a/src/devices/point-to-point/point-to-point-topology.cc +++ b/src/devices/point-to-point/point-to-point-topology.cc @@ -46,21 +46,21 @@ PointToPointTopology::AddPointToPointLink( const DataRate& bps, const Time& delay) { - Ptr channel = CreateObject (bps, delay); + Ptr channel = CreateObject ("BitRate", bps, "Delay", delay); - Ptr net1 = CreateObjectWith ("Node", n1, - "Address", Mac48Address::Allocate ()); + Ptr net1 = CreateObject ("Node", n1, + "Address", Mac48Address::Allocate ()); n1->AddDevice (net1); - Ptr q = CreateObjectWith (); + Ptr q = CreateObject (); net1->AddQueue(q); net1->Attach (channel); - Ptr net2 = CreateObjectWith ("Node", n2, - "Address", Mac48Address::Allocate ()); + Ptr net2 = CreateObject ("Node", n2, + "Address", Mac48Address::Allocate ()); n2->AddDevice (net2); - q = CreateObjectWith (); + q = CreateObject (); net2->AddQueue(q); net2->Attach (channel); diff --git a/src/devices/wifi/adhoc-wifi-mac.cc b/src/devices/wifi/adhoc-wifi-mac.cc index 310d89d41..85dcf7646 100644 --- a/src/devices/wifi/adhoc-wifi-mac.cc +++ b/src/devices/wifi/adhoc-wifi-mac.cc @@ -48,7 +48,7 @@ AdhocWifiMac::AdhocWifiMac () m_rxMiddle = new MacRxMiddle (); m_rxMiddle->SetForwardCallback (MakeCallback (&AdhocWifiMac::ForwardUp, this)); - m_low = CreateObjectWith (); + m_low = CreateObject (); m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); m_low->SetMac (this); diff --git a/src/devices/wifi/dca-txop.cc b/src/devices/wifi/dca-txop.cc index b77a6c614..47c1b4fd8 100644 --- a/src/devices/wifi/dca-txop.cc +++ b/src/devices/wifi/dca-txop.cc @@ -132,7 +132,7 @@ DcaTxop::DcaTxop () { m_transmissionListener = new DcaTxop::TransmissionListener (this); m_dcf = new DcaTxop::Dcf (this); - m_queue = CreateObjectWith (); + m_queue = CreateObject (); m_rng = new RealRandomStream (); m_txMiddle = new MacTxMiddle (); } diff --git a/src/devices/wifi/propagation-loss-model.cc b/src/devices/wifi/propagation-loss-model.cc index e583af025..0ff409b6a 100644 --- a/src/devices/wifi/propagation-loss-model.cc +++ b/src/devices/wifi/propagation-loss-model.cc @@ -252,10 +252,10 @@ LogDistancePropagationLossModel::GetRxPower (double txPowerDbm, * rx = rx0(tx) - 10 * n * log (d/d0) */ static Ptr zero = - CreateObjectWith ("position", + CreateObject ("position", Vector (0.0, 0.0, 0.0)); static Ptr reference = - CreateObjectWith ("position", + CreateObject ("position", Vector (m_referenceDistance, 0.0, 0.0)); double rx0 = m_reference->GetRxPower (txPowerDbm, zero, reference); double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance); diff --git a/src/devices/wifi/wifi-helper.cc b/src/devices/wifi/wifi-helper.cc index 1334a1a0e..589d9643c 100644 --- a/src/devices/wifi/wifi-helper.cc +++ b/src/devices/wifi/wifi-helper.cc @@ -92,10 +92,10 @@ WifiHelper::SetPhy (std::string type, NetDeviceContainer WifiHelper::Build (NodeContainer c) const { - Ptr channel = CreateObjectWith (); - channel->SetPropagationDelayModel (CreateObjectWith ()); - Ptr log = CreateObjectWith (); - log->SetReferenceModel (CreateObjectWith ()); + Ptr channel = CreateObject (); + channel->SetPropagationDelayModel (CreateObject ()); + Ptr log = CreateObject (); + log->SetReferenceModel (CreateObject ()); channel->SetPropagationLossModel (log); return Build (c, channel); } diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index 7596ed50a..c40ad37fa 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -34,9 +34,7 @@ NS_LOG_COMPONENT_DEFINE ("ArpIpv4Interface"); namespace ns3 { -ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) - : Ipv4Interface (device), - m_node (node) +ArpIpv4Interface::ArpIpv4Interface () { NS_LOG_FUNCTION; } @@ -46,6 +44,30 @@ ArpIpv4Interface::~ArpIpv4Interface () NS_LOG_FUNCTION; } +void +ArpIpv4Interface::DoDispose (void) +{ + m_node = 0; + m_device = 0; +} + +void +ArpIpv4Interface::SetNode (Ptr node) +{ + m_node = node; +} +void +ArpIpv4Interface::SetDevice (Ptr device) +{ + m_device = device; +} + +Ptr +ArpIpv4Interface::GetDevice (void) const +{ + return m_device; +} + void ArpIpv4Interface::SendTo (Ptr p, Ipv4Address dest) { diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index 9896731aa..35a503cfe 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -39,12 +39,19 @@ class Node; class ArpIpv4Interface : public Ipv4Interface { public: - ArpIpv4Interface (Ptr node, Ptr device); + ArpIpv4Interface (); virtual ~ArpIpv4Interface (); + void SetNode (Ptr node); + void SetDevice (Ptr device); + + virtual Ptr GetDevice (void) const; + private: virtual void SendTo (Ptr p, Ipv4Address dest); + virtual void DoDispose (void); Ptr m_node; + Ptr m_device; }; }//namespace ns3 diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 64b0972f1..05b3d4f26 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -42,11 +42,6 @@ ArpL3Protocol::GetTypeId (void) { static TypeId tid = TypeId ("ArpL3Protocol") .SetParent () - .AddAttribute ("Node", "The node to which this protocol is associated.", - TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT, - Ptr (0), - MakePtrAccessor (&ArpL3Protocol::m_node), - MakePtrChecker ()) ; return tid; } @@ -61,6 +56,12 @@ ArpL3Protocol::~ArpL3Protocol () NS_LOG_FUNCTION; } +void +ArpL3Protocol::SetNode (Ptr node) +{ + m_node = node; +} + void ArpL3Protocol::DoDispose (void) { diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index 0c86a5bb6..85ad98de0 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -47,6 +47,9 @@ public: */ ArpL3Protocol (); virtual ~ArpL3Protocol (); + + void SetNode (Ptr node); + /** * \brief Recieve a packet */ diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index cfe872bc4..d91504336 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -52,8 +52,10 @@ InternetNode::~InternetNode () void InternetNode::Construct (void) { - Ptr ipv4 = CreateObjectWith ("Node", Ptr (this)); - Ptr arp = CreateObjectWith ("Node", Ptr (this)); + Ptr ipv4 = CreateObject (); + Ptr arp = CreateObject (); + ipv4->SetNode (this); + arp->SetNode (this); // XXX remove the PeekPointer below. RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, PeekPointer (ipv4)), Ipv4L3Protocol::PROT_NUMBER, 0); @@ -61,16 +63,24 @@ InternetNode::Construct (void) ArpL3Protocol::PROT_NUMBER, 0); - Ptr ipv4L4Demux = CreateObjectWith ("Node", Ptr (this)); - Ptr udp = CreateObjectWith ("Node", Ptr (this)); - Ptr tcp = CreateObjectWith ("Node", Ptr (this)); + Ptr ipv4L4Demux = CreateObject (); + Ptr udp = CreateObject (); + Ptr tcp = CreateObject (); + + ipv4L4Demux->SetNode (this); + udp->SetNode (this); + tcp->SetNode (this); ipv4L4Demux->Insert (udp); ipv4L4Demux->Insert (tcp); - Ptr udpImpl = CreateObject (udp); - Ptr tcpImpl = CreateObject (tcp); - Ptr ipv4Impl = CreateObject (ipv4); + Ptr udpImpl = CreateObject (); + Ptr tcpImpl = CreateObject (); + Ptr ipv4Impl = CreateObject (); + + udpImpl->SetUdp (udp); + tcpImpl->SetTcp (tcp); + ipv4Impl->SetIpv4 (ipv4); Object::AggregateObject (ipv4); Object::AggregateObject (arp); diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index bff1bfd0b..174492bd0 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -26,14 +26,19 @@ namespace ns3 { -Ipv4Impl::Ipv4Impl (Ptr ipv4) - : m_ipv4 (ipv4) +Ipv4Impl::Ipv4Impl () + : m_ipv4 (0) {} Ipv4Impl::~Ipv4Impl () { NS_ASSERT (m_ipv4 == 0); } void +Ipv4Impl::SetIpv4 (Ptr ipv4) +{ + m_ipv4 = ipv4; +} +void Ipv4Impl::DoDispose (void) { m_ipv4 = 0; diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index 0494c7c0a..7e2a0eb04 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -31,10 +31,12 @@ class Ipv4L3Protocol; class Ipv4Impl : public Ipv4 { public: - Ipv4Impl (Ptr ipv4); + Ipv4Impl (); virtual ~Ipv4Impl (); + void SetIpv4 (Ptr ipv4); + virtual void AddRoutingProtocol (Ptr routingProtocol, int16_t priority); diff --git a/src/internet-node/ipv4-interface.cc b/src/internet-node/ipv4-interface.cc index e016912f0..11cd674df 100644 --- a/src/internet-node/ipv4-interface.cc +++ b/src/internet-node/ipv4-interface.cc @@ -35,13 +35,12 @@ namespace ns3 { * becoming useable, the user must invoke SetUp on them * once the final Ipv4 address and mask has been set. */ -Ipv4Interface::Ipv4Interface (Ptr nd) - : m_netdevice (nd), - m_ifup(false), +Ipv4Interface::Ipv4Interface () + : m_ifup(false), m_metric(1) { NS_LOG_FUNCTION; - NS_LOG_PARAMS (this << &nd); + NS_LOG_PARAMS (this); } Ipv4Interface::~Ipv4Interface () @@ -53,17 +52,9 @@ void Ipv4Interface::DoDispose (void) { NS_LOG_FUNCTION; - m_netdevice = 0; Object::DoDispose (); } -Ptr -Ipv4Interface::GetDevice (void) const -{ - NS_LOG_FUNCTION; - return m_netdevice; -} - void Ipv4Interface::SetAddress (Ipv4Address a) { @@ -123,12 +114,12 @@ uint16_t Ipv4Interface::GetMtu (void) const { NS_LOG_FUNCTION; - if (m_netdevice == 0) + if (GetDevice () == 0) { uint32_t mtu = (1<<16) - 1; return mtu; } - return m_netdevice->GetMtu (); + return GetDevice ()->GetMtu (); } /** diff --git a/src/internet-node/ipv4-interface.h b/src/internet-node/ipv4-interface.h index 3114a05d8..6cfc7b749 100644 --- a/src/internet-node/ipv4-interface.h +++ b/src/internet-node/ipv4-interface.h @@ -69,14 +69,14 @@ public: * This value can be zero in which case the MTU * of this interface will be 2^(16-1). */ - Ipv4Interface (Ptr nd); + Ipv4Interface (); virtual ~Ipv4Interface(); /** * \returns the underlying NetDevice. This method can return * zero if this interface has no associated NetDevice. */ - Ptr GetDevice (void) const; + virtual Ptr GetDevice (void) const = 0; /** * \param a set the ipv4 address of this interface. @@ -150,7 +150,6 @@ protected: virtual void DoDispose (void); private: virtual void SendTo (Ptr p, Ipv4Address dest) = 0; - Ptr m_netdevice; bool m_ifup; Ipv4Address m_address; Ipv4Mask m_netmask; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 501ccfb80..c8c1db6fc 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -56,11 +56,6 @@ Ipv4L3Protocol::GetTypeId (void) Uinteger (64), MakeUintegerAccessor (&Ipv4L3Protocol::m_defaultTtl), MakeUintegerChecker ()) - .AddAttribute ("Node", "The node to which this l3 protocol is attached.", - TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT, - Ptr (0), - MakePtrAccessor (&Ipv4L3Protocol::m_node), - MakePtrChecker ()) .AddTraceSource ("Tx", "Send ipv4 packet to outgoing interface.", MakeTraceSourceAccessor (&Ipv4L3Protocol::m_txTrace)) .AddTraceSource ("Rx", "Receive ipv4 packet from incoming interface.", @@ -82,7 +77,6 @@ Ipv4L3Protocol::Ipv4L3Protocol() NS_LOG_FUNCTION; m_staticRouting = CreateObject (); AddRoutingProtocol (m_staticRouting, 0); - SetupLoopback (); } Ipv4L3Protocol::~Ipv4L3Protocol () @@ -90,6 +84,13 @@ Ipv4L3Protocol::~Ipv4L3Protocol () NS_LOG_FUNCTION; } +void +Ipv4L3Protocol::SetNode (Ptr node) +{ + m_node = node; + SetupLoopback (); +} + void Ipv4L3Protocol::DoDispose (void) { @@ -106,7 +107,8 @@ Ipv4L3Protocol::SetupLoopback (void) { NS_LOG_FUNCTION; - Ptr interface = CreateObject (m_node); + Ptr interface = CreateObject (); + interface->SetNode (m_node); interface->SetAddress (Ipv4Address::GetLoopback ()); interface->SetNetworkMask (Ipv4Mask::GetLoopback ()); uint32_t index = AddIpv4Interface (interface); @@ -328,7 +330,9 @@ Ipv4L3Protocol::AddInterface (Ptr device) { NS_LOG_FUNCTION; NS_LOG_PARAMS (this << &device); - Ptr interface = CreateObject (m_node, device); + Ptr interface = CreateObject (); + interface->SetNode (m_node); + interface->SetDevice (device); return AddIpv4Interface (interface); } diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index def4a2c1d..9f4973272 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -51,6 +51,8 @@ public: Ipv4L3Protocol(); virtual ~Ipv4L3Protocol (); + void SetNode (Ptr node); + /** * \param ttl default ttl to use * diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index fd7afe7ed..7258246a0 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -37,10 +37,6 @@ Ipv4L4Demux::GetTypeId (void) { static TypeId tid = TypeId ("Ipv4L4Demux") .SetParent () - .AddAttribute ("Node", "The node to which this object is associated.", - Ptr (0), - MakePtrAccessor (&Ipv4L4Demux::m_node), - MakePtrChecker ()) .AddAttribute ("Protocols", "The set of protocols registered with this demux.", ObjectVector (), MakeObjectVectorAccessor (&Ipv4L4Demux::m_protocols), @@ -55,6 +51,12 @@ Ipv4L4Demux::Ipv4L4Demux () Ipv4L4Demux::~Ipv4L4Demux() {} +void +Ipv4L4Demux::SetNode (Ptr node) +{ + m_node = node; +} + void Ipv4L4Demux::DoDispose (void) { diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 1bdd4f0f3..b92a9b758 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -45,6 +45,8 @@ public: Ipv4L4Demux (); virtual ~Ipv4L4Demux(); + void SetNode (Ptr node); + /** * \param protocol a template for the protocol to add to this L4 Demux. * \returns the L4Protocol effectively added. diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index 9f1f82360..d26baaef1 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -32,9 +32,8 @@ NS_LOG_COMPONENT_DEFINE ("Ipv4LoopbackInterface"); namespace ns3 { -Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) - : Ipv4Interface (0), - m_node (node) +Ipv4LoopbackInterface::Ipv4LoopbackInterface () + : m_node (0) { NS_LOG_FUNCTION; } @@ -42,6 +41,19 @@ Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) Ipv4LoopbackInterface::~Ipv4LoopbackInterface () { NS_LOG_FUNCTION; + NS_ASSERT (m_node != 0); +} + +Ptr +Ipv4LoopbackInterface::GetDevice (void) const +{ + return 0; +} + +void +Ipv4LoopbackInterface::SetNode (Ptr node) +{ + m_node = node; } void diff --git a/src/internet-node/ipv4-loopback-interface.h b/src/internet-node/ipv4-loopback-interface.h index 865d806d4..318527e0e 100644 --- a/src/internet-node/ipv4-loopback-interface.h +++ b/src/internet-node/ipv4-loopback-interface.h @@ -34,13 +34,13 @@ class Node; class Ipv4LoopbackInterface : public Ipv4Interface { public: - /** - * \brief Constructor - * \param node Pointer to a node associated with this IPv4 interface - */ - Ipv4LoopbackInterface (Ptr node); + Ipv4LoopbackInterface (); virtual ~Ipv4LoopbackInterface (); + virtual Ptr GetDevice (void) const; + + void SetNode (Ptr node); + private: virtual void SendTo (Ptr p, Ipv4Address dest); diff --git a/src/internet-node/tcp-impl.cc b/src/internet-node/tcp-impl.cc index 86807da7d..5a1ad3954 100644 --- a/src/internet-node/tcp-impl.cc +++ b/src/internet-node/tcp-impl.cc @@ -24,14 +24,20 @@ namespace ns3 { -TcpImpl::TcpImpl (Ptr tcp) - : m_tcp (tcp) +TcpImpl::TcpImpl () + : m_tcp (0) {} TcpImpl::~TcpImpl () { NS_ASSERT (m_tcp == 0); } +void +TcpImpl::SetTcp (Ptr tcp) +{ + m_tcp = tcp; +} + Ptr TcpImpl::CreateSocket (void) { diff --git a/src/internet-node/tcp-impl.h b/src/internet-node/tcp-impl.h index 8c6630093..190c4456f 100644 --- a/src/internet-node/tcp-impl.h +++ b/src/internet-node/tcp-impl.h @@ -42,9 +42,11 @@ class TcpL4Protocol; class TcpImpl : public Tcp { public: - TcpImpl (Ptr tcp); + TcpImpl (); virtual ~TcpImpl (); + void SetTcp (Ptr tcp); + virtual Ptr CreateSocket (void); protected: diff --git a/src/internet-node/tcp-l4-protocol.cc b/src/internet-node/tcp-l4-protocol.cc index a34eb0deb..7c83e7eac 100644 --- a/src/internet-node/tcp-l4-protocol.cc +++ b/src/internet-node/tcp-l4-protocol.cc @@ -350,6 +350,12 @@ TcpL4Protocol::~TcpL4Protocol () NS_LOG_FUNCTION; } +void +TcpL4Protocol::SetNode (Ptr node) +{ + m_node = node; +} + int TcpL4Protocol::GetProtocolNumber (void) const { @@ -379,7 +385,10 @@ TcpL4Protocol::CreateSocket (void) { NS_LOG_FUNCTION; Ptr rtt = m_rttFactory.Create (); - Ptr socket = CreateObject (m_node, this, rtt); + Ptr socket = CreateObject (); + socket->SetNode (m_node); + socket->SetTcp (this); + socket->SetRtt (rtt); return socket; } diff --git a/src/internet-node/tcp-l4-protocol.h b/src/internet-node/tcp-l4-protocol.h index 583d325f1..bf846105c 100644 --- a/src/internet-node/tcp-l4-protocol.h +++ b/src/internet-node/tcp-l4-protocol.h @@ -53,6 +53,8 @@ public: TcpL4Protocol (); virtual ~TcpL4Protocol (); + void SetNode (Ptr node); + virtual int GetProtocolNumber (void) const; virtual int GetVersion (void) const; diff --git a/src/internet-node/tcp-socket.cc b/src/internet-node/tcp-socket.cc index dcac0ef18..ce5f0c5c6 100644 --- a/src/internet-node/tcp-socket.cc +++ b/src/internet-node/tcp-socket.cc @@ -40,12 +40,12 @@ using namespace std; namespace ns3 { - TcpSocket::TcpSocket (Ptr node, Ptr tcp, Ptr rtt) + TcpSocket::TcpSocket () : m_skipRetxResched (false), m_dupAckCount (0), m_endPoint (0), - m_node (node), - m_tcp (tcp), + m_node (0), + m_tcp (0), m_errno (ERROR_NOTERROR), m_shutdownSend (false), m_shutdownRecv (false), @@ -61,22 +61,12 @@ namespace ns3 { m_lastRxAck (0), m_nextRxSequence (0), m_pendingData (0), - m_rtt (rtt), + m_rtt (0), m_lastMeasuredRtt (Seconds(0.0)) { NS_LOG_FUNCTION; - NS_LOG_PARAMS (this< t = node->GetObject (); - m_segmentSize = t->GetDefaultSegSize (); - m_rxWindowSize = t->GetDefaultAdvWin (); - m_advertisedWindowSize = t->GetDefaultAdvWin (); - m_cWnd = t->GetDefaultInitialCwnd () * m_segmentSize; - m_ssThresh = t->GetDefaultSsThresh (); - m_initialCWnd = t->GetDefaultInitialCwnd (); - m_cnTimeout = Seconds (t->GetDefaultConnTimeout ()); - m_cnCount = t->GetDefaultConnCount (); - } TcpSocket::~TcpSocket () @@ -103,6 +93,33 @@ TcpSocket::~TcpSocket () m_pendingData = 0; } +void +TcpSocket::SetNode (Ptr node) +{ + m_node = node; + Ptr t = node->GetObject (); + m_segmentSize = t->GetDefaultSegSize (); + m_rxWindowSize = t->GetDefaultAdvWin (); + m_advertisedWindowSize = t->GetDefaultAdvWin (); + m_cWnd = t->GetDefaultInitialCwnd () * m_segmentSize; + m_ssThresh = t->GetDefaultSsThresh (); + m_initialCWnd = t->GetDefaultInitialCwnd (); + m_cnTimeout = Seconds (t->GetDefaultConnTimeout ()); + m_cnCount = t->GetDefaultConnCount (); +} + +void +TcpSocket::SetTcp (Ptr tcp) +{ + m_tcp = tcp; +} +void +TcpSocket::SetRtt (Ptr rtt) +{ + m_rtt = rtt; +} + + enum Socket::SocketErrno TcpSocket::GetErrno (void) const { diff --git a/src/internet-node/tcp-socket.h b/src/internet-node/tcp-socket.h index 4f9f0fde9..3b88e4f16 100644 --- a/src/internet-node/tcp-socket.h +++ b/src/internet-node/tcp-socket.h @@ -45,9 +45,13 @@ public: /** * Create an unbound tcp socket. */ - TcpSocket (Ptr node, Ptr tcp, Ptr rtt); + TcpSocket (); virtual ~TcpSocket (); + void SetNode (Ptr node); + void SetTcp (Ptr tcp); + void SetRtt (Ptr rtt); + virtual enum SocketErrno GetErrno (void) const; virtual Ptr GetNode (void) const; virtual int Bind (void); diff --git a/src/internet-node/udp-impl.cc b/src/internet-node/udp-impl.cc index 83c8c4715..385093572 100644 --- a/src/internet-node/udp-impl.cc +++ b/src/internet-node/udp-impl.cc @@ -25,14 +25,20 @@ namespace ns3 { -UdpImpl::UdpImpl (Ptr udp) - : m_udp (udp) +UdpImpl::UdpImpl () + : m_udp (0) {} UdpImpl::~UdpImpl () { NS_ASSERT (m_udp == 0); } +void +UdpImpl::SetUdp (Ptr udp) +{ + m_udp = udp; +} + Ptr UdpImpl::CreateSocket (void) { diff --git a/src/internet-node/udp-impl.h b/src/internet-node/udp-impl.h index 6ed10fd50..d9f0a8acf 100644 --- a/src/internet-node/udp-impl.h +++ b/src/internet-node/udp-impl.h @@ -40,9 +40,11 @@ class UdpL4Protocol; class UdpImpl : public Udp { public: - UdpImpl (Ptr udp); + UdpImpl (); virtual ~UdpImpl (); + void SetUdp (Ptr udp); + /** * \brief Implements a method to create a UdpImpl-based socket and return * a base class smart pointer to the socket. diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index aba8c590e..f3dea3517 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -66,6 +66,12 @@ UdpL4Protocol::~UdpL4Protocol () NS_LOG_FUNCTION; } +void +UdpL4Protocol::SetNode (Ptr node) +{ + m_node = node; +} + int UdpL4Protocol::GetProtocolNumber (void) const { @@ -95,7 +101,9 @@ Ptr UdpL4Protocol::CreateSocket (void) { NS_LOG_FUNCTION; - Ptr socket = CreateObject (m_node, this); + Ptr socket = CreateObject (); + socket->SetNode (m_node); + socket->SetUdp (this); return socket; } diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index 5e92c1af5..19984804b 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -49,6 +49,8 @@ public: UdpL4Protocol (); virtual ~UdpL4Protocol (); + void SetNode (Ptr node); + virtual int GetProtocolNumber (void) const; virtual int GetVersion (void) const; diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index c73ff94e1..37cb87232 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -34,10 +34,10 @@ NS_LOG_COMPONENT_DEFINE ("UdpSocket"); namespace ns3 { -UdpSocket::UdpSocket (Ptr node, Ptr udp) +UdpSocket::UdpSocket () : m_endPoint (0), - m_node (node), - m_udp (udp), + m_node (0), + m_udp (0), m_errno (ERROR_NOTERROR), m_shutdownSend (false), m_shutdownRecv (false), @@ -69,6 +69,18 @@ UdpSocket::~UdpSocket () m_udp = 0; } +void +UdpSocket::SetNode (Ptr node) +{ + m_node = node; +} +void +UdpSocket::SetUdp (Ptr udp) +{ + m_udp = udp; +} + + enum Socket::SocketErrno UdpSocket::GetErrno (void) const { @@ -400,7 +412,7 @@ UdpSocketTest::RunTests (void) Ptr rxNode = CreateObject (); Ptr rxDev1, rxDev2; { // first interface - rxDev1 = CreateObjectWith ("Node", rxNode, "Address", Mac48Address::Allocate ()); + rxDev1 = CreateObject ("Node", rxNode, "Address", Mac48Address::Allocate ()); rxNode->AddDevice (rxDev1); rxDev1->AddQueue(CreateObject ()); Ptr ipv4 = rxNode->GetObject (); @@ -411,7 +423,7 @@ UdpSocketTest::RunTests (void) } { // second interface - rxDev2 = CreateObjectWith ("Node", rxNode, "Address", Mac48Address::Allocate ()); + rxDev2 = CreateObject ("Node", rxNode, "Address", Mac48Address::Allocate ()); rxNode->AddDevice (rxDev2); rxDev2->AddQueue(CreateObject ()); Ptr ipv4 = rxNode->GetObject (); @@ -425,7 +437,7 @@ UdpSocketTest::RunTests (void) Ptr txNode = CreateObject (); Ptr txDev; { - txDev = CreateObjectWith ("Node", txNode, "Address", Mac48Address::Allocate ()); + txDev = CreateObject ("Node", txNode, "Address", Mac48Address::Allocate ()); txNode->AddDevice (txDev); txDev->AddQueue(CreateObject ()); Ptr ipv4 = txNode->GetObject (); diff --git a/src/internet-node/udp-socket.h b/src/internet-node/udp-socket.h index eaa0cec43..00c99c7cd 100644 --- a/src/internet-node/udp-socket.h +++ b/src/internet-node/udp-socket.h @@ -40,9 +40,12 @@ public: /** * Create an unbound udp socket. */ - UdpSocket (Ptr node, Ptr udp); + UdpSocket (); virtual ~UdpSocket (); + void SetNode (Ptr node); + void SetUdp (Ptr udp); + virtual enum SocketErrno GetErrno (void) const; virtual Ptr GetNode (void) const; virtual int Bind (void); diff --git a/src/mobility/mobility-helper.cc b/src/mobility/mobility-helper.cc index e9694b0ee..54dfc9fae 100644 --- a/src/mobility/mobility-helper.cc +++ b/src/mobility/mobility-helper.cc @@ -12,7 +12,7 @@ NS_LOG_COMPONENT_DEFINE ("MobilityHelper"); MobilityHelper::MobilityHelper () : m_notifierEnabled (false) { - m_position = CreateObjectWith ("X", ConstantVariable (0.0), + m_position = CreateObject ("X", ConstantVariable (0.0), "Y", ConstantVariable (0.0)); m_mobility.SetTypeId ("StaticMobilityModel"); } @@ -125,7 +125,7 @@ MobilityHelper::Layout (const std::vector > &objects) // we need to setup a hierarchical mobility model Ptr parent = m_mobilityStack.back (); Ptr hierarchical = - CreateObjectWith ("Child", model, + CreateObject ("Child", model, "Parent", parent); object->AggregateObject (hierarchical); NS_LOG_DEBUG ("node="< node) - : m_node (node) +PacketSocket::PacketSocket () { NS_LOG_FUNCTION; - Init(); -} - -void -PacketSocket::Init() -{ NS_LOG_FUNCTION; m_state = STATE_OPEN; m_shutdownSend = false; @@ -46,6 +39,12 @@ PacketSocket::Init() m_errno = ERROR_NOTERROR; } +void +PacketSocket::SetNode (Ptr node) +{ + m_node = node; +} + PacketSocket::~PacketSocket () { NS_LOG_FUNCTION; diff --git a/src/node/packet-socket.h b/src/node/packet-socket.h index 9fc07f1ff..d94ef7030 100644 --- a/src/node/packet-socket.h +++ b/src/node/packet-socket.h @@ -71,9 +71,11 @@ class PacketSocketAddress; class PacketSocket : public Socket { public: - PacketSocket (Ptr node); + PacketSocket (); virtual ~PacketSocket (); + void SetNode (Ptr node); + virtual enum SocketErrno GetErrno (void) const; virtual Ptr GetNode (void) const; virtual int Bind (void); @@ -87,9 +89,6 @@ public: private: - -private: - void Init (void); void ForwardUp (Ptr device, Ptr packet, uint16_t protocol, const Address &from); int DoBind (const PacketSocketAddress &address); diff --git a/src/routing/olsr/olsr-agent-impl.cc b/src/routing/olsr/olsr-agent-impl.cc index 03ed74db1..db6481acd 100644 --- a/src/routing/olsr/olsr-agent-impl.cc +++ b/src/routing/olsr/olsr-agent-impl.cc @@ -250,7 +250,9 @@ void AgentImpl::Start () NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress); - m_routingTable = CreateObject (m_ipv4, m_mainAddress); + m_routingTable = CreateObject (); + m_routingTable->SetIpv4 (m_ipv4); + m_routingTable->SetMainAddress (m_mainAddress); // Add OLSR as routing protocol, with slightly higher priority than // static routing. m_ipv4->AddRoutingProtocol (m_routingTable, 10); diff --git a/src/routing/olsr/routing-table.h b/src/routing/olsr/routing-table.h index 744ca44f3..fa2cdc495 100644 --- a/src/routing/olsr/routing-table.h +++ b/src/routing/olsr/routing-table.h @@ -74,11 +74,9 @@ class RoutingTable : public Ipv4RoutingProtocol public: RoutingTable () {} - RoutingTable (Ptr ipv4, const Ipv4Address &mainAddress) - : - m_ipv4 (ipv4), - m_mainAddress (mainAddress) - {} + + void SetIpv4 (Ptr ipv4) {m_ipv4 = ipv4;} + void SetMainAddress (Ipv4Address mainAddress) {m_mainAddress = mainAddress;} ~RoutingTable () {} diff --git a/tutorial/point-to-point-ipv4-topology.cc b/tutorial/point-to-point-ipv4-topology.cc index bcc1cacd1..b6a6e5c0a 100644 --- a/tutorial/point-to-point-ipv4-topology.cc +++ b/tutorial/point-to-point-ipv4-topology.cc @@ -34,7 +34,7 @@ PointToPointIpv4Topology::CreateChannel ( const DataRate& bps, const Time& delay) { - return CreateObject (bps, delay); + return CreateObject ("BitRate", bps, "Delay", delay); } uint32_t @@ -45,7 +45,7 @@ PointToPointIpv4Topology::AddNetDevice ( NS_ASSERT (channel->GetNDevices () <= 1); Ptr nd = - CreateObjectWith ("Node", node, + CreateObject ("Node", node, "Address", Mac48Address::Allocate ()); node->AddDevice (nd); Ptr q = CreateObject (); diff --git a/tutorial/tutorial-bus-network.cc b/tutorial/tutorial-bus-network.cc index 8c2579c36..b0eae6aba 100644 --- a/tutorial/tutorial-bus-network.cc +++ b/tutorial/tutorial-bus-network.cc @@ -44,7 +44,7 @@ main (int argc, char *argv[]) Ptr n0 = bus.GetNode (0); Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.0.1"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -54,7 +54,7 @@ main (int argc, char *argv[]) Ptr n1 = bus.GetNode (1); Ptr server = - CreateObjectWith ("Node", n1, "Port", Uinteger (port)); + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-csma-echo-ascii-trace.cc b/tutorial/tutorial-csma-echo-ascii-trace.cc index c8b048c90..1d60a9979 100644 --- a/tutorial/tutorial-csma-echo-ascii-trace.cc +++ b/tutorial/tutorial-csma-echo-ascii-trace.cc @@ -69,7 +69,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -78,7 +78,7 @@ main (int argc, char *argv[]) n0->AddApplication (client); Ptr server = - CreateObjectWith ("Node", n1, + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); diff --git a/tutorial/tutorial-csma-echo-pcap-trace.cc b/tutorial/tutorial-csma-echo-pcap-trace.cc index 310db8794..09f4048e8 100644 --- a/tutorial/tutorial-csma-echo-pcap-trace.cc +++ b/tutorial/tutorial-csma-echo-pcap-trace.cc @@ -70,7 +70,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -79,7 +79,7 @@ main (int argc, char *argv[]) n0->AddApplication (client); Ptr server = - CreateObjectWith ("Node", n1, + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); diff --git a/tutorial/tutorial-csma-echo.cc b/tutorial/tutorial-csma-echo.cc index ccf9e8cb0..7e0f5a1bd 100644 --- a/tutorial/tutorial-csma-echo.cc +++ b/tutorial/tutorial-csma-echo.cc @@ -68,7 +68,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -77,7 +77,7 @@ main (int argc, char *argv[]) n0->AddApplication (client); Ptr server = - CreateObjectWith ("Node", n1, + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); diff --git a/tutorial/tutorial-linear-dumbbell.cc b/tutorial/tutorial-linear-dumbbell.cc index 847664d31..936592076 100644 --- a/tutorial/tutorial-linear-dumbbell.cc +++ b/tutorial/tutorial-linear-dumbbell.cc @@ -127,7 +127,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client0 = - CreateObjectWith ( + CreateObject ( "Node", n0, "RemoteIpv4", Ipv4Address ("10.1.2.1"), "RemotePort", Uinteger (port), @@ -136,7 +136,7 @@ main (int argc, char *argv[]) "PacketSize", Uinteger (1024)); n0->AddApplication (client0); Ptr client1 = - CreateObjectWith ( + CreateObject ( "Node", n1, "RemoteIpv4", Ipv4Address ("10.1.2.2"), "RemotePort", Uinteger (port), @@ -145,7 +145,7 @@ main (int argc, char *argv[]) "PacketSize", Uinteger (1024)); n1->AddApplication (client1); Ptr client2 = - CreateObjectWith ( + CreateObject ( "Node", n2, "RemoteIpv4", Ipv4Address ("10.1.2.3"), "RemotePort", Uinteger (port), @@ -154,7 +154,7 @@ main (int argc, char *argv[]) "PacketSize", Uinteger (1024)); n2->AddApplication (client2); Ptr client3 = - CreateObjectWith ( + CreateObject ( "Node", n3, "RemoteIpv4", Ipv4Address ("10.1.2.4"), "RemotePort", Uinteger (port), @@ -164,16 +164,16 @@ main (int argc, char *argv[]) n3->AddApplication (client3); Ptr server4 = - CreateObjectWith ("Node", n4, "Port", Uinteger (port)); + CreateObject ("Node", n4, "Port", Uinteger (port)); n4->AddApplication (server4); Ptr server5 = - CreateObjectWith ("Node", n5, "Port", Uinteger (port)); + CreateObject ("Node", n5, "Port", Uinteger (port)); n5->AddApplication (server5); Ptr server6 = - CreateObjectWith ("Node", n6, "Port", Uinteger (port)); + CreateObject ("Node", n6, "Port", Uinteger (port)); n6->AddApplication (server6); Ptr server7 = - CreateObjectWith ("Node", n7, "Port", Uinteger (port)); + CreateObject ("Node", n7, "Port", Uinteger (port)); n7->AddApplication (server7); server4->Start(Seconds(1.)); diff --git a/tutorial/tutorial-point-to-point.cc b/tutorial/tutorial-point-to-point.cc index a94c9f8bf..3d54f5968 100644 --- a/tutorial/tutorial-point-to-point.cc +++ b/tutorial/tutorial-point-to-point.cc @@ -61,7 +61,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -70,7 +70,7 @@ main (int argc, char *argv[]) n0->AddApplication (client); Ptr server = - CreateObjectWith ("Node", n1, + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); diff --git a/tutorial/tutorial-star-routing.cc b/tutorial/tutorial-star-routing.cc index 381d3a7eb..3bb469870 100644 --- a/tutorial/tutorial-star-routing.cc +++ b/tutorial/tutorial-star-routing.cc @@ -148,7 +148,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObjectWith ("Node", n4, + CreateObject ("Node", n4, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -157,7 +157,7 @@ main (int argc, char *argv[]) n0->AddApplication (client); Ptr server = - CreateObjectWith ("Node", n1, + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); diff --git a/tutorial/tutorial-star.cc b/tutorial/tutorial-star.cc index 443506b41..576fdd9d2 100644 --- a/tutorial/tutorial-star.cc +++ b/tutorial/tutorial-star.cc @@ -148,7 +148,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObjectWith ("Node", n0, + CreateObject ("Node", n0, "RemoteIpv4", Ipv4Address ("10.1.1.2"), "RemotePort", Uinteger (port), "MaxPackets", Uinteger (1), @@ -157,7 +157,7 @@ main (int argc, char *argv[]) n0->AddApplication (client); Ptr server = - CreateObjectWith ("Node", n1, + CreateObject ("Node", n1, "Port", Uinteger (port)); n1->AddApplication (server); diff --git a/utils/print-introspected-doxygen.cc b/utils/print-introspected-doxygen.cc index 42337c10d..09f3b8d4d 100644 --- a/utils/print-introspected-doxygen.cc +++ b/utils/print-introspected-doxygen.cc @@ -17,11 +17,11 @@ int main (int argc, char *argv[]) Ptr node = CreateObject (); node->AggregateObject (CreateObject ()); - Ptr p2p = CreateObjectWith ("Node", node, + Ptr p2p = CreateObject ("Node", node, "Address", Mac48Address::Allocate ()); node->AddDevice (p2p); p2p->AddQueue (CreateObject ()); - Ptr csma = CreateObjectWith ("Node", node, + Ptr csma = CreateObject ("Node", node, "Address", Mac48Address::Allocate (), "EncapsulationMode", String ("Llc")); node->AddDevice (csma);