--- a/examples/csma-multicast.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/examples/csma-multicast.cc Wed Jan 02 09:25:31 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::iid);
+ ipv4 = n2->QueryInterface<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::iid);
+ ipv4 = n0->QueryInterface<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::iid);
+ ipv4 = n4->QueryInterface<Ipv4> ();
ipv4->JoinMulticastGroup (multicastSource, multicastGroup);
//
// Create an OnOff application to send UDP datagrams from node zero to the
--- a/examples/simple-error-model.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/examples/simple-error-model.cc Wed Jan 02 09:25:31 2008 +0100
@@ -186,9 +186,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::iid);
+ ipv4 = n0->QueryInterface<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
- ipv4 = n3->QueryInterface<Ipv4> (Ipv4::iid);
+ ipv4 = n3->QueryInterface<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
//
@@ -205,8 +205,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>
- (RateErrorModel::iid);
+ Ptr<RateErrorModel> bem = em->QueryInterface<RateErrorModel> ();
if (bem)
{
bem->SetRandomVariable (UniformVariable ());
--- a/examples/simple-point-to-point-olsr.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/examples/simple-point-to-point-olsr.cc Wed Jan 02 09:25:31 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::iid);
+ ipv4 = n0->QueryInterface<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
- ipv4 = n3->QueryInterface<Ipv4> (Ipv4::iid);
+ ipv4 = n3->QueryInterface<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 Wed Jan 02 09:09:24 2008 +0100
+++ b/examples/simple-point-to-point.cc Wed Jan 02 09:25:31 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::iid);
+ ipv4 = n0->QueryInterface<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
- ipv4 = n3->QueryInterface<Ipv4> (Ipv4::iid);
+ ipv4 = n3->QueryInterface<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
--- a/samples/main-adhoc-wifi.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/samples/main-adhoc-wifi.cc Wed Jan 02 09:25:31 2008 +0100
@@ -58,14 +58,14 @@
static void
SetPosition (Ptr<Node> node, Vector position)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
+ Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
mobility->SetPosition (position);
}
static Vector
GetPosition (Ptr<Node> node)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
+ Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
return mobility->GetPosition ();
}
--- a/samples/main-ap-wifi.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/samples/main-ap-wifi.cc Wed Jan 02 09:25:31 2008 +0100
@@ -102,14 +102,14 @@
static void
SetPosition (Ptr<Node> node, Vector position)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
+ Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
mobility->SetPosition (position);
}
static Vector
GetPosition (Ptr<Node> node)
{
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
+ Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
return mobility->GetPosition ();
}
--- a/samples/main-grid-topology.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/samples/main-grid-topology.cc Wed Jan 02 09:25:31 2008 +0100
@@ -39,7 +39,7 @@
j != nodes.end (); j++)
{
Ptr<Object> object = *j;
- Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> (MobilityModel::iid);
+ Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> ();
NS_ASSERT (position != 0);
Vector pos = position->GetPosition ();
std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
--- a/src/core/component-manager.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/core/component-manager.cc Wed Jan 02 09:25:31 2008 +0100
@@ -341,14 +341,14 @@
bool ok = true;
Ptr<A> a = 0;
- a = ComponentManager::Create<A> (A::cidZero, A::iid);
+ a = ComponentManager::Create<A> (A::cidZero);
if (a == 0 ||
!a->m_zeroInvoked)
{
ok = false;
}
- a = ComponentManager::Create<A,bool> (A::cidOneBool, A::iid, true);
+ a = ComponentManager::Create<A,bool> (A::cidOneBool, true);
if (a == 0 ||
!a->m_oneBoolInvoked ||
!a->m_bool)
@@ -356,7 +356,7 @@
ok = false;
}
- a = ComponentManager::Create<A,bool> (A::cidOneBool, A::iid, false);
+ a = ComponentManager::Create<A,bool> (A::cidOneBool, false);
if (a == 0 ||
!a->m_oneBoolInvoked ||
a->m_bool)
@@ -364,7 +364,7 @@
ok = false;
}
- a = ComponentManager::Create<A,uint32_t> (A::cidOneUi32, A::iid, 10);
+ a = ComponentManager::Create<A,uint32_t> (A::cidOneUi32, 10);
if (a == 0 ||
!a->m_oneUi32Invoked ||
a->m_ui32 != 10)
@@ -372,7 +372,7 @@
ok = false;
}
- a = ComponentManager::Create<A> (A::cidOneUi32, A::iid, (uint32_t)10);
+ a = ComponentManager::Create<A> (A::cidOneUi32, (uint32_t)10);
if (a == 0 ||
!a->m_oneUi32Invoked ||
a->m_ui32 != 10)
@@ -380,7 +380,7 @@
ok = false;
}
- Ptr<B> b = ComponentManager::Create<B,uint32_t> (A::cidOneUi32, B::iid, 10);
+ Ptr<B> b = ComponentManager::Create<B,uint32_t> (A::cidOneUi32, 10);
if (b == 0)
{
ok = false;
--- a/src/core/component-manager.h Wed Jan 02 09:09:24 2008 +0100
+++ b/src/core/component-manager.h Wed Jan 02 09:25:31 2008 +0100
@@ -264,7 +264,6 @@
/**
* \param classId class id of the constructor to invoke.
- * \param iid interface id to query for
* \return a pointer to the instance created.
*
* Create an instance of the object identified by its
@@ -272,11 +271,10 @@
* result.
*/
template <typename T>
- static Ptr<T> Create (ClassId classId, InterfaceId iid);
+ static Ptr<T> Create (ClassId classId);
/**
* \param classId class id of the constructor to invoke.
- * \param iid interface id to query for
* \param a1 first argument to pass to constructor
* \return a pointer to the instance created.
*
@@ -285,11 +283,10 @@
* result.
*/
template <typename T, typename T1>
- static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1);
+ static Ptr<T> Create (ClassId classId, T1 a1);
/**
* \param classId class id of the constructor to invoke.
- * \param iid interface id to query for
* \param a1 first argument to pass to constructor
* \param a2 second argument to pass to constructor
* \return a pointer to the instance created.
@@ -299,11 +296,10 @@
* result.
*/
template <typename T, typename T1, typename T2>
- static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2);
+ static Ptr<T> Create (ClassId classId, T1 a1, T2 a2);
/**
* \param classId class id of the constructor to invoke.
- * \param iid interface id to query for
* \param a1 first argument to pass to constructor
* \param a2 second argument to pass to constructor
* \param a3 third argument to pass to constructor
@@ -314,11 +310,10 @@
* result.
*/
template <typename T, typename T1, typename T2, typename T3>
- static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3);
+ static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3);
/**
* \param classId class id of the constructor to invoke.
- * \param iid interface id to query for
* \param a1 first argument to pass to constructor
* \param a2 second argument to pass to constructor
* \param a3 third argument to pass to constructor
@@ -330,11 +325,10 @@
* result.
*/
template <typename T, typename T1, typename T2, typename T3, typename T4>
- static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4);
+ static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4);
/**
* \param classId class id of the constructor to invoke.
- * \param iid interface id to query for
* \param a1 first argument to pass to constructor
* \param a2 second argument to pass to constructor
* \param a3 third argument to pass to constructor
@@ -347,11 +341,11 @@
* result.
*/
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
- static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+ static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
private:
friend void RegisterCallback (ClassId classId, CallbackBase *callback,
- std::vector<const InterfaceId *> supportedInterfaces);
+ std::vector<const InterfaceId *> supportedInterfaces);
static void Register (ClassId classId, CallbackBase *callback,
std::vector<const InterfaceId *> supportedInterfaces);
@@ -627,56 +621,56 @@
template <typename T>
Ptr<T>
-ComponentManager::Create (ClassId classId, InterfaceId iid)
+ComponentManager::Create (ClassId classId)
{
Ptr<Object> obj = Create (classId);
- Ptr<T> i = obj->QueryInterface<T> (iid);
+ Ptr<T> i = obj->QueryInterface<T> ();
return i;
}
template <typename T, typename T1>
Ptr<T>
-ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1)
+ComponentManager::Create (ClassId classId, T1 a1)
{
Ptr<Object> obj = Create (classId, a1);
- Ptr<T> i = obj->QueryInterface<T> (iid);
+ Ptr<T> i = obj->QueryInterface<T> ();
return i;
}
template <typename T, typename T1, typename T2>
Ptr<T>
-ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2)
+ComponentManager::Create (ClassId classId, T1 a1, T2 a2)
{
Ptr<Object> obj = Create (classId, a1, a2);
- Ptr<T> i = obj->QueryInterface<T> (iid);
+ Ptr<T> i = obj->QueryInterface<T> ();
return i;
}
template <typename T, typename T1, typename T2, typename T3>
Ptr<T>
-ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3)
+ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3)
{
Ptr<Object> obj = Create (classId, a1, a2, a3);
- Ptr<T> i = obj->QueryInterface<T> (iid);
+ Ptr<T> i = obj->QueryInterface<T> ();
return i;
}
template <typename T, typename T1, typename T2, typename T3, typename T4>
Ptr<T>
-ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4)
+ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4)
{
Ptr<Object> obj = Create (classId, a1, a2, a3, a4);
- Ptr<T> i = obj->QueryInterface<T> (iid);
+ Ptr<T> i = obj->QueryInterface<T> ();
return i;
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
Ptr<T>
-ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
+ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
{
Ptr<Object> obj = Create (classId, a1, a2, a3, a4, a5);
- Ptr<T> i = obj->QueryInterface<T> (iid);
+ Ptr<T> i = obj->QueryInterface<T> ();
return i;
}
--- a/src/core/object.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/core/object.cc Wed Jan 02 09:25:31 2008 +0100
@@ -91,7 +91,7 @@
Ptr<Object> interface = m_aggregate->QueryInterface<Object> (interfaceId);
return interface;
}
-void
+void
InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
{
Ptr<const Object> interface = ParseForInterface (path);
@@ -546,46 +546,46 @@
bool result = true;
Ptr<BaseA> baseA = CreateObject<BaseA> ();
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), baseA);
+ NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), 0);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
+ NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (), 0);
baseA = CreateObject<DerivedA> (10);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), baseA);
+ NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), baseA);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
+ NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (), 0);
baseA = CreateObject<BaseA> ();
Ptr<BaseB> baseB = CreateObject<BaseB> ();
Ptr<BaseB> baseBCopy = baseB;
baseA->AddInterface (baseB);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), 0);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (BaseB::iid), 0);
- NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedB> (DerivedB::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (BaseB::iid), 0);
- NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedB> (DerivedB::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (BaseA::iid), 0);
- NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedA> (DerivedA::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (BaseA::iid), 0);
+ 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);
baseA = CreateObject<DerivedA> (1);
baseB = CreateObject<DerivedB> (1);
baseBCopy = baseB;
baseA->AddInterface (baseB);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedB> (DerivedB::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (BaseB::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedA> (DerivedA::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (BaseA::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<DerivedA> (DerivedA::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (BaseA::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedB> (DerivedB::iid), 0);
- NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (BaseB::iid), 0)
+ 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)
baseA = CreateObject<BaseA> ();
baseB = CreateObject<BaseB> ();
baseA->AddInterface (baseB);
baseA = 0;
- baseA = baseB->QueryInterface<BaseA> (BaseA::iid);
+ baseA = baseB->QueryInterface<BaseA> ();
baseA = CreateObject<BaseA> ();
baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
--- a/src/core/object.h Wed Jan 02 09:09:24 2008 +0100
+++ b/src/core/object.h Wed Jan 02 09:25:31 2008 +0100
@@ -117,9 +117,13 @@
*/
inline void Unref (void) const;
/**
- * \param iid the interface requested
* \returns a pointer to the requested interface or zero if it could not be found.
- *
+ */
+ template <typename T>
+ Ptr<T> QueryInterface (void) const;
+ /**
+ * \param iid 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 (InterfaceId iid) const;
@@ -259,6 +263,18 @@
template <typename T>
Ptr<T>
+Object::QueryInterface () const
+{
+ Ptr<Object> found = DoQueryInterface (T::iid);
+ if (found != 0)
+ {
+ return Ptr<T> (dynamic_cast<T *> (PeekPointer (found)));
+ }
+ return 0;
+}
+
+template <typename T>
+Ptr<T>
Object::QueryInterface (InterfaceId iid) const
{
Ptr<Object> found = DoQueryInterface (iid);
--- a/src/devices/csma/csma-ipv4-topology.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/devices/csma/csma-ipv4-topology.cc Wed Jan 02 09:25:31 2008 +0100
@@ -101,7 +101,7 @@
{
Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = node->QueryInterface<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> (Ipv4::iid);
- Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> ();
NS_ASSERT(ip1 != 0 && ip2 != 0);
// Get interface indexes for both nodes corresponding to the right channel
--- a/src/devices/point-to-point/point-to-point-topology.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/devices/point-to-point/point-to-point-topology.cc Wed Jan 02 09:25:31 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> (Ipv4::iid);
+ Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> ();
uint32_t index1 = ip1->AddInterface (nd1);
ip1->SetAddress (index1, addr1);
ip1->SetNetworkMask (index1, netmask);
ip1->SetUp (index1);
- Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ip2 = n2->QueryInterface<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> (Ipv4::iid);
+ Ptr<Ipv4> ip1 = n1->QueryInterface<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> (Ipv4::iid);
+ Ptr<Ipv4> ip2 = n2->QueryInterface<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> (Ipv4::iid);
- Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> ();
+ Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<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 Wed Jan 02 09:09:24 2008 +0100
+++ b/src/devices/wifi/wifi-channel.cc Wed Jan 02 09:25:31 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> (MobilityModel::iid);
+ Ptr<MobilityModel> senderMobility = sender->GetNode ()->QueryInterface<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> (MobilityModel::iid);
+ Ptr<MobilityModel> receiverMobility = i->first->GetNode ()->QueryInterface<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 Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/arp-ipv4-interface.cc Wed Jan 02 09:25:31 2008 +0100
@@ -71,7 +71,7 @@
{
NS_LOG_LOGIC ("Needs ARP");
Ptr<ArpL3Protocol> arp =
- m_node->QueryInterface<ArpL3Protocol> (ArpL3Protocol::iid);
+ m_node->QueryInterface<ArpL3Protocol> ();
Address hardwareDestination;
bool found;
--- a/src/internet-node/arp-l3-protocol.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/arp-l3-protocol.cc Wed Jan 02 09:25:31 2008 +0100
@@ -71,7 +71,7 @@
return *i;
}
}
- Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
+ Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> ();
Ptr<Ipv4Interface> interface = ipv4->FindInterfaceForDevice (device);
ArpCache * cache = new ArpCache (device, interface);
NS_ASSERT (device->IsBroadcast ());
--- a/src/internet-node/internet-node.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/internet-node.cc Wed Jan 02 09:25:31 2008 +0100
@@ -78,7 +78,7 @@
InternetNode::GetTraceResolver () const
{
Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
- Ptr<Ipv4L3Protocol> ipv4 = QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
+ Ptr<Ipv4L3Protocol> ipv4 = QueryInterface<Ipv4L3Protocol> ();
resolver->AddComposite ("ipv4", ipv4);
resolver->SetParentResolver (Node::GetTraceResolver ());
return resolver;
--- a/src/internet-node/ipv4-l3-protocol.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/ipv4-l3-protocol.cc Wed Jan 02 09:25:31 2008 +0100
@@ -742,7 +742,7 @@
NS_LOG_FUNCTION;
NS_LOG_PARAMS (this << p << &ip);
- Ptr<Ipv4L4Demux> demux = m_node->QueryInterface<Ipv4L4Demux> (Ipv4L4Demux::iid);
+ Ptr<Ipv4L4Demux> demux = m_node->QueryInterface<Ipv4L4Demux> ();
Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface);
}
--- a/src/internet-node/ipv4-loopback-interface.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/ipv4-loopback-interface.cc Wed Jan 02 09:25:31 2008 +0100
@@ -51,7 +51,7 @@
NS_LOG_PARAMS (this << packet << dest);
Ptr<Ipv4L3Protocol> ipv4 =
- m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
+ m_node->QueryInterface<Ipv4L3Protocol> ();
ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER,
Mac48Address ("ff:ff:ff:ff:ff:ff"));
--- a/src/internet-node/udp-l4-protocol.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/udp-l4-protocol.cc Wed Jan 02 09:25:31 2008 +0100
@@ -159,7 +159,7 @@
packet->AddHeader (udpHeader);
- Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
+ Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> ();
if (ipv4 != 0)
{
NS_LOG_LOGIC ("Sending to IP");
--- a/src/internet-node/udp-socket.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/internet-node/udp-socket.cc Wed Jan 02 09:25:31 2008 +0100
@@ -268,7 +268,7 @@
}
uint32_t localIfIndex;
- Ptr<Ipv4> ipv4 = m_node->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = m_node->QueryInterface<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> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = rxNode->QueryInterface<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::iid);
+ ipv4 = txNode->QueryInterface<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<SocketFactory> (Udp::iid);
+ Ptr<SocketFactory> rxSocketFactory = rxNode->QueryInterface<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<SocketFactory> (Udp::iid);
+ Ptr<SocketFactory> txSocketFactory = txNode->QueryInterface<Udp> ();
Ptr<Socket> txSocket = txSocketFactory->CreateSocket ();
// ------ Now the tests ------------
--- a/src/mobility/hierarchical-mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/mobility/hierarchical-mobility-model.cc Wed Jan 02 09:25:31 2008 +0100
@@ -27,9 +27,9 @@
m_parent (parent)
{
Ptr<MobilityModelNotifier> childNotifier =
- m_child->QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
+ m_child->QueryInterface<MobilityModelNotifier> ();
Ptr<MobilityModelNotifier> parentNotifier =
- m_parent->QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
+ m_parent->QueryInterface<MobilityModelNotifier> ();
if (childNotifier == 0)
{
childNotifier = CreateObject<MobilityModelNotifier> ();
--- a/src/mobility/mobility-model.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/mobility/mobility-model.cc Wed Jan 02 09:25:31 2008 +0100
@@ -59,8 +59,7 @@
void
MobilityModel::NotifyCourseChange (void) const
{
- Ptr<MobilityModelNotifier> notifier =
- QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
+ Ptr<MobilityModelNotifier> notifier = QueryInterface<MobilityModelNotifier> ();
if (notifier != 0)
{
notifier->Notify (this);
--- a/src/mobility/ns2-mobility-file-topology.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/mobility/ns2-mobility-file-topology.cc Wed Jan 02 09:25:31 2008 +0100
@@ -49,8 +49,7 @@
{
return 0;
}
- Ptr<StaticSpeedMobilityModel> model =
- object->QueryInterface<StaticSpeedMobilityModel> (StaticSpeedMobilityModel::iid);
+ Ptr<StaticSpeedMobilityModel> model = object->QueryInterface<StaticSpeedMobilityModel> ();
if (model == 0)
{
model = CreateObject<StaticSpeedMobilityModel> ();
--- a/src/node/packet-socket-factory.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/node/packet-socket-factory.cc Wed Jan 02 09:25:31 2008 +0100
@@ -32,7 +32,7 @@
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
{
- Ptr<Node> node = QueryInterface<Node> (Node::iid);
+ Ptr<Node> node = QueryInterface<Node> ();
Ptr<PacketSocket> socket = CreateObject<PacketSocket> (node);
return socket;
}
--- a/src/routing/global-routing/global-route-manager-impl.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/routing/global-routing/global-route-manager-impl.cc Wed Jan 02 09:25:31 2008 +0100
@@ -392,7 +392,7 @@
Ptr<Node> node = *i;
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
+ node->QueryInterface<GlobalRouter> ();
//
// Ignore nodes that aren't participating in routing.
//
@@ -476,7 +476,7 @@
// participating in routing.
//
Ptr<GlobalRouter> rtr =
- node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
+ node->QueryInterface<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> (GlobalRouter::iid);
+ node->QueryInterface<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> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
NS_ASSERT_MSG (ipv4,
"GlobalRouteManagerImpl::FindOutgoingInterfaceId (): "
"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> (GlobalRouter::iid);
+ node->QueryInterface<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> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = node->QueryInterface<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> (GlobalRouter::iid);
+ node->QueryInterface<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> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
NS_ASSERT_MSG (ipv4,
"GlobalRouteManagerImpl::SPFIntraAddTransit (): "
"QI for <Ipv4> interface failed");
--- a/src/routing/global-routing/global-router-interface.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/routing/global-routing/global-router-interface.cc Wed Jan 02 09:25:31 2008 +0100
@@ -489,7 +489,7 @@
GlobalRouter::DiscoverLSAs (void)
{
NS_LOG_FUNCTION;
- Ptr<Node> node = QueryInterface<Node> (Node::iid);
+ Ptr<Node> node = QueryInterface<Node> ();
NS_LOG_LOGIC("For node " << node->GetId () );
NS_ASSERT_MSG(node,
"GlobalRouter::DiscoverLSAs (): <Node> interface not set");
@@ -505,7 +505,7 @@
// Ipv4 interface. This is where the information regarding the attached
// interfaces lives.
//
- Ptr<Ipv4> ipv4Local = node->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4Local = node->QueryInterface<Ipv4> ();
NS_ASSERT_MSG(ipv4Local,
"GlobalRouter::DiscoverLSAs (): QI for <Ipv4> interface failed");
//
@@ -624,7 +624,7 @@
// device for its node, then ask that node for its Ipv4 interface.
//
Ptr<Node> nodeRemote = ndRemote->GetNode();
- Ptr<Ipv4> ipv4Remote = nodeRemote->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4Remote = nodeRemote->QueryInterface<Ipv4> ();
NS_ASSERT_MSG(ipv4Remote,
"GlobalRouter::DiscoverLSAs (): QI for remote <Ipv4> failed");
//
@@ -632,7 +632,7 @@
// well get it now.
//
Ptr<GlobalRouter> srRemote =
- nodeRemote->QueryInterface<GlobalRouter> (GlobalRouter::iid);
+ nodeRemote->QueryInterface<GlobalRouter> ();
NS_ASSERT_MSG(srRemote,
"GlobalRouter::DiscoverLSAs():QI for remote <GlobalRouter> failed");
Ipv4Address rtrIdRemote = srRemote->GetRouterId();
@@ -710,7 +710,7 @@
NS_ASSERT (tempNd);
Ptr<Node> tempNode = tempNd->GetNode ();
uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
- Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> ();
NS_ASSERT (tempIpv4);
Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
pLSA->AddAttachedRouter (tempAddr);
@@ -728,7 +728,7 @@
Ptr<NetDevice> ndLocal) const
{
uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
- Ptr<Ipv4> ipv4Local = QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4Local = QueryInterface<Ipv4> ();
NS_ASSERT (ipv4Local);
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
@@ -744,7 +744,7 @@
NS_ASSERT (tempNd);
Ptr<Node> tempNode = tempNd->GetNode ();
uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
- Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> ();
NS_ASSERT (tempIpv4);
Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
if (tempAddr < addrLocal)
@@ -835,7 +835,7 @@
GlobalRouter::FindIfIndexForDevice(Ptr<Node> node, Ptr<NetDevice> nd) const
{
NS_LOG_FUNCTION;
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
NS_ASSERT_MSG(ipv4, "QI for <Ipv4> interface failed");
for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i )
{
--- a/src/routing/olsr/olsr-agent-impl.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/routing/olsr/olsr-agent-impl.cc Wed Jan 02 09:25:31 2008 +0100
@@ -175,7 +175,7 @@
m_linkTupleTimerFirstTime = true;
- m_ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
+ m_ipv4 = node->QueryInterface<Ipv4> ();
NS_ASSERT (m_ipv4);
Ptr<SocketFactory> socketFactory = node->QueryInterface<SocketFactory> (Udp::iid);
--- a/src/routing/olsr/olsr.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/src/routing/olsr/olsr.cc Wed Jan 02 09:25:31 2008 +0100
@@ -34,7 +34,7 @@
EnableNode (Ptr<Node> node)
{
ComponentManager::Create<olsr::Agent, Ptr<Node> >
- (olsr::Agent::cid, olsr::Agent::iid, node)->Start ();
+ (olsr::Agent::cid, node)->Start ();
}
--- a/tutorial/point-to-point-ipv4-topology.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/tutorial/point-to-point-ipv4-topology.cc Wed Jan 02 09:25:31 2008 +0100
@@ -60,7 +60,7 @@
Ipv4Mask mask)
{
Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
- Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
+ Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
uint32_t ifIndex = ipv4->AddInterface (nd);
ipv4->SetAddress (ifIndex, address);
--- a/utils/mobility-visualizer-model.cc Wed Jan 02 09:09:24 2008 +0100
+++ b/utils/mobility-visualizer-model.cc Wed Jan 02 09:25:31 2008 +0100
@@ -47,7 +47,7 @@
for (NodeList::Iterator nodeIter = NodeList::Begin (); nodeIter != NodeList::End (); nodeIter++)
{
Ptr<Node> node = *nodeIter;
- Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
+ Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
Vector pos = mobility->GetPosition ();
Vector vel = mobility->GetVelocity ();