--- a/examples/csma-multicast.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/csma-multicast.cc Thu Jan 31 22:11:03 2008 +0100
@@ -211,7 +211,7 @@
// a fine time to find the interface indices on node two.
//
Ptr<Ipv4> ipv4;
- ipv4 = n2->QueryInterface<Ipv4> ();
+ ipv4 = n2->GetObject<Ipv4> ();
uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr (n2Lan0Addr);
uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr (n2Lan1Addr);
@@ -261,7 +261,7 @@
// interface to find the output interface index, and tell node zero to send
// its multicast traffic out that interface.
//
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
uint32_t ifIndexSrc = ipv4->FindInterfaceForAddr (multicastSource);
ipv4->SetDefaultMulticastRoute (ifIndexSrc);
//
@@ -269,7 +269,7 @@
// multicast data. To enable forwarding bits up the protocol stack, we need
// to tell the stack to join the multicast group.
//
- ipv4 = n4->QueryInterface<Ipv4> ();
+ ipv4 = n4->GetObject<Ipv4> ();
ipv4->JoinMulticastGroup (multicastSource, multicastGroup);
//
// Create an OnOff application to send UDP datagrams from node zero to the
--- a/examples/simple-error-model.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/simple-error-model.cc Thu Jan 31 22:11:03 2008 +0100
@@ -185,9 +185,9 @@
// This will likely set by some global StaticRouting object in the future
NS_LOG_INFO ("Set Default Routes.");
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
- ipv4 = n3->QueryInterface<Ipv4> ();
+ ipv4 = n3->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
//
@@ -204,7 +204,7 @@
NS_ASSERT (em != 0);
// Now, query interface on the resulting em pointer to see if a
// RateErrorModel interface exists. If so, set the packet error rate
- Ptr<RateErrorModel> bem = em->QueryInterface<RateErrorModel> ();
+ Ptr<RateErrorModel> bem = em->GetObject<RateErrorModel> ();
if (bem)
{
bem->SetRandomVariable (UniformVariable ());
--- a/examples/simple-point-to-point-olsr.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/simple-point-to-point-olsr.cc Thu Jan 31 22:11:03 2008 +0100
@@ -205,9 +205,9 @@
// This will likely set by some global StaticRouting object in the future
NS_LOG_INFO ("Set Default Routes.");
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
- ipv4 = n3->QueryInterface<Ipv4> ();
+ ipv4 = n3->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
--- a/examples/simple-point-to-point.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/simple-point-to-point.cc Thu Jan 31 22:11:03 2008 +0100
@@ -206,9 +206,9 @@
// This will likely set by some global StaticRouting object in the future
NS_LOG_INFO ("Set Default Routes.");
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
- ipv4 = n3->QueryInterface<Ipv4> ();
+ ipv4 = n3->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
--- a/examples/tcp-large-transfer-errors.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/tcp-large-transfer-errors.cc Thu Jan 31 22:11:03 2008 +0100
@@ -173,9 +173,9 @@
PointToPointTopology::AddIpv4Routes(n0, n1, channel0);
PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.2"), 1);
- ipv4 = n2->QueryInterface<Ipv4> ();
+ ipv4 = n2->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.2.1"), 1);
@@ -191,7 +191,7 @@
uint16_t servPort = 50000;
Ptr<SocketFactory> socketFactory =
- n0->QueryInterface<SocketFactory> ();
+ n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();
--- a/examples/tcp-large-transfer.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/tcp-large-transfer.cc Thu Jan 31 22:11:03 2008 +0100
@@ -173,9 +173,9 @@
PointToPointTopology::AddIpv4Routes(n0, n1, channel0);
PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.2"), 1);
- ipv4 = n2->QueryInterface<Ipv4> ();
+ ipv4 = n2->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.2.1"), 1);
@@ -191,7 +191,7 @@
uint16_t servPort = 50000;
Ptr<SocketFactory> socketFactory =
- n0->QueryInterface<SocketFactory> ();
+ n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();
--- a/examples/tcp-nonlistening-server.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/tcp-nonlistening-server.cc Thu Jan 31 22:11:03 2008 +0100
@@ -136,9 +136,9 @@
PointToPointTopology::AddIpv4Routes(n0, n1, channel0);
PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.2"), 1);
- ipv4 = n2->QueryInterface<Ipv4> ();
+ ipv4 = n2->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.2.1"), 1);
@@ -153,7 +153,7 @@
uint16_t servPort = 500;
Ptr<SocketFactory> socketFactory =
- n0->QueryInterface<SocketFactory> ();
+ n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();
--- a/examples/tcp-small-transfer-oneloss.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/tcp-small-transfer-oneloss.cc Thu Jan 31 22:11:03 2008 +0100
@@ -154,9 +154,9 @@
PointToPointTopology::AddIpv4Routes(n0, n1, channel0);
PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.2"), 1);
- ipv4 = n2->QueryInterface<Ipv4> ();
+ ipv4 = n2->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.2.1"), 1);
@@ -173,7 +173,7 @@
uint16_t servPort = 500;
Ptr<SocketFactory> socketFactory =
- n0->QueryInterface<SocketFactory> ();
+ n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();
--- a/examples/tcp-small-transfer.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/examples/tcp-small-transfer.cc Thu Jan 31 22:11:03 2008 +0100
@@ -165,9 +165,9 @@
PointToPointTopology::AddIpv4Routes(n0, n1, channel0);
PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
Ptr<Ipv4> ipv4;
- ipv4 = n0->QueryInterface<Ipv4> ();
+ ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.2"), 1);
- ipv4 = n2->QueryInterface<Ipv4> ();
+ ipv4 = n2->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.2.1"), 1);
@@ -183,7 +183,7 @@
uint16_t servPort = 500;
Ptr<SocketFactory> socketFactory =
- n0->QueryInterface<SocketFactory> ();
+ n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();
--- a/samples/main-adhoc-wifi.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/samples/main-adhoc-wifi.cc Thu Jan 31 22:11:03 2008 +0100
@@ -58,14 +58,14 @@
static void
SetPosition (Ptr<Node> node, Vector position)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
mobility->SetPosition (position);
}
static Vector
GetPosition (Ptr<Node> node)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
return mobility->GetPosition ();
}
@@ -96,7 +96,7 @@
SetupPacketReceive (Ptr<Node> node, uint16_t port)
{
TypeId tid = TypeId::LookupByName ("Packet");
- Ptr<SocketFactory> socketFactory = node->QueryInterface<SocketFactory> (tid);
+ Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid);
Ptr<Socket> sink = socketFactory->CreateSocket ();
sink->Bind ();
sink->SetRecvCallback (MakeCallback (&ReceivePacket));
--- a/samples/main-ap-wifi.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/samples/main-ap-wifi.cc Thu Jan 31 22:11:03 2008 +0100
@@ -102,14 +102,14 @@
static void
SetPosition (Ptr<Node> node, Vector position)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
mobility->SetPosition (position);
}
static Vector
GetPosition (Ptr<Node> node)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
return mobility->GetPosition ();
}
--- a/samples/main-grid-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/samples/main-grid-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -39,7 +39,7 @@
j != nodes.end (); j++)
{
Ptr<Object> object = *j;
- Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> position = object->GetObject<MobilityModel> ();
NS_ASSERT (position != 0);
Vector pos = position->GetPosition ();
std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
--- a/samples/main-simple.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/samples/main-simple.cc Thu Jan 31 22:11:03 2008 +0100
@@ -43,7 +43,7 @@
Ptr<Node> a = CreateObject<InternetNode> ();
TypeId tid = TypeId::LookupByName ("Udp");
- Ptr<SocketFactory> socketFactory = a->QueryInterface<SocketFactory> (tid);
+ Ptr<SocketFactory> socketFactory = a->GetObject<SocketFactory> (tid);
Ptr<Socket> sink = socketFactory->CreateSocket ();
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
--- a/src/applications/onoff/onoff-application.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/applications/onoff/onoff-application.cc Thu Jan 31 22:11:03 2008 +0100
@@ -155,7 +155,7 @@
if (!m_socket)
{
TypeId tid = TypeId::LookupByName (m_tid);
- Ptr<SocketFactory> socketFactory = GetNode ()->QueryInterface<SocketFactory> (tid);
+ Ptr<SocketFactory> socketFactory = GetNode ()->GetObject<SocketFactory> (tid);
m_socket = socketFactory->CreateSocket ();
m_socket->Bind ();
m_socket->Connect (m_peer);
--- a/src/applications/packet-sink/packet-sink.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/applications/packet-sink/packet-sink.cc Thu Jan 31 22:11:03 2008 +0100
@@ -75,7 +75,7 @@
{
TypeId tid = TypeId::LookupByName (m_tid);
Ptr<SocketFactory> socketFactory =
- GetNode ()->QueryInterface<SocketFactory> (tid);
+ GetNode ()->GetObject<SocketFactory> (tid);
m_socket = socketFactory->CreateSocket ();
m_socket->Bind (m_local);
m_socket->Listen (0);
--- a/src/applications/udp-echo/udp-echo-client.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/applications/udp-echo/udp-echo-client.cc Thu Jan 31 22:11:03 2008 +0100
@@ -93,7 +93,7 @@
{
TypeId tid = TypeId::LookupByName ("Udp");
Ptr<SocketFactory> socketFactory =
- GetNode ()->QueryInterface<SocketFactory> (tid);
+ GetNode ()->GetObject<SocketFactory> (tid);
m_socket = socketFactory->CreateSocket ();
m_socket->Bind ();
m_socket->Connect (m_peer);
--- a/src/applications/udp-echo/udp-echo-server.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/applications/udp-echo/udp-echo-server.cc Thu Jan 31 22:11:03 2008 +0100
@@ -79,7 +79,7 @@
{
TypeId tid = TypeId::LookupByName ("Udp");
Ptr<SocketFactory> socketFactory =
- GetNode ()->QueryInterface<SocketFactory> (tid);
+ GetNode ()->GetObject<SocketFactory> (tid);
m_socket = socketFactory->CreateSocket ();
m_socket->Bind (m_local);
}
--- a/src/common/error-model.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/common/error-model.cc Thu Jan 31 22:11:03 2008 +0100
@@ -64,7 +64,7 @@
{
NS_LOG_FUNCTION;
TypeId interfaceId = g_interfaceIdErrorModelDefaultValue.GetValue ();
- Ptr<ErrorModel> em = interfaceId.CreateObject ()->QueryInterface<ErrorModel> ();
+ Ptr<ErrorModel> em = interfaceId.CreateObject ()->GetObject<ErrorModel> ();
return em;
}
--- a/src/core/object.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/core/object.cc Thu Jan 31 22:11:03 2008 +0100
@@ -216,7 +216,7 @@
}
std::string interfaceName = element.substr (1, std::string::npos);
TypeId interfaceId = TypeId::LookupByName (interfaceName);
- Ptr<Object> interface = m_aggregate->QueryInterface<Object> (interfaceId);
+ Ptr<Object> interface = m_aggregate->GetObject<Object> (interfaceId);
return interface;
}
void
@@ -377,7 +377,7 @@
m_next = 0;
}
Ptr<Object>
-Object::DoQueryInterface (TypeId tid) const
+Object::DoGetObject (TypeId tid) const
{
NS_ASSERT (CheckLoose ());
const Object *currentObject = this;
@@ -751,46 +751,46 @@
bool result = true;
Ptr<BaseA> baseA = CreateObject<BaseA> ();
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::GetTypeId ()), 0);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (), 0);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (), baseA);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), 0);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedA> (), 0);
baseA = CreateObject<DerivedA> (10);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::GetTypeId ()), baseA);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (), 0);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (), baseA);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), baseA);
+ NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<DerivedA> (), 0);
baseA = CreateObject<BaseA> ();
Ptr<BaseB> baseB = CreateObject<BaseB> ();
Ptr<BaseB> baseBCopy = baseB;
baseA->AddInterface (baseB);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseA> (), 0);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (), 0);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedB> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (), 0);
- NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedB> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (), 0);
- NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedA> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseA> (), 0);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseB> (), 0);
+ NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedB> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseB> (), 0);
+ NS_TEST_ASSERT_EQUAL (baseB->GetObject<DerivedB> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseA> (), 0);
+ NS_TEST_ASSERT_EQUAL (baseB->GetObject<DerivedA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseBCopy->GetObject<BaseA> (), 0);
baseA = CreateObject<DerivedA> (1);
baseB = CreateObject<DerivedB> (1);
baseBCopy = baseB;
baseA->AddInterface (baseB);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedB> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedA> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<DerivedA> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedB> (), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (), 0)
+ NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<DerivedB> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseB> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<DerivedA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseBCopy->GetObject<DerivedA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseBCopy->GetObject<BaseA> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<DerivedB> (), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseB> (), 0)
baseA = CreateObject<BaseA> ();
baseB = CreateObject<BaseB> ();
baseA->AddInterface (baseB);
baseA = 0;
- baseA = baseB->QueryInterface<BaseA> ();
+ baseA = baseB->GetObject<BaseA> ();
baseA = CreateObject<BaseA> ();
baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
@@ -863,13 +863,13 @@
// Test the object creation code of TypeId
Ptr<Object> a = BaseA::GetTypeId ().CreateObject ();
- NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (), a);
- NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (DerivedA::GetTypeId ()), 0);
- NS_TEST_ASSERT_EQUAL (a->QueryInterface<DerivedA> (), 0);
+ NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (), a);
+ NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (DerivedA::GetTypeId ()), 0);
+ NS_TEST_ASSERT_EQUAL (a->GetObject<DerivedA> (), 0);
a = DerivedA::GetTypeId ().CreateObject (10);
- NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (), a);
- NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (DerivedA::GetTypeId ()), a);
- NS_TEST_ASSERT_UNEQUAL (a->QueryInterface<DerivedA> (), 0);
+ NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (), a);
+ NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (DerivedA::GetTypeId ()), a);
+ NS_TEST_ASSERT_UNEQUAL (a->GetObject<DerivedA> (), 0);
return result;
--- a/src/core/object.h Thu Jan 31 21:58:13 2008 +0100
+++ b/src/core/object.h Thu Jan 31 22:11:03 2008 +0100
@@ -130,7 +130,7 @@
*
* Note: This base class is quite similar in spirit to IUnknown in COM or
* BonoboObject in Bonobo: it provides three main methods: Ref, Unref and
- * QueryInterface.
+ * GetObject.
*/
class Object
{
@@ -157,13 +157,13 @@
* \returns a pointer to the requested interface or zero if it could not be found.
*/
template <typename T>
- Ptr<T> QueryInterface (void) const;
+ Ptr<T> GetObject (void) const;
/**
* \param tid the interface id of the requested interface
* \returns a pointer to the requested interface or zero if it could not be found.
*/
template <typename T>
- Ptr<T> QueryInterface (TypeId tid) const;
+ Ptr<T> GetObject (TypeId tid) const;
/**
* Run the DoDispose methods of this object and all the
* objects aggregated to it.
@@ -177,7 +177,7 @@
* \param other another object pointer
*
* This method aggregates the two objects together: after this
- * method returns, it becomes possible to call QueryInterface
+ * method returns, it becomes possible to call GetObject
* on one to get the other, and vice-versa.
*/
void AddInterface (Ptr<Object> other);
@@ -231,7 +231,7 @@
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
- Ptr<Object> DoQueryInterface (TypeId tid) const;
+ Ptr<Object> DoGetObject (TypeId tid) const;
void DoCollectSources (std::string path, const TraceContext &context,
TraceResolver::SourceCollection *collection) const;
void DoTraceAll (std::ostream &os, const TraceContext &context) const;
@@ -439,9 +439,9 @@
template <typename T>
Ptr<T>
-Object::QueryInterface () const
+Object::GetObject () const
{
- Ptr<Object> found = DoQueryInterface (T::GetTypeId ());
+ Ptr<Object> found = DoGetObject (T::GetTypeId ());
if (found != 0)
{
return Ptr<T> (dynamic_cast<T *> (PeekPointer (found)));
@@ -451,9 +451,9 @@
template <typename T>
Ptr<T>
-Object::QueryInterface (TypeId tid) const
+Object::GetObject (TypeId tid) const
{
- Ptr<Object> found = DoQueryInterface (tid);
+ Ptr<Object> found = DoGetObject (tid);
if (found != 0)
{
return Ptr<T> (dynamic_cast<T *> (PeekPointer (found)));
--- a/src/devices/csma/csma-ipv4-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/devices/csma/csma-ipv4-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -101,7 +101,7 @@
{
Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
uint32_t ifIndex = ipv4->AddInterface (nd);
ipv4->SetAddress (ifIndex, address);
@@ -116,8 +116,8 @@
Ptr<NetDevice> nd1, Ptr<NetDevice> nd2)
{
// Assert that both are Ipv4 nodes
- Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> ();
- Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip1 = nd1->GetNode ()->GetObject<Ipv4> ();
+ Ptr<Ipv4> ip2 = nd2->GetNode ()->GetObject<Ipv4> ();
NS_ASSERT(ip1 != 0 && ip2 != 0);
// Get interface indexes for both nodes corresponding to the right channel
--- a/src/devices/csma/csma-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/devices/csma/csma-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -90,7 +90,7 @@
TypeId tid = TypeId::LookupByName (tid_name);
Ptr<SocketFactory> socketFactory =
- n1->QueryInterface<SocketFactory> (tid);
+ n1->GetObject<SocketFactory> (tid);
Ptr<Socket> socket = socketFactory->CreateSocket ();
--- a/src/devices/point-to-point/point-to-point-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/devices/point-to-point/point-to-point-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -111,14 +111,14 @@
NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ());
NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ());
- Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip1 = n1->GetObject<Ipv4> ();
uint32_t index1 = ip1->AddInterface (nd1);
ip1->SetAddress (index1, addr1);
ip1->SetNetworkMask (index1, netmask);
ip1->SetUp (index1);
- Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip2 = n2->GetObject<Ipv4> ();
uint32_t index2 = ip2->AddInterface (nd2);
ip2->SetAddress (index2, addr2);
@@ -153,7 +153,7 @@
// Get interface indexes for both nodes corresponding to the right channel
uint32_t index = 0;
bool found = false;
- Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip1 = n1->GetObject<Ipv4> ();
for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++)
{
if (ip1 ->GetNetDevice (i) == nd1)
@@ -167,7 +167,7 @@
index = 0;
found = false;
- Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip2 = n2->GetObject<Ipv4> ();
for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++)
{
if (ip2 ->GetNetDevice (i) == nd2)
@@ -212,8 +212,8 @@
}
// Assert that both are Ipv4 nodes
- Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> ();
- Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip1 = nd1->GetNode ()->GetObject<Ipv4> ();
+ Ptr<Ipv4> ip2 = nd2->GetNode ()->GetObject<Ipv4> ();
NS_ASSERT(ip1 != 0 && ip2 != 0);
// Get interface indexes for both nodes corresponding to the right channel
--- a/src/devices/wifi/wifi-channel.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/devices/wifi/wifi-channel.cc Thu Jan 31 22:11:03 2008 +0100
@@ -60,13 +60,13 @@
WifiChannel::Send (Ptr<NetDevice> sender, Ptr<const Packet> packet, double txPowerDbm,
WifiMode wifiMode, WifiPreamble preamble) const
{
- Ptr<MobilityModel> senderMobility = sender->GetNode ()->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> senderMobility = sender->GetNode ()->GetObject<MobilityModel> ();
uint32_t j = 0;
for (DeviceList::const_iterator i = m_deviceList.begin (); i != m_deviceList.end (); i++)
{
if (sender != i->first)
{
- Ptr<MobilityModel> receiverMobility = i->first->GetNode ()->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> receiverMobility = i->first->GetNode ()->GetObject<MobilityModel> ();
Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
double rxPowerDbm = m_loss->GetRxPower (txPowerDbm, senderMobility, receiverMobility);
NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
--- a/src/internet-node/arp-ipv4-interface.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/arp-ipv4-interface.cc Thu Jan 31 22:11:03 2008 +0100
@@ -71,7 +71,7 @@
{
NS_LOG_LOGIC ("Needs ARP");
Ptr<ArpL3Protocol> arp =
- m_node->QueryInterface<ArpL3Protocol> ();
+ m_node->GetObject<ArpL3Protocol> ();
Address hardwareDestination;
bool found;
--- a/src/internet-node/arp-l3-protocol.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/arp-l3-protocol.cc Thu Jan 31 22:11:03 2008 +0100
@@ -80,7 +80,7 @@
return *i;
}
}
- Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> ();
+ Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
Ptr<Ipv4Interface> interface = ipv4->FindInterfaceForDevice (device);
ArpCache * cache = new ArpCache (device, interface);
NS_ASSERT (device->IsBroadcast ());
--- a/src/internet-node/internet-node.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/internet-node.cc Thu Jan 31 22:11:03 2008 +0100
@@ -85,7 +85,7 @@
InternetNode::GetTraceResolver () const
{
Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
- Ptr<Ipv4L3Protocol> ipv4 = QueryInterface<Ipv4L3Protocol> ();
+ Ptr<Ipv4L3Protocol> ipv4 = GetObject<Ipv4L3Protocol> ();
resolver->AddComposite ("ipv4", ipv4);
resolver->SetParentResolver (Node::GetTraceResolver ());
return resolver;
--- a/src/internet-node/ipv4-l3-protocol.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/ipv4-l3-protocol.cc Thu Jan 31 22:11:03 2008 +0100
@@ -751,7 +751,7 @@
NS_LOG_FUNCTION;
NS_LOG_PARAMS (this << p << &ip);
- Ptr<Ipv4L4Demux> demux = m_node->QueryInterface<Ipv4L4Demux> ();
+ Ptr<Ipv4L4Demux> demux = m_node->GetObject<Ipv4L4Demux> ();
Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface);
}
--- a/src/internet-node/ipv4-loopback-interface.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/ipv4-loopback-interface.cc Thu Jan 31 22:11:03 2008 +0100
@@ -51,7 +51,7 @@
NS_LOG_PARAMS (this << packet << dest);
Ptr<Ipv4L3Protocol> ipv4 =
- m_node->QueryInterface<Ipv4L3Protocol> ();
+ m_node->GetObject<Ipv4L3Protocol> ();
ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER,
Mac48Address ("ff:ff:ff:ff:ff:ff"));
--- a/src/internet-node/rtt-estimator.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/rtt-estimator.cc Thu Jan 31 22:11:03 2008 +0100
@@ -168,7 +168,7 @@
Ptr<RttEstimator> RttEstimator::CreateDefault ()
{
TypeId tid = defaultTid.GetValue ();
- Ptr<RttEstimator> rtte = tid.CreateObject (0.1, initialEstimate)->QueryInterface<RttEstimator> ();
+ Ptr<RttEstimator> rtte = tid.CreateObject (0.1, initialEstimate)->GetObject<RttEstimator> ();
return rtte;
}
--- a/src/internet-node/tcp-l4-protocol.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/tcp-l4-protocol.cc Thu Jan 31 22:11:03 2008 +0100
@@ -450,7 +450,7 @@
packet->AddHeader (tcpHeader);
Ptr<Ipv4L3Protocol> ipv4 =
- m_node->QueryInterface<Ipv4L3Protocol> ();
+ m_node->GetObject<Ipv4L3Protocol> ();
if (ipv4 != 0)
{
ipv4->Send (packet, saddr, daddr, PROT_NUMBER);
@@ -472,7 +472,7 @@
packet->AddHeader (outgoingHeader);
Ptr<Ipv4L3Protocol> ipv4 =
- m_node->QueryInterface<Ipv4L3Protocol> ();
+ m_node->GetObject<Ipv4L3Protocol> ();
if (ipv4 != 0)
{
ipv4->Send (packet, saddr, daddr, PROT_NUMBER);
--- a/src/internet-node/tcp-socket.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/tcp-socket.cc Thu Jan 31 22:11:03 2008 +0100
@@ -234,7 +234,7 @@
m_defaultPort = transport.GetPort ();
uint32_t localIfIndex;
- Ptr<Ipv4> ipv4 = m_node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
if (ipv4->GetIfIndexForDestination (m_defaultAddress, localIfIndex))
{
@@ -557,7 +557,7 @@
NS_LOG_FUNCTION;
NS_LOG_PARAMS (this << p << "tcpHeader " << fromAddress);
uint32_t localIfIndex;
- Ptr<Ipv4> ipv4 = m_node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
switch (a)
{
case SYN_ACK_TX:
--- a/src/internet-node/udp-l4-protocol.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/udp-l4-protocol.cc Thu Jan 31 22:11:03 2008 +0100
@@ -159,7 +159,7 @@
packet->AddHeader (udpHeader);
- Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> ();
+ Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
if (ipv4 != 0)
{
NS_LOG_LOGIC ("Sending to IP");
--- a/src/internet-node/udp-socket.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/internet-node/udp-socket.cc Thu Jan 31 22:11:03 2008 +0100
@@ -268,7 +268,7 @@
}
uint32_t localIfIndex;
- Ptr<Ipv4> ipv4 = m_node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
//
// If dest is sent to the limited broadcast address (all ones),
@@ -386,7 +386,7 @@
Ptr<Node> rxNode = CreateObject<InternetNode> ();
Ptr<PointToPointNetDevice> rxDev = CreateObject<PointToPointNetDevice> (rxNode);
rxDev->AddQueue(CreateObject<DropTailQueue> ());
- Ptr<Ipv4> ipv4 = rxNode->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
uint32_t netdev_idx = ipv4->AddInterface (rxDev);
ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1"));
ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U));
@@ -396,7 +396,7 @@
Ptr<Node> txNode = CreateObject<InternetNode> ();
Ptr<PointToPointNetDevice> txDev = CreateObject<PointToPointNetDevice> (txNode);
txDev->AddQueue(CreateObject<DropTailQueue> ());
- ipv4 = txNode->QueryInterface<Ipv4> ();
+ ipv4 = txNode->GetObject<Ipv4> ();
netdev_idx = ipv4->AddInterface (txDev);
ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2"));
ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U));
@@ -409,12 +409,12 @@
// Create the UDP sockets
- Ptr<SocketFactory> rxSocketFactory = rxNode->QueryInterface<Udp> ();
+ Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<Udp> ();
Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 1234)), 0);
rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this));
- Ptr<SocketFactory> txSocketFactory = txNode->QueryInterface<Udp> ();
+ Ptr<SocketFactory> txSocketFactory = txNode->GetObject<Udp> ();
Ptr<Socket> txSocket = txSocketFactory->CreateSocket ();
// ------ Now the tests ------------
--- a/src/mobility/grid-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/mobility/grid-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -43,7 +43,7 @@
double x, y;
x = m_xMin + m_deltaX * (i % m_n);
y = m_yMin + m_deltaY * (i / m_n);
- Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->GetObject<MobilityModel> ();
object->AddInterface (mobility);
mobility->SetPosition (Vector (x, y, 0.0));
}
@@ -54,7 +54,7 @@
double x, y;
x = m_xMin + m_deltaX * (i / m_n);
y = m_yMin + m_deltaY * (i % m_n);
- Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->GetObject<MobilityModel> ();
object->AddInterface (mobility);
mobility->SetPosition (Vector (x, y, 0.0));
}
--- a/src/mobility/hierarchical-mobility-model.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/mobility/hierarchical-mobility-model.cc Thu Jan 31 22:11:03 2008 +0100
@@ -37,9 +37,9 @@
m_parent (parent)
{
Ptr<MobilityModelNotifier> childNotifier =
- m_child->QueryInterface<MobilityModelNotifier> ();
+ m_child->GetObject<MobilityModelNotifier> ();
Ptr<MobilityModelNotifier> parentNotifier =
- m_parent->QueryInterface<MobilityModelNotifier> ();
+ m_parent->GetObject<MobilityModelNotifier> ();
if (childNotifier == 0)
{
childNotifier = CreateObject<MobilityModelNotifier> ();
--- a/src/mobility/mobility-model.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/mobility/mobility-model.cc Thu Jan 31 22:11:03 2008 +0100
@@ -65,7 +65,7 @@
void
MobilityModel::NotifyCourseChange (void) const
{
- Ptr<MobilityModelNotifier> notifier = QueryInterface<MobilityModelNotifier> ();
+ Ptr<MobilityModelNotifier> notifier = GetObject<MobilityModelNotifier> ();
if (notifier != 0)
{
notifier->Notify (this);
--- a/src/mobility/ns2-mobility-file-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/mobility/ns2-mobility-file-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -49,7 +49,7 @@
{
return 0;
}
- Ptr<StaticSpeedMobilityModel> model = object->QueryInterface<StaticSpeedMobilityModel> ();
+ Ptr<StaticSpeedMobilityModel> model = object->GetObject<StaticSpeedMobilityModel> ();
if (model == 0)
{
model = CreateObject<StaticSpeedMobilityModel> ();
--- a/src/mobility/random-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/mobility/random-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -41,7 +41,7 @@
RandomTopology::RandomTopology ()
: m_mobilityModel (g_mobility.GetValue ())
{
- m_positionModel = g_position.GetValue ().CreateObject ()->QueryInterface<RandomPosition> ();
+ m_positionModel = g_position.GetValue ().CreateObject ()->GetObject<RandomPosition> ();
}
RandomTopology::RandomTopology (Ptr<RandomPosition> positionModel, TypeId mobilityModel)
: m_positionModel (positionModel),
@@ -67,7 +67,7 @@
void
RandomTopology::LayoutOne (Ptr<Object> object)
{
- Ptr<MobilityModel> mobility = m_mobilityModel.CreateObject ()->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = m_mobilityModel.CreateObject ()->GetObject<MobilityModel> ();
object->AddInterface (mobility);
Vector position = m_positionModel->Get ();
mobility->SetPosition (position);
--- a/src/mobility/random-waypoint-mobility-model.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/mobility/random-waypoint-mobility-model.cc Thu Jan 31 22:11:03 2008 +0100
@@ -50,7 +50,7 @@
: m_speed (g_speed.GetCopy ()),
m_pause (g_pause.GetCopy ())
{
- m_position = g_position.GetValue ().CreateObject ()->QueryInterface<RandomPosition> ();
+ m_position = g_position.GetValue ().CreateObject ()->GetObject<RandomPosition> ();
}
RandomWaypointMobilityModelParameters::RandomWaypointMobilityModelParameters (Ptr<RandomPosition> randomPosition,
const RandomVariable &speed,
--- a/src/node/packet-socket-factory.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/node/packet-socket-factory.cc Thu Jan 31 22:11:03 2008 +0100
@@ -39,7 +39,7 @@
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
{
- Ptr<Node> node = QueryInterface<Node> ();
+ Ptr<Node> node = GetObject<Node> ();
Ptr<PacketSocket> socket = CreateObject<PacketSocket> (node);
return socket;
}
--- a/src/node/queue.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/node/queue.cc Thu Jan 31 22:11:03 2008 +0100
@@ -284,7 +284,7 @@
{
NS_LOG_FUNCTION;
TypeId interfaceId = g_interfaceIdDefaultValue.GetValue ();
- Ptr<Queue> queue = interfaceId.CreateObject ()->QueryInterface<Queue> ();
+ Ptr<Queue> queue = interfaceId.CreateObject ()->GetObject<Queue> ();
return queue;
}
--- a/src/routing/global-routing/global-route-manager-impl.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/routing/global-routing/global-route-manager-impl.cc Thu Jan 31 22:11:03 2008 +0100
@@ -392,7 +392,7 @@
Ptr<Node> node = *i;
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> ();
+ node->GetObject<GlobalRouter> ();
//
// Ignore nodes that aren't participating in routing.
//
@@ -476,7 +476,7 @@
// participating in routing.
//
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> ();
+ node->GetObject<GlobalRouter> ();
//
// if the node has a global router interface, then run the global routing
// algorithms.
@@ -1145,7 +1145,7 @@
Ptr<Node> node = *i;
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> ();
+ node->GetObject<GlobalRouter> ();
//
// If the node doesn't have a GlobalRouter interface it can't be the one
// we're interested in.
@@ -1163,7 +1163,7 @@
// is participating in routing IP version 4 packets, it certainly must have
// an Ipv4 interface.
//
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT_MSG (ipv4,
"GlobalRouteManagerImpl::FindOutgoingTypeId (): "
"QI for <Ipv4> interface failed");
@@ -1229,7 +1229,7 @@
// in question cannot be the router we want, so we continue.
//
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> ();
+ node->GetObject<GlobalRouter> ();
if (rtr == 0)
{
@@ -1252,7 +1252,7 @@
// for that interface. If the node is acting as an IP version 4 router, it
// should absolutely have an Ipv4 interface.
//
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT_MSG (ipv4,
"GlobalRouteManagerImpl::SPFIntraAddRouter (): "
"QI for <Ipv4> interface failed");
@@ -1346,7 +1346,7 @@
// in question cannot be the router we want, so we continue.
//
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> ();
+ node->GetObject<GlobalRouter> ();
if (rtr == 0)
{
@@ -1369,7 +1369,7 @@
// for that interface. If the node is acting as an IP version 4 router, it
// should absolutely have an Ipv4 interface.
//
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT_MSG (ipv4,
"GlobalRouteManagerImpl::SPFIntraAddTransit (): "
"QI for <Ipv4> interface failed");
--- a/src/routing/global-routing/global-router-interface.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/routing/global-routing/global-router-interface.cc Thu Jan 31 22:11:03 2008 +0100
@@ -496,7 +496,7 @@
GlobalRouter::DiscoverLSAs (void)
{
NS_LOG_FUNCTION;
- Ptr<Node> node = QueryInterface<Node> ();
+ Ptr<Node> node = GetObject<Node> ();
NS_LOG_LOGIC("For node " << node->GetId () );
NS_ASSERT_MSG(node,
"GlobalRouter::DiscoverLSAs (): <Node> interface not set");
@@ -512,7 +512,7 @@
// Ipv4 interface. This is where the information regarding the attached
// interfaces lives.
//
- Ptr<Ipv4> ipv4Local = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> ();
NS_ASSERT_MSG(ipv4Local,
"GlobalRouter::DiscoverLSAs (): QI for <Ipv4> interface failed");
//
@@ -631,7 +631,7 @@
// device for its node, then ask that node for its Ipv4 interface.
//
Ptr<Node> nodeRemote = ndRemote->GetNode();
- Ptr<Ipv4> ipv4Remote = nodeRemote->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4Remote = nodeRemote->GetObject<Ipv4> ();
NS_ASSERT_MSG(ipv4Remote,
"GlobalRouter::DiscoverLSAs (): QI for remote <Ipv4> failed");
//
@@ -639,7 +639,7 @@
// well get it now.
//
Ptr<GlobalRouter> srRemote =
- nodeRemote->QueryInterface<GlobalRouter> ();
+ nodeRemote->GetObject<GlobalRouter> ();
NS_ASSERT_MSG(srRemote,
"GlobalRouter::DiscoverLSAs():QI for remote <GlobalRouter> failed");
Ipv4Address rtrIdRemote = srRemote->GetRouterId();
@@ -717,7 +717,7 @@
NS_ASSERT (tempNd);
Ptr<Node> tempNode = tempNd->GetNode ();
uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
- Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> tempIpv4 = tempNode->GetObject<Ipv4> ();
NS_ASSERT (tempIpv4);
Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
pLSA->AddAttachedRouter (tempAddr);
@@ -735,7 +735,7 @@
Ptr<NetDevice> ndLocal) const
{
uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
- Ptr<Ipv4> ipv4Local = QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4Local = GetObject<Ipv4> ();
NS_ASSERT (ipv4Local);
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
@@ -751,7 +751,7 @@
NS_ASSERT (tempNd);
Ptr<Node> tempNode = tempNd->GetNode ();
uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
- Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> tempIpv4 = tempNode->GetObject<Ipv4> ();
NS_ASSERT (tempIpv4);
Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
if (tempAddr < addrLocal)
@@ -842,7 +842,7 @@
GlobalRouter::FindIfIndexForDevice(Ptr<Node> node, Ptr<NetDevice> nd) const
{
NS_LOG_FUNCTION;
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT_MSG(ipv4, "QI for <Ipv4> interface failed");
for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i )
{
--- a/src/routing/global-routing/global-router-interface.h Thu Jan 31 21:58:13 2008 +0100
+++ b/src/routing/global-routing/global-router-interface.h Thu Jan 31 22:11:03 2008 +0100
@@ -558,7 +558,7 @@
/**
* @brief The Interface ID of the Global Router interface.
*
- * @see Object::QueryInterface ()
+ * @see Object::GetObject ()
*/
static TypeId GetTypeId (void);
--- a/src/routing/olsr/olsr-agent-impl.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/routing/olsr/olsr-agent-impl.cc Thu Jan 31 22:11:03 2008 +0100
@@ -186,10 +186,10 @@
m_linkTupleTimerFirstTime = true;
- m_ipv4 = node->QueryInterface<Ipv4> ();
+ m_ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT (m_ipv4);
- Ptr<SocketFactory> socketFactory = node->QueryInterface<SocketFactory> (Udp::GetTypeId ());
+ Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (Udp::GetTypeId ());
m_receiveSocket = socketFactory->CreateSocket ();
if (m_receiveSocket->Bind (InetSocketAddress (OLSR_PORT_NUMBER)))
--- a/src/routing/olsr/olsr-agent.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/src/routing/olsr/olsr-agent.cc Thu Jan 31 22:11:03 2008 +0100
@@ -44,7 +44,7 @@
Agent::CreateDefault (Ptr<Node> node)
{
TypeId tid = g_defaultImpl.GetValue ();
- Ptr<Agent> agent = tid.CreateObject (node)->QueryInterface<Agent> ();
+ Ptr<Agent> agent = tid.CreateObject (node)->GetObject<Agent> ();
return agent;
}
--- a/tutorial/point-to-point-ipv4-topology.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/tutorial/point-to-point-ipv4-topology.cc Thu Jan 31 22:11:03 2008 +0100
@@ -60,7 +60,7 @@
Ipv4Mask mask)
{
Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
uint32_t ifIndex = ipv4->AddInterface (nd);
ipv4->SetAddress (ifIndex, address);
--- a/utils/mobility-visualizer-model.cc Thu Jan 31 21:58:13 2008 +0100
+++ b/utils/mobility-visualizer-model.cc Thu Jan 31 22:11:03 2008 +0100
@@ -48,7 +48,7 @@
for (NodeList::Iterator nodeIter = NodeList::Begin (); nodeIter != NodeList::End (); nodeIter++)
{
Ptr<Node> node = *nodeIter;
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
+ Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
Vector pos = mobility->GetPosition ();
Vector vel = mobility->GetVelocity ();