QueryInterface -> GetObject

This commit is contained in:
Mathieu Lacage
2008-01-31 22:11:03 +01:00
parent 2786b195ee
commit 5ade799440
49 changed files with 139 additions and 139 deletions

View File

@@ -211,7 +211,7 @@ main (int argc, char *argv[])
// 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 @@ main (int argc, char *argv[])
// 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 @@ main (int argc, char *argv[])
// 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

View File

@@ -185,9 +185,9 @@ main (int argc, char *argv[])
// 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 @@ main (int argc, char *argv[])
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 ());

View File

@@ -205,9 +205,9 @@ main (int argc, char *argv[])
// 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

View File

@@ -206,9 +206,9 @@ main (int argc, char *argv[])
// 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

View File

@@ -173,9 +173,9 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
uint16_t servPort = 50000;
Ptr<SocketFactory> socketFactory =
n0->QueryInterface<SocketFactory> ();
n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();

View File

@@ -173,9 +173,9 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
uint16_t servPort = 50000;
Ptr<SocketFactory> socketFactory =
n0->QueryInterface<SocketFactory> ();
n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();

View File

@@ -136,9 +136,9 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
uint16_t servPort = 500;
Ptr<SocketFactory> socketFactory =
n0->QueryInterface<SocketFactory> ();
n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();

View File

@@ -154,9 +154,9 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
uint16_t servPort = 500;
Ptr<SocketFactory> socketFactory =
n0->QueryInterface<SocketFactory> ();
n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();

View File

@@ -165,9 +165,9 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
uint16_t servPort = 500;
Ptr<SocketFactory> socketFactory =
n0->QueryInterface<SocketFactory> ();
n0->GetObject<SocketFactory> ();
Ptr<Socket> localSocket = socketFactory->CreateSocket ();
localSocket->Bind ();

View File

@@ -58,14 +58,14 @@ CreateAdhocNode (Ptr<WifiChannel> channel,
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 @@ static Ptr<Socket>
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));

View File

@@ -102,14 +102,14 @@ CreateStaNode (Ptr<WifiChannel> channel,
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 ();
}

View File

@@ -39,7 +39,7 @@ int main (int argc, char *argv[])
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;

View File

@@ -43,7 +43,7 @@ RunSimulation (void)
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);

View File

@@ -155,7 +155,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Start
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);

View File

@@ -75,7 +75,7 @@ void PacketSink::StartApplication() // Called at time specified by Start
{
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);

View File

@@ -93,7 +93,7 @@ UdpEchoClient::StartApplication (void)
{
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);

View File

@@ -79,7 +79,7 @@ UdpEchoServer::StartApplication (void)
{
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);
}

View File

@@ -64,7 +64,7 @@ ErrorModel::CreateDefault (void)
{
NS_LOG_FUNCTION;
TypeId interfaceId = g_interfaceIdErrorModelDefaultValue.GetValue ();
Ptr<ErrorModel> em = interfaceId.CreateObject ()->QueryInterface<ErrorModel> ();
Ptr<ErrorModel> em = interfaceId.CreateObject ()->GetObject<ErrorModel> ();
return em;
}

View File

@@ -216,7 +216,7 @@ TypeIdTraceResolver::ParseForInterface (std::string path)
}
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 @@ Object::~Object ()
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 @@ ObjectTest::RunTests (void)
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 @@ ObjectTest::RunTests (void)
// 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;

View File

@@ -130,7 +130,7 @@ private:
*
* 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 @@ public:
* \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 @@ public:
* \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 @@ private:
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 @@ Object::Unref (void) const
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 @@ Object::QueryInterface () const
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)));

View File

@@ -101,7 +101,7 @@ CsmaIpv4Topology::AddIpv4Address(
{
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 @@ CsmaIpv4Topology::AddIpv4Routes (
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

View File

@@ -90,7 +90,7 @@ CsmaTopology::CreatePacketSocket(Ptr<Node> n1, std::string tid_name)
TypeId tid = TypeId::LookupByName (tid_name);
Ptr<SocketFactory> socketFactory =
n1->QueryInterface<SocketFactory> (tid);
n1->GetObject<SocketFactory> (tid);
Ptr<Socket> socket = socketFactory->CreateSocket ();

View File

@@ -111,14 +111,14 @@ PointToPointTopology::AddIpv4Addresses(
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 @@ PointToPointTopology::SetIpv4Metric(
// 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 @@ PointToPointTopology::SetIpv4Metric(
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 @@ PointToPointTopology::AddIpv4Routes (
}
// 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

View File

@@ -60,13 +60,13 @@ void
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, "<<

View File

@@ -71,7 +71,7 @@ ArpIpv4Interface::SendTo (Ptr<Packet> p, Ipv4Address dest)
{
NS_LOG_LOGIC ("Needs ARP");
Ptr<ArpL3Protocol> arp =
m_node->QueryInterface<ArpL3Protocol> ();
m_node->GetObject<ArpL3Protocol> ();
Address hardwareDestination;
bool found;

View File

@@ -80,7 +80,7 @@ ArpL3Protocol::FindCache (Ptr<NetDevice> device)
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 ());

View File

@@ -85,7 +85,7 @@ Ptr<TraceResolver>
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;

View File

@@ -751,7 +751,7 @@ Ipv4L3Protocol::ForwardUp (Ptr<Packet> p, Ipv4Header const&ip,
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);
}

View File

@@ -51,7 +51,7 @@ Ipv4LoopbackInterface::SendTo (Ptr<Packet> packet, Ipv4Address dest)
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"));

View File

@@ -168,7 +168,7 @@ void RttEstimator::InitialEstimate (Time e)
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;
}

View File

@@ -450,7 +450,7 @@ TcpL4Protocol::Send (Ptr<Packet> packet,
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 @@ TcpL4Protocol::SendPacket (Ptr<Packet> packet, TcpHeader outgoingHeader,
packet->AddHeader (outgoingHeader);
Ptr<Ipv4L3Protocol> ipv4 =
m_node->QueryInterface<Ipv4L3Protocol> ();
m_node->GetObject<Ipv4L3Protocol> ();
if (ipv4 != 0)
{
ipv4->Send (packet, saddr, daddr, PROT_NUMBER);

View File

@@ -234,7 +234,7 @@ TcpSocket::Connect (const Address & address)
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 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr<Packet> p,
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:

View File

@@ -159,7 +159,7 @@ UdpL4Protocol::Send (Ptr<Packet> packet,
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");

View File

@@ -268,7 +268,7 @@ UdpSocket::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
}
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 @@ UdpSocketTest::RunTests (void)
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 @@ UdpSocketTest::RunTests (void)
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 @@ UdpSocketTest::RunTests (void)
// 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 ------------

View File

@@ -43,7 +43,7 @@ GridTopology::LayoutOneRowFirst (Ptr<Object> object, uint32_t i)
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 @@ GridTopology::LayoutOneColumnFirst (Ptr<Object> object, uint32_t i)
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));
}

View File

@@ -37,9 +37,9 @@ HierarchicalMobilityModel::HierarchicalMobilityModel (Ptr<MobilityModel> child,
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> ();

View File

@@ -65,7 +65,7 @@ MobilityModel::GetDistanceFrom (Ptr<const MobilityModel> other) const
void
MobilityModel::NotifyCourseChange (void) const
{
Ptr<MobilityModelNotifier> notifier = QueryInterface<MobilityModelNotifier> ();
Ptr<MobilityModelNotifier> notifier = GetObject<MobilityModelNotifier> ();
if (notifier != 0)
{
notifier->Notify (this);

View File

@@ -49,7 +49,7 @@ Ns2MobilityFileTopology::GetMobilityModel (std::string idString, const ObjectSto
{
return 0;
}
Ptr<StaticSpeedMobilityModel> model = object->QueryInterface<StaticSpeedMobilityModel> ();
Ptr<StaticSpeedMobilityModel> model = object->GetObject<StaticSpeedMobilityModel> ();
if (model == 0)
{
model = CreateObject<StaticSpeedMobilityModel> ();

View File

@@ -41,7 +41,7 @@ g_mobility ("RandomTopologyMobilityType",
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 @@ RandomTopology::SetPositionModel (Ptr<RandomPosition> positionModel)
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);

View File

@@ -50,7 +50,7 @@ RandomWaypointMobilityModelParameters::RandomWaypointMobilityModelParameters ()
: 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,

View File

@@ -39,7 +39,7 @@ PacketSocketFactory::PacketSocketFactory ()
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
{
Ptr<Node> node = QueryInterface<Node> ();
Ptr<Node> node = GetObject<Node> ();
Ptr<PacketSocket> socket = CreateObject<PacketSocket> (node);
return socket;
}

View File

@@ -284,7 +284,7 @@ Queue::CreateDefault (void)
{
NS_LOG_FUNCTION;
TypeId interfaceId = g_interfaceIdDefaultValue.GetValue ();
Ptr<Queue> queue = interfaceId.CreateObject ()->QueryInterface<Queue> ();
Ptr<Queue> queue = interfaceId.CreateObject ()->GetObject<Queue> ();
return queue;
}

View File

@@ -392,7 +392,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase ()
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 @@ GlobalRouteManagerImpl::InitializeRoutes ()
// 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 @@ GlobalRouteManagerImpl::FindOutgoingTypeId (Ipv4Address a, Ipv4Mask amask)
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 @@ GlobalRouteManagerImpl::FindOutgoingTypeId (Ipv4Address a, Ipv4Mask amask)
// 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 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
// 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 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
// 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 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
// 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 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
// 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");

View File

@@ -496,7 +496,7 @@ GlobalRouter::GetRouterId (void) const
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 @@ GlobalRouter::DiscoverLSAs (void)
// 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 @@ GlobalRouter::DiscoverLSAs (void)
// 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 @@ GlobalRouter::DiscoverLSAs (void)
// 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 @@ GlobalRouter::DiscoverLSAs (void)
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 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr<Node> node,
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 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr<Node> node,
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::GetAdjacent(Ptr<NetDevice> nd, Ptr<Channel> ch) const
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 )
{

View File

@@ -558,7 +558,7 @@ public:
/**
* @brief The Interface ID of the Global Router interface.
*
* @see Object::QueryInterface ()
* @see Object::GetObject ()
*/
static TypeId GetTypeId (void);

View File

@@ -186,10 +186,10 @@ AgentImpl::AgentImpl (Ptr<Node> node)
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)))

View File

@@ -44,7 +44,7 @@ Ptr<Agent>
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;
}

View File

@@ -60,7 +60,7 @@ PointToPointIpv4Topology::AddAddress (
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);

View File

@@ -48,7 +48,7 @@ Sample ()
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 ();