View | Details | Raw Unified | Return to bug 122
Collapse All | Expand All

(-)a/examples/csma-multicast.cc (-3 / +3 lines)
 Lines 211-217   main (int argc, char *argv[]) Link Here 
211
// a fine time to find the interface indices on node two.
211
// a fine time to find the interface indices on node two.
212
//
212
//
213
  Ptr<Ipv4> ipv4;
213
  Ptr<Ipv4> ipv4;
214
  ipv4 = n2->QueryInterface<Ipv4> (Ipv4::iid);
214
  ipv4 = n2->QueryInterface<Ipv4> ();
215
215
216
  uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr (n2Lan0Addr);
216
  uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr (n2Lan0Addr);
217
  uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr (n2Lan1Addr);
217
  uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr (n2Lan1Addr);
 Lines 261-267   main (int argc, char *argv[]) Link Here 
261
// interface to find the output interface index, and tell node zero to send
261
// interface to find the output interface index, and tell node zero to send
262
// its multicast traffic out that interface.
262
// its multicast traffic out that interface.
263
//
263
//
264
  ipv4 = n0->QueryInterface<Ipv4> (Ipv4::iid);
264
  ipv4 = n0->QueryInterface<Ipv4> ();
265
  uint32_t ifIndexSrc = ipv4->FindInterfaceForAddr (multicastSource);
265
  uint32_t ifIndexSrc = ipv4->FindInterfaceForAddr (multicastSource);
266
  ipv4->SetDefaultMulticastRoute (ifIndexSrc);
266
  ipv4->SetDefaultMulticastRoute (ifIndexSrc);
267
//
267
//
 Lines 269-275   main (int argc, char *argv[]) Link Here 
269
// multicast data.  To enable forwarding bits up the protocol stack, we need
269
// multicast data.  To enable forwarding bits up the protocol stack, we need
270
// to tell the stack to join the multicast group.
270
// to tell the stack to join the multicast group.
271
//
271
//
272
  ipv4 = n4->QueryInterface<Ipv4> (Ipv4::iid);
272
  ipv4 = n4->QueryInterface<Ipv4> ();
273
  ipv4->JoinMulticastGroup (multicastSource, multicastGroup);
273
  ipv4->JoinMulticastGroup (multicastSource, multicastGroup);
274
//
274
//
275
// Create an OnOff application to send UDP datagrams from node zero to the
275
// Create an OnOff application to send UDP datagrams from node zero to the
(-)a/examples/simple-error-model.cc (-4 / +3 lines)
 Lines 186-194   main (int argc, char *argv[]) Link Here 
186
  // This will likely set by some global StaticRouting object in the future
186
  // This will likely set by some global StaticRouting object in the future
187
  NS_LOG_INFO ("Set Default Routes.");
187
  NS_LOG_INFO ("Set Default Routes.");
188
  Ptr<Ipv4> ipv4;
188
  Ptr<Ipv4> ipv4;
189
  ipv4 = n0->QueryInterface<Ipv4> (Ipv4::iid);
189
  ipv4 = n0->QueryInterface<Ipv4> ();
190
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
190
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
191
  ipv4 = n3->QueryInterface<Ipv4> (Ipv4::iid);
191
  ipv4 = n3->QueryInterface<Ipv4> ();
192
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
192
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
193
193
194
  //
194
  //
 Lines 205-212   main (int argc, char *argv[]) Link Here 
205
  NS_ASSERT (em != 0);
205
  NS_ASSERT (em != 0);
206
  // Now, query interface on the resulting em pointer to see if a 
206
  // Now, query interface on the resulting em pointer to see if a 
207
  // RateErrorModel interface exists.  If so, set the packet error rate
207
  // RateErrorModel interface exists.  If so, set the packet error rate
208
  Ptr<RateErrorModel> bem = em->QueryInterface<RateErrorModel> 
208
  Ptr<RateErrorModel> bem = em->QueryInterface<RateErrorModel> ();
209
    (RateErrorModel::iid);
210
  if (bem)
209
  if (bem)
211
    { 
210
    { 
212
      bem->SetRandomVariable (UniformVariable ());
211
      bem->SetRandomVariable (UniformVariable ());
(-)a/examples/simple-point-to-point-olsr.cc (-2 / +2 lines)
 Lines 205-213   main (int argc, char *argv[]) Link Here 
205
  // This will likely set by some global StaticRouting object in the future
205
  // This will likely set by some global StaticRouting object in the future
206
  NS_LOG_INFO ("Set Default Routes.");
206
  NS_LOG_INFO ("Set Default Routes.");
207
  Ptr<Ipv4> ipv4;
207
  Ptr<Ipv4> ipv4;
208
  ipv4 = n0->QueryInterface<Ipv4> (Ipv4::iid);
208
  ipv4 = n0->QueryInterface<Ipv4> ();
209
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
209
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
210
  ipv4 = n3->QueryInterface<Ipv4> (Ipv4::iid);
210
  ipv4 = n3->QueryInterface<Ipv4> ();
211
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
211
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
212
  
212
  
213
  // Configure tracing of all enqueue, dequeue, and NetDevice receive events
213
  // Configure tracing of all enqueue, dequeue, and NetDevice receive events
(-)a/examples/simple-point-to-point.cc (-2 / +2 lines)
 Lines 206-214   main (int argc, char *argv[]) Link Here 
206
  // This will likely set by some global StaticRouting object in the future
206
  // This will likely set by some global StaticRouting object in the future
207
  NS_LOG_INFO ("Set Default Routes.");
207
  NS_LOG_INFO ("Set Default Routes.");
208
  Ptr<Ipv4> ipv4;
208
  Ptr<Ipv4> ipv4;
209
  ipv4 = n0->QueryInterface<Ipv4> (Ipv4::iid);
209
  ipv4 = n0->QueryInterface<Ipv4> ();
210
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
210
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
211
  ipv4 = n3->QueryInterface<Ipv4> (Ipv4::iid);
211
  ipv4 = n3->QueryInterface<Ipv4> ();
212
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
212
  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
213
  
213
  
214
  // Configure tracing of all enqueue, dequeue, and NetDevice receive events
214
  // Configure tracing of all enqueue, dequeue, and NetDevice receive events
(-)a/samples/main-adhoc-wifi.cc (-2 / +2 lines)
 Lines 58-71   static void Link Here 
58
static void
58
static void
59
SetPosition (Ptr<Node> node, Vector position)
59
SetPosition (Ptr<Node> node, Vector position)
60
{
60
{
61
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
61
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
62
  mobility->SetPosition (position);
62
  mobility->SetPosition (position);
63
}
63
}
64
64
65
static Vector
65
static Vector
66
GetPosition (Ptr<Node> node)
66
GetPosition (Ptr<Node> node)
67
{
67
{
68
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
68
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
69
  return mobility->GetPosition ();
69
  return mobility->GetPosition ();
70
}
70
}
71
71
(-)a/samples/main-ap-wifi.cc (-2 / +2 lines)
 Lines 102-115   static void Link Here 
102
static void
102
static void
103
SetPosition (Ptr<Node> node, Vector position)
103
SetPosition (Ptr<Node> node, Vector position)
104
{
104
{
105
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
105
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
106
  mobility->SetPosition (position);
106
  mobility->SetPosition (position);
107
}
107
}
108
108
109
static Vector
109
static Vector
110
GetPosition (Ptr<Node> node)
110
GetPosition (Ptr<Node> node)
111
{
111
{
112
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
112
  Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
113
  return mobility->GetPosition ();
113
  return mobility->GetPosition ();
114
}
114
}
115
115
(-)a/samples/main-grid-topology.cc (-1 / +1 lines)
 Lines 39-45   int main (int argc, char *argv[]) Link Here 
39
       j != nodes.end (); j++)
39
       j != nodes.end (); j++)
40
    {
40
    {
41
      Ptr<Object> object = *j;
41
      Ptr<Object> object = *j;
42
      Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> (MobilityModel::iid);
42
      Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> ();
43
      NS_ASSERT (position != 0);
43
      NS_ASSERT (position != 0);
44
      Vector pos = position->GetPosition ();
44
      Vector pos = position->GetPosition ();
45
      std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
45
      std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
(-)a/src/core/component-manager.cc (-6 / +6 lines)
 Lines 346-359   ComponentManagerTest::RunTests (void) Link Here 
346
  bool ok = true;
346
  bool ok = true;
347
347
348
  Ptr<A> a = 0;
348
  Ptr<A> a = 0;
349
  a = ComponentManager::Create<A> (A::cidZero, A::iid);
349
  a = ComponentManager::Create<A> (A::cidZero);
350
  if (a == 0 ||
350
  if (a == 0 ||
351
      !a->m_zeroInvoked)
351
      !a->m_zeroInvoked)
352
    {
352
    {
353
      ok = false;
353
      ok = false;
354
    }
354
    }
355
355
356
  a = ComponentManager::Create<A,bool> (A::cidOneBool, A::iid, true);
356
  a = ComponentManager::Create<A,bool> (A::cidOneBool, true);
357
  if (a == 0 ||
357
  if (a == 0 ||
358
      !a->m_oneBoolInvoked ||
358
      !a->m_oneBoolInvoked ||
359
      !a->m_bool)
359
      !a->m_bool)
 Lines 361-367   ComponentManagerTest::RunTests (void) Link Here 
361
      ok = false;
361
      ok = false;
362
    }
362
    }
363
363
364
  a = ComponentManager::Create<A,bool> (A::cidOneBool, A::iid, false);
364
  a = ComponentManager::Create<A,bool> (A::cidOneBool, false);
365
  if (a == 0 ||
365
  if (a == 0 ||
366
      !a->m_oneBoolInvoked ||
366
      !a->m_oneBoolInvoked ||
367
      a->m_bool)
367
      a->m_bool)
 Lines 369-375   ComponentManagerTest::RunTests (void) Link Here 
369
      ok = false;
369
      ok = false;
370
    }
370
    }
371
371
372
  a = ComponentManager::Create<A,uint32_t> (A::cidOneUi32, A::iid, 10);
372
  a = ComponentManager::Create<A,uint32_t> (A::cidOneUi32, 10);
373
  if (a == 0 ||
373
  if (a == 0 ||
374
      !a->m_oneUi32Invoked ||
374
      !a->m_oneUi32Invoked ||
375
      a->m_ui32 != 10)
375
      a->m_ui32 != 10)
 Lines 377-383   ComponentManagerTest::RunTests (void) Link Here 
377
      ok = false;
377
      ok = false;
378
    }
378
    }
379
379
380
  a = ComponentManager::Create<A> (A::cidOneUi32, A::iid, (uint32_t)10);
380
  a = ComponentManager::Create<A> (A::cidOneUi32, (uint32_t)10);
381
  if (a == 0 ||
381
  if (a == 0 ||
382
      !a->m_oneUi32Invoked ||
382
      !a->m_oneUi32Invoked ||
383
      a->m_ui32 != 10)
383
      a->m_ui32 != 10)
 Lines 385-391   ComponentManagerTest::RunTests (void) Link Here 
385
      ok = false;
385
      ok = false;
386
    }
386
    }
387
387
388
  Ptr<B> b = ComponentManager::Create<B,uint32_t> (A::cidOneUi32, B::iid, 10);
388
  Ptr<B> b = ComponentManager::Create<B,uint32_t> (A::cidOneUi32, 10);
389
  if (b == 0)
389
  if (b == 0)
390
    {
390
    {
391
      ok = false;
391
      ok = false;
(-)a/src/core/component-manager.h (-25 / +19 lines)
 Lines 264-270   public: Link Here 
264
264
265
  /**
265
  /**
266
   * \param classId class id of the constructor to invoke.
266
   * \param classId class id of the constructor to invoke.
267
   * \param iid interface id to query for
268
   * \return a pointer to the instance created.
267
   * \return a pointer to the instance created.
269
   *
268
   *
270
   * Create an instance of the object identified by its
269
   * Create an instance of the object identified by its
 Lines 272-282   public: Link Here 
272
   * result.
271
   * result.
273
   */
272
   */
274
  template <typename T>
273
  template <typename T>
275
  static Ptr<T> Create (ClassId classId, InterfaceId iid);
274
  static Ptr<T> Create (ClassId classId);
276
275
277
  /**
276
  /**
278
   * \param classId class id of the constructor to invoke.
277
   * \param classId class id of the constructor to invoke.
279
   * \param iid interface id to query for
280
   * \param a1 first argument to pass to constructor
278
   * \param a1 first argument to pass to constructor
281
   * \return a pointer to the instance created.
279
   * \return a pointer to the instance created.
282
   *
280
   *
 Lines 285-295   public: Link Here 
285
   * result.
283
   * result.
286
   */
284
   */
287
  template <typename T, typename T1>
285
  template <typename T, typename T1>
288
  static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1);
286
  static Ptr<T> Create (ClassId classId, T1 a1);
289
287
290
  /**
288
  /**
291
   * \param classId class id of the constructor to invoke.
289
   * \param classId class id of the constructor to invoke.
292
   * \param iid interface id to query for
293
   * \param a1 first argument to pass to constructor
290
   * \param a1 first argument to pass to constructor
294
   * \param a2 second argument to pass to constructor
291
   * \param a2 second argument to pass to constructor
295
   * \return a pointer to the instance created.
292
   * \return a pointer to the instance created.
 Lines 299-309   public: Link Here 
299
   * result.
296
   * result.
300
   */
297
   */
301
  template <typename T, typename T1, typename T2>
298
  template <typename T, typename T1, typename T2>
302
  static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2);
299
  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2);
303
300
304
  /**
301
  /**
305
   * \param classId class id of the constructor to invoke.
302
   * \param classId class id of the constructor to invoke.
306
   * \param iid interface id to query for
307
   * \param a1 first argument to pass to constructor
303
   * \param a1 first argument to pass to constructor
308
   * \param a2 second argument to pass to constructor
304
   * \param a2 second argument to pass to constructor
309
   * \param a3 third argument to pass to constructor
305
   * \param a3 third argument to pass to constructor
 Lines 314-324   public: Link Here 
314
   * result.
310
   * result.
315
   */
311
   */
316
  template <typename T, typename T1, typename T2, typename T3>
312
  template <typename T, typename T1, typename T2, typename T3>
317
  static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3);
313
  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3);
318
314
319
  /**
315
  /**
320
   * \param classId class id of the constructor to invoke.
316
   * \param classId class id of the constructor to invoke.
321
   * \param iid interface id to query for
322
   * \param a1 first argument to pass to constructor
317
   * \param a1 first argument to pass to constructor
323
   * \param a2 second argument to pass to constructor
318
   * \param a2 second argument to pass to constructor
324
   * \param a3 third argument to pass to constructor
319
   * \param a3 third argument to pass to constructor
 Lines 330-340   public: Link Here 
330
   * result.
325
   * result.
331
   */
326
   */
332
  template <typename T, typename T1, typename T2, typename T3, typename T4>
327
  template <typename T, typename T1, typename T2, typename T3, typename T4>
333
  static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4);
328
  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4);
334
329
335
  /**
330
  /**
336
   * \param classId class id of the constructor to invoke.
331
   * \param classId class id of the constructor to invoke.
337
   * \param iid interface id to query for
338
   * \param a1 first argument to pass to constructor
332
   * \param a1 first argument to pass to constructor
339
   * \param a2 second argument to pass to constructor
333
   * \param a2 second argument to pass to constructor
340
   * \param a3 third argument to pass to constructor
334
   * \param a3 third argument to pass to constructor
 Lines 347-357   public: Link Here 
347
   * result.
341
   * result.
348
   */
342
   */
349
  template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
343
  template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
350
  static Ptr<T> Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
344
  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
351
345
352
private:
346
private:
353
  friend void RegisterCallback (ClassId classId, CallbackBase *callback, 
347
  friend void RegisterCallback (ClassId classId, CallbackBase *callback, 
354
                                   std::vector<const InterfaceId *> supportedInterfaces);
348
                                std::vector<const InterfaceId *> supportedInterfaces);
355
  static void Register (ClassId classId, CallbackBase *callback, 
349
  static void Register (ClassId classId, CallbackBase *callback, 
356
                        std::vector<const InterfaceId *> supportedInterfaces);
350
                        std::vector<const InterfaceId *> supportedInterfaces);
357
351
 Lines 627-682   ComponentManager::Create (ClassId classI Link Here 
627
621
628
template <typename T>
622
template <typename T>
629
Ptr<T>
623
Ptr<T>
630
ComponentManager::Create (ClassId classId, InterfaceId iid)
624
ComponentManager::Create (ClassId classId)
631
{
625
{
632
  Ptr<Object> obj = Create (classId);
626
  Ptr<Object> obj = Create (classId);
633
  Ptr<T> i = obj->QueryInterface<T> (iid);
627
  Ptr<T> i = obj->QueryInterface<T> ();
634
  return i;
628
  return i;
635
}
629
}
636
630
637
template <typename T, typename T1>
631
template <typename T, typename T1>
638
Ptr<T>
632
Ptr<T>
639
ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1)
633
ComponentManager::Create (ClassId classId, T1 a1)
640
{
634
{
641
  Ptr<Object> obj = Create (classId, a1);
635
  Ptr<Object> obj = Create (classId, a1);
642
  Ptr<T> i = obj->QueryInterface<T> (iid);
636
  Ptr<T> i = obj->QueryInterface<T> ();
643
  return i;
637
  return i;
644
}
638
}
645
639
646
template <typename T, typename T1, typename T2>
640
template <typename T, typename T1, typename T2>
647
Ptr<T>
641
Ptr<T>
648
ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2)
642
ComponentManager::Create (ClassId classId, T1 a1, T2 a2)
649
{
643
{
650
  Ptr<Object> obj = Create (classId, a1, a2);
644
  Ptr<Object> obj = Create (classId, a1, a2);
651
  Ptr<T> i = obj->QueryInterface<T> (iid);
645
  Ptr<T> i = obj->QueryInterface<T> ();
652
  return i;
646
  return i;
653
}
647
}
654
648
655
649
656
template <typename T, typename T1, typename T2, typename T3>
650
template <typename T, typename T1, typename T2, typename T3>
657
Ptr<T>
651
Ptr<T>
658
ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3)
652
ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3)
659
{
653
{
660
  Ptr<Object> obj = Create (classId, a1, a2, a3);
654
  Ptr<Object> obj = Create (classId, a1, a2, a3);
661
  Ptr<T> i = obj->QueryInterface<T> (iid);
655
  Ptr<T> i = obj->QueryInterface<T> ();
662
  return i;
656
  return i;
663
}
657
}
664
658
665
template <typename T, typename T1, typename T2, typename T3, typename T4>
659
template <typename T, typename T1, typename T2, typename T3, typename T4>
666
Ptr<T>
660
Ptr<T>
667
ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4)
661
ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4)
668
{
662
{
669
  Ptr<Object> obj = Create (classId, a1, a2, a3, a4);
663
  Ptr<Object> obj = Create (classId, a1, a2, a3, a4);
670
  Ptr<T> i = obj->QueryInterface<T> (iid);
664
  Ptr<T> i = obj->QueryInterface<T> ();
671
  return i;
665
  return i;
672
}
666
}
673
667
674
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
668
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
675
Ptr<T>
669
Ptr<T>
676
ComponentManager::Create (ClassId classId, InterfaceId iid, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
670
ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
677
{
671
{
678
  Ptr<Object> obj = Create (classId, a1, a2, a3, a4, a5);
672
  Ptr<Object> obj = Create (classId, a1, a2, a3, a4, a5);
679
  Ptr<T> i = obj->QueryInterface<T> (iid);
673
  Ptr<T> i = obj->QueryInterface<T> ();
680
  return i;
674
  return i;
681
}
675
}
682
676
(-)a/src/core/object.cc (-23 / +23 lines)
 Lines 91-97   InterfaceIdTraceResolver::ParseForInterf Link Here 
91
  Ptr<Object> interface = m_aggregate->QueryInterface<Object> (interfaceId);
91
  Ptr<Object> interface = m_aggregate->QueryInterface<Object> (interfaceId);
92
  return interface;
92
  return interface;
93
}
93
}
94
void 
94
void  
95
InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
95
InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
96
{
96
{
97
  Ptr<const Object> interface = ParseForInterface (path);
97
  Ptr<const Object> interface = ParseForInterface (path);
 Lines 554-599   ObjectTest::RunTests (void) Link Here 
554
  bool result = true;
554
  bool result = true;
555
555
556
  Ptr<BaseA> baseA = Create<BaseA> ();
556
  Ptr<BaseA> baseA = Create<BaseA> ();
557
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), baseA);
557
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
558
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), 0);
558
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), 0);
559
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
559
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (), 0);
560
  baseA = Create<DerivedA> (10);
560
  baseA = Create<DerivedA> (10);
561
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), baseA);
561
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
562
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), baseA);
562
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::iid), baseA);
563
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
563
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (), 0);
564
564
565
  baseA = Create<BaseA> ();
565
  baseA = Create<BaseA> ();
566
  Ptr<BaseB> baseB = Create<BaseB> ();
566
  Ptr<BaseB> baseB = Create<BaseB> ();
567
  Ptr<BaseB> baseBCopy = baseB;
567
  Ptr<BaseB> baseBCopy = baseB;
568
  baseA->AddInterface (baseB);
568
  baseA->AddInterface (baseB);
569
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseA> (BaseA::iid), 0);
569
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseA> (), 0);
570
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (DerivedA::iid), 0);
570
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (), 0);
571
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (BaseB::iid), 0);
571
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (), 0);
572
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedB> (DerivedB::iid), 0);
572
  NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedB> (), 0);
573
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (BaseB::iid), 0);
573
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (), 0);
574
  NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedB> (DerivedB::iid), 0);
574
  NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedB> (), 0);
575
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (BaseA::iid), 0);
575
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (), 0);
576
  NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedA> (DerivedA::iid), 0);
576
  NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedA> (), 0);
577
  NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (BaseA::iid), 0);
577
  NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (), 0);
578
578
579
  baseA = Create<DerivedA> (1);
579
  baseA = Create<DerivedA> (1);
580
  baseB = Create<DerivedB> (1);
580
  baseB = Create<DerivedB> (1);
581
  baseBCopy = baseB;
581
  baseBCopy = baseB;
582
  baseA->AddInterface (baseB);
582
  baseA->AddInterface (baseB);
583
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedB> (DerivedB::iid), 0);
583
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedB> (), 0);
584
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (BaseB::iid), 0);
584
  NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<BaseB> (), 0);
585
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedA> (DerivedA::iid), 0);
585
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedA> (), 0);
586
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (BaseA::iid), 0);
586
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseA> (), 0);
587
  NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<DerivedA> (DerivedA::iid), 0);
587
  NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<DerivedA> (), 0);
588
  NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (BaseA::iid), 0);
588
  NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (), 0);
589
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedB> (DerivedB::iid), 0);
589
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<DerivedB> (), 0);
590
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (BaseB::iid), 0)
590
  NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface<BaseB> (), 0)
591
591
592
  baseA = Create<BaseA> ();
592
  baseA = Create<BaseA> ();
593
  baseB = Create<BaseB> ();
593
  baseB = Create<BaseB> ();
594
  baseA->AddInterface (baseB);
594
  baseA->AddInterface (baseB);
595
  baseA = 0;
595
  baseA = 0;
596
  baseA = baseB->QueryInterface<BaseA> (BaseA::iid);
596
  baseA = baseB->QueryInterface<BaseA> ();
597
597
598
  baseA = Create<BaseA> ();
598
  baseA = Create<BaseA> ();
599
  baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
599
  baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
(-)a/src/core/object.h (-3 / +19 lines)
 Lines 117-125   public: Link Here 
117
   */
117
   */
118
  inline void Unref (void) const;
118
  inline void Unref (void) const;
119
  /**
119
  /**
120
   * \param iid the interface requested
121
   * \returns a pointer to the requested interface or zero if it could not be found.
120
   * \returns a pointer to the requested interface or zero if it could not be found.
122
   * 
121
   */
122
  template <typename T>
123
  Ptr<T> QueryInterface (void) const;
124
  /**
125
   * \param iid the interface id of the requested interface
126
   * \returns a pointer to the requested interface or zero if it could not be found.
123
   */
127
   */
124
  template <typename T>
128
  template <typename T>
125
  Ptr<T> QueryInterface (InterfaceId iid) const;
129
  Ptr<T> QueryInterface (InterfaceId iid) const;
 Lines 181-189   protected: Link Here 
181
  virtual void DoDispose (void);
185
  virtual void DoDispose (void);
182
private:
186
private:
183
  friend class InterfaceIdTraceResolver;
187
  friend class InterfaceIdTraceResolver;
184
  Ptr<Object> DoQueryInterface (InterfaceId iid) const;
185
  void DoCollectSources (std::string path, const TraceContext &context, 
188
  void DoCollectSources (std::string path, const TraceContext &context, 
186
                         TraceResolver::SourceCollection *collection) const;
189
                         TraceResolver::SourceCollection *collection) const;
190
  Ptr<Object> DoQueryInterface (InterfaceId iid) const;
187
  void DoTraceAll (std::ostream &os, const TraceContext &context) const;
191
  void DoTraceAll (std::ostream &os, const TraceContext &context) const;
188
  bool Check (void) const;
192
  bool Check (void) const;
189
  bool CheckLoose (void) const;
193
  bool CheckLoose (void) const;
 Lines 217-222   Object::Unref (void) const Link Here 
217
221
218
template <typename T>
222
template <typename T>
219
Ptr<T> 
223
Ptr<T> 
224
Object::QueryInterface () const
225
{
226
  Ptr<Object> found = DoQueryInterface (T::iid);
227
  if (found != 0)
228
    {
229
      return Ptr<T> (dynamic_cast<T *> (PeekPointer (found)));
230
    }
231
  return 0;
232
}
233
234
template <typename T>
235
Ptr<T> 
220
Object::QueryInterface (InterfaceId iid) const
236
Object::QueryInterface (InterfaceId iid) const
221
{
237
{
222
  Ptr<Object> found = DoQueryInterface (iid);
238
  Ptr<Object> found = DoQueryInterface (iid);
(-)a/src/devices/csma/csma-ipv4-topology.cc (-3 / +3 lines)
 Lines 101-107   CsmaIpv4Topology::AddIpv4Address( Link Here 
101
{
101
{
102
  Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
102
  Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
103
103
104
  Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
104
  Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
105
  uint32_t ifIndex = ipv4->AddInterface (nd);
105
  uint32_t ifIndex = ipv4->AddInterface (nd);
106
106
107
  ipv4->SetAddress (ifIndex, address);
107
  ipv4->SetAddress (ifIndex, address);
 Lines 116-123   CsmaIpv4Topology::AddIpv4Routes ( Link Here 
116
  Ptr<NetDevice> nd1, Ptr<NetDevice> nd2)
116
  Ptr<NetDevice> nd1, Ptr<NetDevice> nd2)
117
{ 
117
{ 
118
  // Assert that both are Ipv4 nodes
118
  // Assert that both are Ipv4 nodes
119
  Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> (Ipv4::iid);
119
  Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> ();
120
  Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> (Ipv4::iid);
120
  Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> ();
121
  NS_ASSERT(ip1 != 0 && ip2 != 0);
121
  NS_ASSERT(ip1 != 0 && ip2 != 0);
122
122
123
  // Get interface indexes for both nodes corresponding to the right channel
123
  // Get interface indexes for both nodes corresponding to the right channel
(-)a/src/devices/point-to-point/point-to-point-topology.cc (-6 / +6 lines)
 Lines 111-124   PointToPointTopology::AddIpv4Addresses( Link Here 
111
  NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ());
111
  NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ());
112
  NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ());
112
  NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ());
113
  
113
  
114
  Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> (Ipv4::iid);
114
  Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> ();
115
  uint32_t index1 = ip1->AddInterface (nd1);
115
  uint32_t index1 = ip1->AddInterface (nd1);
116
116
117
  ip1->SetAddress (index1, addr1);
117
  ip1->SetAddress (index1, addr1);
118
  ip1->SetNetworkMask (index1, netmask);
118
  ip1->SetNetworkMask (index1, netmask);
119
  ip1->SetUp (index1);
119
  ip1->SetUp (index1);
120
120
121
  Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> (Ipv4::iid);
121
  Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> ();
122
  uint32_t index2 = ip2->AddInterface (nd2);
122
  uint32_t index2 = ip2->AddInterface (nd2);
123
123
124
  ip2->SetAddress (index2, addr2);
124
  ip2->SetAddress (index2, addr2);
 Lines 153-159   PointToPointTopology::SetIpv4Metric( Link Here 
153
  // Get interface indexes for both nodes corresponding to the right channel
153
  // Get interface indexes for both nodes corresponding to the right channel
154
  uint32_t index = 0;
154
  uint32_t index = 0;
155
  bool found = false;
155
  bool found = false;
156
  Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> (Ipv4::iid);
156
  Ptr<Ipv4> ip1 = n1->QueryInterface<Ipv4> ();
157
  for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++)
157
  for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++)
158
    {
158
    {
159
      if (ip1 ->GetNetDevice (i) == nd1)
159
      if (ip1 ->GetNetDevice (i) == nd1)
 Lines 167-173   PointToPointTopology::SetIpv4Metric( Link Here 
167
167
168
  index = 0;
168
  index = 0;
169
  found = false;
169
  found = false;
170
  Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> (Ipv4::iid);
170
  Ptr<Ipv4> ip2 = n2->QueryInterface<Ipv4> ();
171
  for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++)
171
  for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++)
172
    {
172
    {
173
      if (ip2 ->GetNetDevice (i) == nd2)
173
      if (ip2 ->GetNetDevice (i) == nd2)
 Lines 212-219   PointToPointTopology::AddIpv4Routes ( Link Here 
212
    }
212
    }
213
213
214
  // Assert that both are Ipv4 nodes
214
  // Assert that both are Ipv4 nodes
215
  Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> (Ipv4::iid);
215
  Ptr<Ipv4> ip1 = nd1->GetNode ()->QueryInterface<Ipv4> ();
216
  Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> (Ipv4::iid);
216
  Ptr<Ipv4> ip2 = nd2->GetNode ()->QueryInterface<Ipv4> ();
217
  NS_ASSERT(ip1 != 0 && ip2 != 0);
217
  NS_ASSERT(ip1 != 0 && ip2 != 0);
218
218
219
  // Get interface indexes for both nodes corresponding to the right channel
219
  // Get interface indexes for both nodes corresponding to the right channel
(-)a/src/devices/wifi/wifi-channel.cc (-2 / +2 lines)
 Lines 60-72   WifiChannel::Send (Ptr<NetDevice> sender Link Here 
60
WifiChannel::Send (Ptr<NetDevice> sender, Ptr<const Packet> packet, double txPowerDbm,
60
WifiChannel::Send (Ptr<NetDevice> sender, Ptr<const Packet> packet, double txPowerDbm,
61
                   WifiMode wifiMode, WifiPreamble preamble) const
61
                   WifiMode wifiMode, WifiPreamble preamble) const
62
{
62
{
63
  Ptr<MobilityModel> senderMobility = sender->GetNode ()->QueryInterface<MobilityModel> (MobilityModel::iid);
63
  Ptr<MobilityModel> senderMobility = sender->GetNode ()->QueryInterface<MobilityModel> ();
64
  uint32_t j = 0;
64
  uint32_t j = 0;
65
  for (DeviceList::const_iterator i = m_deviceList.begin (); i != m_deviceList.end (); i++)
65
  for (DeviceList::const_iterator i = m_deviceList.begin (); i != m_deviceList.end (); i++)
66
    {
66
    {
67
      if (sender != i->first)
67
      if (sender != i->first)
68
        {
68
        {
69
          Ptr<MobilityModel> receiverMobility = i->first->GetNode ()->QueryInterface<MobilityModel> (MobilityModel::iid);
69
          Ptr<MobilityModel> receiverMobility = i->first->GetNode ()->QueryInterface<MobilityModel> ();
70
          Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
70
          Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
71
          double rxPowerDbm = m_loss->GetRxPower (txPowerDbm, senderMobility, receiverMobility);
71
          double rxPowerDbm = m_loss->GetRxPower (txPowerDbm, senderMobility, receiverMobility);
72
          NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
72
          NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
(-)a/src/internet-node/arp-ipv4-interface.cc (-1 / +1 lines)
 Lines 71-77   ArpIpv4Interface::SendTo (Ptr<Packet> p, Link Here 
71
    {
71
    {
72
      NS_LOG_LOGIC ("Needs ARP");
72
      NS_LOG_LOGIC ("Needs ARP");
73
      Ptr<ArpL3Protocol> arp = 
73
      Ptr<ArpL3Protocol> arp = 
74
        m_node->QueryInterface<ArpL3Protocol> (ArpL3Protocol::iid);
74
        m_node->QueryInterface<ArpL3Protocol> ();
75
      Address hardwareDestination;
75
      Address hardwareDestination;
76
      bool found;
76
      bool found;
77
      
77
      
(-)a/src/internet-node/arp-l3-protocol.cc (-1 / +1 lines)
 Lines 72-78   ArpL3Protocol::FindCache (Ptr<NetDevice> Link Here 
72
	  return *i;
72
	  return *i;
73
	}
73
	}
74
    }
74
    }
75
  Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
75
  Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> ();
76
  Ptr<Ipv4Interface> interface = ipv4->FindInterfaceForDevice (device);
76
  Ptr<Ipv4Interface> interface = ipv4->FindInterfaceForDevice (device);
77
  ArpCache * cache = new ArpCache (device, interface);
77
  ArpCache * cache = new ArpCache (device, interface);
78
  NS_ASSERT (device->IsBroadcast ());
78
  NS_ASSERT (device->IsBroadcast ());
(-)a/src/internet-node/internet-node.cc (-1 / +1 lines)
 Lines 78-84   InternetNode::GetTraceResolver () const Link Here 
78
InternetNode::GetTraceResolver () const
78
InternetNode::GetTraceResolver () const
79
{
79
{
80
  Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
80
  Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
81
  Ptr<Ipv4L3Protocol> ipv4 = QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
81
  Ptr<Ipv4L3Protocol> ipv4 = QueryInterface<Ipv4L3Protocol> ();
82
  resolver->AddComposite ("ipv4", ipv4);
82
  resolver->AddComposite ("ipv4", ipv4);
83
  resolver->SetParentResolver (Node::GetTraceResolver ());
83
  resolver->SetParentResolver (Node::GetTraceResolver ());
84
  return resolver;
84
  return resolver;
(-)a/src/internet-node/ipv4-l3-protocol.cc (-1 / +1 lines)
 Lines 743-749   Ipv4L3Protocol::ForwardUp (Ptr<Packet> p Link Here 
743
  NS_LOG_FUNCTION;
743
  NS_LOG_FUNCTION;
744
  NS_LOG_PARAMS (this << p << &ip);
744
  NS_LOG_PARAMS (this << p << &ip);
745
745
746
  Ptr<Ipv4L4Demux> demux = m_node->QueryInterface<Ipv4L4Demux> (Ipv4L4Demux::iid);
746
  Ptr<Ipv4L4Demux> demux = m_node->QueryInterface<Ipv4L4Demux> ();
747
  Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
747
  Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
748
  protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface);
748
  protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface);
749
}
749
}
(-)a/src/internet-node/ipv4-loopback-interface.cc (-1 / +1 lines)
 Lines 51-57   Ipv4LoopbackInterface::SendTo (Ptr<Packe Link Here 
51
  NS_LOG_PARAMS (this << packet << dest);
51
  NS_LOG_PARAMS (this << packet << dest);
52
52
53
  Ptr<Ipv4L3Protocol> ipv4 = 
53
  Ptr<Ipv4L3Protocol> ipv4 = 
54
    m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
54
    m_node->QueryInterface<Ipv4L3Protocol> ();
55
55
56
  ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER, 
56
  ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER, 
57
                 Mac48Address ("ff:ff:ff:ff:ff:ff"));
57
                 Mac48Address ("ff:ff:ff:ff:ff:ff"));
(-)a/src/internet-node/udp-l4-protocol.cc (-1 / +1 lines)
 Lines 159-165   UdpL4Protocol::Send (Ptr<Packet> packet, Link Here 
159
159
160
  packet->AddHeader (udpHeader);
160
  packet->AddHeader (udpHeader);
161
161
162
  Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
162
  Ptr<Ipv4L3Protocol> ipv4 = m_node->QueryInterface<Ipv4L3Protocol> ();
163
  if (ipv4 != 0)
163
  if (ipv4 != 0)
164
    {
164
    {
165
      NS_LOG_LOGIC ("Sending to IP");
165
      NS_LOG_LOGIC ("Sending to IP");
(-)a/src/internet-node/udp-socket.cc (-5 / +5 lines)
 Lines 268-274   UdpSocket::DoSendTo (Ptr<Packet> p, Ipv4 Link Here 
268
    }
268
    }
269
269
270
  uint32_t localIfIndex;
270
  uint32_t localIfIndex;
271
  Ptr<Ipv4> ipv4 = m_node->QueryInterface<Ipv4> (Ipv4::iid);
271
  Ptr<Ipv4> ipv4 = m_node->QueryInterface<Ipv4> ();
272
272
273
  //
273
  //
274
  // If dest is sent to the limited broadcast address (all ones),
274
  // If dest is sent to the limited broadcast address (all ones),
 Lines 386-392   UdpSocketTest::RunTests (void) Link Here 
386
  Ptr<Node> rxNode = Create<InternetNode> ();
386
  Ptr<Node> rxNode = Create<InternetNode> ();
387
  Ptr<PointToPointNetDevice> rxDev = Create<PointToPointNetDevice> (rxNode);
387
  Ptr<PointToPointNetDevice> rxDev = Create<PointToPointNetDevice> (rxNode);
388
  rxDev->AddQueue(Create<DropTailQueue> ());
388
  rxDev->AddQueue(Create<DropTailQueue> ());
389
  Ptr<Ipv4> ipv4 = rxNode->QueryInterface<Ipv4> (Ipv4::iid);
389
  Ptr<Ipv4> ipv4 = rxNode->QueryInterface<Ipv4> ();
390
  uint32_t netdev_idx = ipv4->AddInterface (rxDev);
390
  uint32_t netdev_idx = ipv4->AddInterface (rxDev);
391
  ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1"));
391
  ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1"));
392
  ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U));
392
  ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U));
 Lines 396-402   UdpSocketTest::RunTests (void) Link Here 
396
  Ptr<Node> txNode = Create<InternetNode> ();
396
  Ptr<Node> txNode = Create<InternetNode> ();
397
  Ptr<PointToPointNetDevice> txDev = Create<PointToPointNetDevice> (txNode);
397
  Ptr<PointToPointNetDevice> txDev = Create<PointToPointNetDevice> (txNode);
398
  txDev->AddQueue(Create<DropTailQueue> ());
398
  txDev->AddQueue(Create<DropTailQueue> ());
399
  ipv4 = txNode->QueryInterface<Ipv4> (Ipv4::iid);
399
  ipv4 = txNode->QueryInterface<Ipv4> ();
400
  netdev_idx = ipv4->AddInterface (txDev);
400
  netdev_idx = ipv4->AddInterface (txDev);
401
  ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2"));
401
  ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2"));
402
  ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U));
402
  ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U));
 Lines 409-420   UdpSocketTest::RunTests (void) Link Here 
409
409
410
410
411
  // Create the UDP sockets
411
  // Create the UDP sockets
412
  Ptr<SocketFactory> rxSocketFactory = rxNode->QueryInterface<SocketFactory> (Udp::iid);
412
  Ptr<SocketFactory> rxSocketFactory = rxNode->QueryInterface<Udp> ();
413
  Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
413
  Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
414
  NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 1234)), 0);
414
  NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 1234)), 0);
415
  rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this));
415
  rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this));
416
416
417
  Ptr<SocketFactory> txSocketFactory = txNode->QueryInterface<SocketFactory> (Udp::iid);
417
  Ptr<SocketFactory> txSocketFactory = txNode->QueryInterface<Udp> ();
418
  Ptr<Socket> txSocket = txSocketFactory->CreateSocket ();
418
  Ptr<Socket> txSocket = txSocketFactory->CreateSocket ();
419
419
420
  // ------ Now the tests ------------
420
  // ------ Now the tests ------------
(-)a/src/mobility/hierarchical-mobility-model.cc (-2 / +2 lines)
 Lines 27-35   HierarchicalMobilityModel::HierarchicalM Link Here 
27
    m_parent (parent)
27
    m_parent (parent)
28
{
28
{
29
  Ptr<MobilityModelNotifier> childNotifier = 
29
  Ptr<MobilityModelNotifier> childNotifier = 
30
    m_child->QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
30
    m_child->QueryInterface<MobilityModelNotifier> ();
31
  Ptr<MobilityModelNotifier> parentNotifier = 
31
  Ptr<MobilityModelNotifier> parentNotifier = 
32
    m_parent->QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
32
    m_parent->QueryInterface<MobilityModelNotifier> ();
33
  if (childNotifier == 0)
33
  if (childNotifier == 0)
34
    {
34
    {
35
      childNotifier = Create<MobilityModelNotifier> ();
35
      childNotifier = Create<MobilityModelNotifier> ();
(-)a/src/mobility/mobility-model.cc (-2 / +1 lines)
 Lines 61-68   void Link Here 
61
void
61
void
62
MobilityModel::NotifyCourseChange (void) const
62
MobilityModel::NotifyCourseChange (void) const
63
{
63
{
64
  Ptr<MobilityModelNotifier> notifier = 
64
  Ptr<MobilityModelNotifier> notifier = QueryInterface<MobilityModelNotifier> ();
65
    QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
66
  if (notifier != 0)
65
  if (notifier != 0)
67
    {
66
    {
68
      notifier->Notify (this);
67
      notifier->Notify (this);
(-)a/src/mobility/ns2-mobility-file-topology.cc (-2 / +1 lines)
 Lines 49-56   Ns2MobilityFileTopology::GetMobilityMode Link Here 
49
    {
49
    {
50
      return 0;
50
      return 0;
51
    }
51
    }
52
  Ptr<StaticSpeedMobilityModel> model = 
52
  Ptr<StaticSpeedMobilityModel> model = object->QueryInterface<StaticSpeedMobilityModel> ();
53
    object->QueryInterface<StaticSpeedMobilityModel> (StaticSpeedMobilityModel::iid);
54
  if (model == 0)
53
  if (model == 0)
55
    {
54
    {
56
      model = Create<StaticSpeedMobilityModel> ();
55
      model = Create<StaticSpeedMobilityModel> ();
(-)a/src/node/packet-socket-factory.cc (-1 / +1 lines)
 Lines 34-40   PacketSocketFactory::PacketSocketFactory Link Here 
34
34
35
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
35
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
36
{
36
{
37
  Ptr<Node> node = QueryInterface<Node> (Node::iid);
37
  Ptr<Node> node = QueryInterface<Node> ();
38
  Ptr<PacketSocket> socket = Create<PacketSocket> (node);
38
  Ptr<PacketSocket> socket = Create<PacketSocket> (node);
39
  return socket;
39
  return socket;
40
} 
40
} 
(-)a/src/routing/global-routing/global-route-manager-impl.cc (-8 / +8 lines)
 Lines 392-398   GlobalRouteManagerImpl::BuildGlobalRouti Link Here 
392
      Ptr<Node> node = *i;
392
      Ptr<Node> node = *i;
393
393
394
      Ptr<GlobalRouter> rtr = 
394
      Ptr<GlobalRouter> rtr = 
395
        node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
395
        node->QueryInterface<GlobalRouter> ();
396
//      
396
//      
397
// Ignore nodes that aren't participating in routing.
397
// Ignore nodes that aren't participating in routing.
398
//
398
//
 Lines 476-482   GlobalRouteManagerImpl::InitializeRoutes Link Here 
476
// participating in routing.
476
// participating in routing.
477
//
477
//
478
      Ptr<GlobalRouter> rtr = 
478
      Ptr<GlobalRouter> rtr = 
479
        node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
479
        node->QueryInterface<GlobalRouter> ();
480
//
480
//
481
// if the node has a global router interface, then run the global routing
481
// if the node has a global router interface, then run the global routing
482
// algorithms.
482
// algorithms.
 Lines 1145-1151   GlobalRouteManagerImpl::FindOutgoingInte Link Here 
1145
      Ptr<Node> node = *i;
1145
      Ptr<Node> node = *i;
1146
1146
1147
      Ptr<GlobalRouter> rtr = 
1147
      Ptr<GlobalRouter> rtr = 
1148
        node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
1148
        node->QueryInterface<GlobalRouter> ();
1149
//
1149
//
1150
// If the node doesn't have a GlobalRouter interface it can't be the one
1150
// If the node doesn't have a GlobalRouter interface it can't be the one
1151
// we're interested in.
1151
// we're interested in.
 Lines 1163-1169   GlobalRouteManagerImpl::FindOutgoingInte Link Here 
1163
// is participating in routing IP version 4 packets, it certainly must have 
1163
// is participating in routing IP version 4 packets, it certainly must have 
1164
// an Ipv4 interface.
1164
// an Ipv4 interface.
1165
//
1165
//
1166
          Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
1166
          Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
1167
          NS_ASSERT_MSG (ipv4, 
1167
          NS_ASSERT_MSG (ipv4, 
1168
            "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): "
1168
            "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): "
1169
            "QI for <Ipv4> interface failed");
1169
            "QI for <Ipv4> interface failed");
 Lines 1229-1235   GlobalRouteManagerImpl::SPFIntraAddRoute Link Here 
1229
// in question cannot be the router we want, so we continue.
1229
// in question cannot be the router we want, so we continue.
1230
// 
1230
// 
1231
      Ptr<GlobalRouter> rtr = 
1231
      Ptr<GlobalRouter> rtr = 
1232
        node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
1232
        node->QueryInterface<GlobalRouter> ();
1233
1233
1234
      if (rtr == 0)
1234
      if (rtr == 0)
1235
        {
1235
        {
 Lines 1252-1258   GlobalRouteManagerImpl::SPFIntraAddRoute Link Here 
1252
// for that interface.  If the node is acting as an IP version 4 router, it
1252
// for that interface.  If the node is acting as an IP version 4 router, it
1253
// should absolutely have an Ipv4 interface.
1253
// should absolutely have an Ipv4 interface.
1254
//
1254
//
1255
          Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
1255
          Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
1256
          NS_ASSERT_MSG (ipv4, 
1256
          NS_ASSERT_MSG (ipv4, 
1257
            "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1257
            "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1258
            "QI for <Ipv4> interface failed");
1258
            "QI for <Ipv4> interface failed");
 Lines 1346-1352   GlobalRouteManagerImpl::SPFIntraAddTrans Link Here 
1346
// in question cannot be the router we want, so we continue.
1346
// in question cannot be the router we want, so we continue.
1347
// 
1347
// 
1348
      Ptr<GlobalRouter> rtr = 
1348
      Ptr<GlobalRouter> rtr = 
1349
        node->QueryInterface<GlobalRouter> (GlobalRouter::iid);
1349
        node->QueryInterface<GlobalRouter> ();
1350
1350
1351
      if (rtr == 0)
1351
      if (rtr == 0)
1352
        {
1352
        {
 Lines 1369-1375   GlobalRouteManagerImpl::SPFIntraAddTrans Link Here 
1369
// for that interface.  If the node is acting as an IP version 4 router, it
1369
// for that interface.  If the node is acting as an IP version 4 router, it
1370
// should absolutely have an Ipv4 interface.
1370
// should absolutely have an Ipv4 interface.
1371
//
1371
//
1372
          Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
1372
          Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
1373
          NS_ASSERT_MSG (ipv4, 
1373
          NS_ASSERT_MSG (ipv4, 
1374
            "GlobalRouteManagerImpl::SPFIntraAddTransit (): "
1374
            "GlobalRouteManagerImpl::SPFIntraAddTransit (): "
1375
            "QI for <Ipv4> interface failed");
1375
            "QI for <Ipv4> interface failed");
(-)a/src/routing/global-routing/global-router-interface.cc (-8 / +8 lines)
 Lines 490-496   GlobalRouter::DiscoverLSAs (void) Link Here 
490
GlobalRouter::DiscoverLSAs (void)
490
GlobalRouter::DiscoverLSAs (void)
491
{
491
{
492
  NS_LOG_FUNCTION;
492
  NS_LOG_FUNCTION;
493
  Ptr<Node> node = QueryInterface<Node> (Node::iid);
493
  Ptr<Node> node = QueryInterface<Node> ();
494
  NS_LOG_LOGIC("For node " << node->GetId () );
494
  NS_LOG_LOGIC("For node " << node->GetId () );
495
  NS_ASSERT_MSG(node, 
495
  NS_ASSERT_MSG(node, 
496
    "GlobalRouter::DiscoverLSAs (): <Node> interface not set");
496
    "GlobalRouter::DiscoverLSAs (): <Node> interface not set");
 Lines 506-512   GlobalRouter::DiscoverLSAs (void) Link Here 
506
// Ipv4 interface.  This is where the information regarding the attached 
506
// Ipv4 interface.  This is where the information regarding the attached 
507
// interfaces lives.
507
// interfaces lives.
508
//
508
//
509
  Ptr<Ipv4> ipv4Local = node->QueryInterface<Ipv4> (Ipv4::iid);
509
  Ptr<Ipv4> ipv4Local = node->QueryInterface<Ipv4> ();
510
  NS_ASSERT_MSG(ipv4Local, 
510
  NS_ASSERT_MSG(ipv4Local, 
511
    "GlobalRouter::DiscoverLSAs (): QI for <Ipv4> interface failed");
511
    "GlobalRouter::DiscoverLSAs (): QI for <Ipv4> interface failed");
512
//
512
//
 Lines 625-631   GlobalRouter::DiscoverLSAs (void) Link Here 
625
// device for its node, then ask that node for its Ipv4 interface.
625
// device for its node, then ask that node for its Ipv4 interface.
626
//
626
//
627
          Ptr<Node> nodeRemote = ndRemote->GetNode();
627
          Ptr<Node> nodeRemote = ndRemote->GetNode();
628
          Ptr<Ipv4> ipv4Remote = nodeRemote->QueryInterface<Ipv4> (Ipv4::iid);
628
          Ptr<Ipv4> ipv4Remote = nodeRemote->QueryInterface<Ipv4> ();
629
          NS_ASSERT_MSG(ipv4Remote, 
629
          NS_ASSERT_MSG(ipv4Remote, 
630
            "GlobalRouter::DiscoverLSAs (): QI for remote <Ipv4> failed");
630
            "GlobalRouter::DiscoverLSAs (): QI for remote <Ipv4> failed");
631
//
631
//
 Lines 633-639   GlobalRouter::DiscoverLSAs (void) Link Here 
633
// well get it now.
633
// well get it now.
634
//
634
//
635
          Ptr<GlobalRouter> srRemote = 
635
          Ptr<GlobalRouter> srRemote = 
636
            nodeRemote->QueryInterface<GlobalRouter> (GlobalRouter::iid);
636
            nodeRemote->QueryInterface<GlobalRouter> ();
637
          NS_ASSERT_MSG(srRemote, 
637
          NS_ASSERT_MSG(srRemote, 
638
            "GlobalRouter::DiscoverLSAs():QI for remote <GlobalRouter> failed");
638
            "GlobalRouter::DiscoverLSAs():QI for remote <GlobalRouter> failed");
639
          Ipv4Address rtrIdRemote = srRemote->GetRouterId();
639
          Ipv4Address rtrIdRemote = srRemote->GetRouterId();
 Lines 711-717   GlobalRouter::DiscoverLSAs (void) Link Here 
711
              NS_ASSERT (tempNd);
711
              NS_ASSERT (tempNd);
712
              Ptr<Node> tempNode = tempNd->GetNode ();
712
              Ptr<Node> tempNode = tempNd->GetNode ();
713
              uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
713
              uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
714
              Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> (Ipv4::iid);
714
              Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> ();
715
              NS_ASSERT (tempIpv4);
715
              NS_ASSERT (tempIpv4);
716
              Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
716
              Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
717
              pLSA->AddAttachedRouter (tempAddr);
717
              pLSA->AddAttachedRouter (tempAddr);
 Lines 729-735   GlobalRouter::FindDesignatedRouterForLin Link Here 
729
  Ptr<NetDevice> ndLocal) const
729
  Ptr<NetDevice> ndLocal) const
730
{
730
{
731
  uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
731
  uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
732
  Ptr<Ipv4> ipv4Local = QueryInterface<Ipv4> (Ipv4::iid);
732
  Ptr<Ipv4> ipv4Local = QueryInterface<Ipv4> ();
733
  NS_ASSERT (ipv4Local);
733
  NS_ASSERT (ipv4Local);
734
  Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
734
  Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
735
  Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
735
  Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
 Lines 745-751   GlobalRouter::FindDesignatedRouterForLin Link Here 
745
      NS_ASSERT (tempNd);
745
      NS_ASSERT (tempNd);
746
      Ptr<Node> tempNode = tempNd->GetNode ();
746
      Ptr<Node> tempNode = tempNd->GetNode ();
747
      uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
747
      uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd);
748
      Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> (Ipv4::iid);
748
      Ptr<Ipv4> tempIpv4 = tempNode->QueryInterface<Ipv4> ();
749
      NS_ASSERT (tempIpv4);
749
      NS_ASSERT (tempIpv4);
750
      Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
750
      Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
751
      if (tempAddr < addrLocal)
751
      if (tempAddr < addrLocal)
 Lines 836-842   GlobalRouter::FindIfIndexForDevice(Ptr<N Link Here 
836
GlobalRouter::FindIfIndexForDevice(Ptr<Node> node, Ptr<NetDevice> nd) const
836
GlobalRouter::FindIfIndexForDevice(Ptr<Node> node, Ptr<NetDevice> nd) const
837
{
837
{
838
  NS_LOG_FUNCTION;
838
  NS_LOG_FUNCTION;
839
  Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
839
  Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
840
  NS_ASSERT_MSG(ipv4, "QI for <Ipv4> interface failed");
840
  NS_ASSERT_MSG(ipv4, "QI for <Ipv4> interface failed");
841
  for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i )
841
  for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i )
842
    {
842
    {
(-)a/src/routing/olsr/olsr-agent-impl.cc (-1 / +1 lines)
 Lines 178-184   AgentImpl::AgentImpl (Ptr<Node> node) Link Here 
178
178
179
  m_linkTupleTimerFirstTime = true;
179
  m_linkTupleTimerFirstTime = true;
180
180
181
  m_ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
181
  m_ipv4 = node->QueryInterface<Ipv4> ();
182
  NS_ASSERT (m_ipv4);
182
  NS_ASSERT (m_ipv4);
183
183
184
  Ptr<SocketFactory> socketFactory = node->QueryInterface<SocketFactory> (Udp::iid);
184
  Ptr<SocketFactory> socketFactory = node->QueryInterface<SocketFactory> (Udp::iid);
(-)a/src/routing/olsr/olsr.cc (-1 / +1 lines)
 Lines 34-40   EnableNode (Ptr<Node> node) Link Here 
34
EnableNode (Ptr<Node> node)
34
EnableNode (Ptr<Node> node)
35
{
35
{
36
  ComponentManager::Create<olsr::Agent, Ptr<Node> >
36
  ComponentManager::Create<olsr::Agent, Ptr<Node> >
37
    (olsr::Agent::cid, olsr::Agent::iid, node)->Start ();
37
    (olsr::Agent::cid, node)->Start ();
38
}
38
}
39
39
40
40
(-)a/tutorial/point-to-point-ipv4-topology.cc (-1 / +1 lines)
 Lines 60-66   PointToPointIpv4Topology::AddAddress ( Link Here 
60
  Ipv4Mask mask)
60
  Ipv4Mask mask)
61
{
61
{
62
  Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
62
  Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
63
  Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
63
  Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
64
  uint32_t ifIndex = ipv4->AddInterface (nd);
64
  uint32_t ifIndex = ipv4->AddInterface (nd);
65
65
66
  ipv4->SetAddress (ifIndex, address);
66
  ipv4->SetAddress (ifIndex, address);
(-)a/utils/mobility-visualizer-model.cc (-1 / +1 lines)
 Lines 47-53   Sample () Link Here 
47
  for (NodeList::Iterator nodeIter = NodeList::Begin (); nodeIter != NodeList::End (); nodeIter++)
47
  for (NodeList::Iterator nodeIter = NodeList::Begin (); nodeIter != NodeList::End (); nodeIter++)
48
    {
48
    {
49
      Ptr<Node> node = *nodeIter;
49
      Ptr<Node> node = *nodeIter;
50
      Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
50
      Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> ();
51
      Vector pos = mobility->GetPosition ();
51
      Vector pos = mobility->GetPosition ();
52
      Vector vel = mobility->GetVelocity ();
52
      Vector vel = mobility->GetVelocity ();
53
53

Return to bug 122