replace ComponentManager::Create and ClassId with InterfaceId::CreateObjest and InterfaceId
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 03 Jan 2008 11:39:45 +0100
changeset 2249 3a1da26d61dc
parent 2248 ef41f6549f45
child 2250 18f432098389
replace ComponentManager::Create and ClassId with InterfaceId::CreateObjest and InterfaceId
examples/simple-error-model.cc
samples/main-grid-topology.cc
src/common/error-model.cc
src/common/error-model.h
src/core/component-manager.cc
src/core/component-manager.h
src/core/wscript
src/internet-node/arp-l3-protocol.cc
src/internet-node/ipv4-l3-protocol.cc
src/internet-node/ipv4-l4-demux.cc
src/mobility/grid-topology.cc
src/mobility/grid-topology.h
src/mobility/hierarchical-mobility-model.cc
src/mobility/mobility-model-notifier.cc
src/mobility/mobility-model-notifier.h
src/mobility/random-direction-2d-mobility-model.cc
src/mobility/random-direction-2d-mobility-model.h
src/mobility/random-position.cc
src/mobility/random-position.h
src/mobility/random-topology.cc
src/mobility/random-topology.h
src/mobility/random-walk-2d-mobility-model.cc
src/mobility/random-walk-2d-mobility-model.h
src/mobility/random-waypoint-mobility-model.cc
src/mobility/random-waypoint-mobility-model.h
src/mobility/static-mobility-model.cc
src/mobility/static-mobility-model.h
src/mobility/static-speed-mobility-model.cc
src/mobility/static-speed-mobility-model.h
src/node/channel.cc
src/node/drop-tail-queue.cc
src/node/drop-tail-queue.h
src/node/ipv4.cc
src/node/net-device.cc
src/node/node.cc
src/node/packet-socket-factory.cc
src/node/queue.cc
src/node/socket-factory.cc
src/node/udp.cc
src/routing/global-routing/global-router-interface.cc
src/routing/olsr/olsr-agent-impl.cc
src/routing/olsr/olsr-agent-impl.h
src/routing/olsr/olsr-agent.cc
src/routing/olsr/olsr-agent.h
src/routing/olsr/olsr.cc
--- a/examples/simple-error-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/examples/simple-error-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -52,7 +52,6 @@
 #include "ns3/pcap-trace.h"
 #include "ns3/internet-node.h"
 #include "ns3/default-value.h"
-#include "ns3/component-manager.h"
 #include "ns3/random-variable.h"
 #include "ns3/point-to-point-channel.h"
 #include "ns3/point-to-point-net-device.h"
--- a/samples/main-grid-topology.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/samples/main-grid-topology.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -27,7 +27,7 @@
   GridTopology grid (-100, -100, 20, 5, 20);
 
   // each object will be attached a static position.
-  grid.SetMobilityModel (StaticMobilityModel::cid);
+  grid.SetMobilityModel (StaticMobilityModel::iid ());
 
   // finalize the setup by attaching to each object
   // in the input array a position and initializing
--- a/src/common/error-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/common/error-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -28,14 +28,18 @@
 #include "ns3/log.h"
 #include "ns3/random-variable.h"
 #include "ns3/default-value.h"
+#include "ns3/interface-id-default-value.h"
 
 NS_LOG_COMPONENT_DEFINE ("ErrorModel");
 
 namespace ns3 {
 
-static ClassIdDefaultValue g_classIdErrorModelDefaultValue ("ErrorModel",
-                                                            "Error Model", ErrorModel::iid (), 
-                                                            "RateErrorModel");
+static InterfaceIdDefaultValue g_interfaceIdErrorModelDefaultValue ("ErrorModel",
+                                                                    "Error Model", 
+                                                                    ErrorModel::iid (), 
+                                                                    "RateErrorModel");
+
+NS_OBJECT_ENSURE_REGISTERED (ErrorModel);
 
 InterfaceId ErrorModel::iid (void)
 { 
@@ -59,8 +63,8 @@
 ErrorModel::CreateDefault (void)
 { 
   NS_LOG_FUNCTION;
-  ClassId classId = g_classIdErrorModelDefaultValue.GetValue ();
-  Ptr<ErrorModel> em = ComponentManager::Create<ErrorModel> (classId);
+  InterfaceId interfaceId = g_interfaceIdErrorModelDefaultValue.GetValue ();
+  Ptr<ErrorModel> em = interfaceId.CreateObject ()->QueryInterface<ErrorModel> ();
   return em;
 }
 
@@ -107,11 +111,6 @@
 // RateErrorModel
 //
 
-
-const ClassId RateErrorModel::cid =
-  MakeClassId<RateErrorModel> ("RateErrorModel", ErrorModel::iid (),
-                               RateErrorModel::iid ());
-
 // Defaults for rate/size
 static NumericDefaultValue<double> g_defaultRateErrorModelErrorRate
   ("RateErrorModelErrorRate", "The error rate for the error model", 0.0);
@@ -124,10 +123,13 @@
     EU_BIT, "EU_BIT", 
     0, (void*)0);
 
+NS_OBJECT_ENSURE_REGISTERED (RateErrorModel);
+
 InterfaceId RateErrorModel::iid (void)
 { 
   static InterfaceId iid = InterfaceId ("RateErrorModel")
-    .SetParent<ErrorModel> ();
+    .SetParent<ErrorModel> ()
+    .AddConstructor<RateErrorModel> ();
   return iid;
 }
 
@@ -242,14 +244,13 @@
 // ListErrorModel
 //
 
-const ClassId ListErrorModel::cid =
-  MakeClassId<ListErrorModel> ("ListErrorModel", ErrorModel::iid (),
-                               ListErrorModel::iid ());
+NS_OBJECT_ENSURE_REGISTERED (ListErrorModel);
 
 InterfaceId ListErrorModel::iid (void)
 { 
   static InterfaceId iid = InterfaceId ("ListErrorModel")
-    .SetParent<ErrorModel> ();
+    .SetParent<ErrorModel> ()
+    .AddConstructor<ListErrorModel> ();
   return iid;
 }
 
--- a/src/common/error-model.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/common/error-model.h	Thu Jan 03 11:39:45 2008 +0100
@@ -23,7 +23,6 @@
 
 #include <list>
 #include "ns3/object.h"
-#include "ns3/component-manager.h"
 
 namespace ns3 {
 
@@ -138,7 +137,6 @@
 {
 public:
   static InterfaceId iid (void);
-  static const ClassId cid;
 
   RateErrorModel ();
   virtual ~RateErrorModel ();
@@ -205,7 +203,6 @@
 {
 public:
   static InterfaceId iid (void);
-  static const ClassId cid;
   ListErrorModel ();
   virtual ~ListErrorModel ();
 
--- a/src/core/component-manager.cc	Thu Jan 03 11:37:23 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,414 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "component-manager.h"
-#include "uid-manager.h"
-#include "singleton.h"
-
-namespace ns3 {
-
-// we redefine a UidManager type for the class id singleton below.
-// otherwise, we would have to share the same id singleton instance
-// with the Iids.
-class CidManager : public UidManager
-{};
-
-ClassId::ClassId (std::string name)
-  : m_classId (Singleton<CidManager>::Get ()->Allocate (name))
-{}
-
-ClassId::ClassId (uint32_t classId)
-  : m_classId (classId)
-{}
-
-std::string 
-ClassId::GetName (void) const
-{
-  return Singleton<CidManager>::Get ()->LookupByUid (m_classId);
-}
-
-bool operator == (const ClassId &a, const ClassId &b)
-{
-  return a.m_classId == b.m_classId;
-}
-
-ComponentManager::ClassIdEntry::ClassIdEntry (ClassId classId)
-  : m_classId (classId)
-{}
-
-Ptr<Object>
-ComponentManager::Create (ClassId classId)
-{
-  Callback<Ptr<Object> > callback = DoGetCallback<empty,empty,empty,empty,empty> (classId);
-  return callback ();
-}
-
-CallbackBase *
-ComponentManager::Lookup (ClassId classId)
-{
-  List *list = Singleton<List>::Get ();
-  for (List::const_iterator i = list->begin (); i != list->end (); i++)
-    {
-      if (i->m_classId == classId)
-	{
-	  return i->m_callback;
-	}
-    }
-  return 0;
-}
-
-ClassId 
-ComponentManager::LookupByName (std::string name)
-{
-  return ClassId (Singleton<CidManager>::Get ()->LookupByName (name));
-}
-ClassId 
-ComponentManager::LookupByName (std::string name, bool *ok)
-{
-  uint32_t cid = Singleton<CidManager>::Get ()->LookupByName (name);
-  if (cid == 0)
-    {
-      *ok = false;
-    }
-  else
-    {
-      *ok = true;
-    }
-  return ClassId (cid);
-}
-std::vector<ClassId> 
-ComponentManager::LookupByInterfaceId (InterfaceId iid)
-{
-  std::vector<ClassId> classIdList;
-  List *list = Singleton<List>::Get ();
-  for (List::const_iterator i = list->begin (); i != list->end (); i++)
-    {
-      for (std::vector<InterfaceId>::const_iterator j = i->m_supportedInterfaces.begin ();
-           j != i->m_supportedInterfaces.end (); j++)
-        {
-          if (*j == iid)
-            {
-              classIdList.push_back (i->m_classId);
-              break;
-            }
-        }
-    }
-  unique (classIdList.begin (), classIdList.end ());
-  return classIdList;
-}
-
-void
-ComponentManager::Register (ClassId classId, CallbackBase *callback, 
-                            std::vector<InterfaceId> supportedInterfaces)
-{
-  List *list = Singleton<List>::Get ();
-  struct ClassIdEntry entry = ClassIdEntry (classId);
-  entry.m_callback = callback;
-  bool foundObject = false;
-  for (std::vector<InterfaceId>::iterator i = supportedInterfaces.begin ();
-       i != supportedInterfaces.end (); i++)
-    {
-      if (*i == Object::iid ())
-        {
-          foundObject = true;
-        }
-    }
-  if (!foundObject)
-    {
-      supportedInterfaces.push_back (Object::iid ());
-    }
-  entry.m_supportedInterfaces = supportedInterfaces;
-  list->push_back (entry);
-}
-
-void
-RegisterCallback (ClassId classId, CallbackBase *callback, std::vector<InterfaceId> supportedInterfaces)
-{
-  return ComponentManager::Register (classId, callback, supportedInterfaces);
-}
-
-
-ClassIdDefaultValue::ClassIdDefaultValue (std::string name, 
-                                          std::string help,
-                                          InterfaceId iid,
-                                          std::string defaultValue)
-  : DefaultValueBase (name, help),
-    m_defaultName (defaultValue),
-    m_name (defaultValue),
-    m_interfaceId (iid)
-{
-  DefaultValueList::Add (this);
-}
-ClassId 
-ClassIdDefaultValue::GetValue (void) const
-{
-  return ComponentManager::LookupByName (m_name);
-}
-void 
-ClassIdDefaultValue::SetValue (ClassId classId)
-{
-  m_name = classId.GetName ();
-}
-void 
-ClassIdDefaultValue::SetValue (std::string name)
-{
-  m_name = name;
-}
-bool 
-ClassIdDefaultValue::DoParseValue (const std::string &value)
-{
-  bool ok;
-  ClassId classId = ComponentManager::LookupByName (value, &ok);
-  if (!ok)
-    {
-      return false;
-    }
-  std::vector<ClassId> classIdList = ComponentManager::LookupByInterfaceId (m_interfaceId);
-  for (std::vector<ClassId>::const_iterator i = classIdList.begin ();
-       i != classIdList.end (); i++)
-    {
-      if (*i == classId)
-        {
-          m_name = value;
-          return true;
-        }
-    }
-  return false;
-}
-
-std::string 
-ClassIdDefaultValue::DoGetType (void) const
-{
-  std::vector<ClassId> classIdList = ComponentManager::LookupByInterfaceId (m_interfaceId);
-  std::ostringstream oss;
-  oss << "(";
-  for (std::vector<ClassId>::const_iterator i = classIdList.begin ();
-       i != classIdList.end (); i++)
-    {
-      if (i != classIdList.begin ())
-        {
-          oss << "|";
-        }
-      oss << i->GetName ();
-    }
-  oss << ")";
-  return oss.str ();
-}
-
-std::string 
-ClassIdDefaultValue::DoGetDefaultValue (void) const
-{
-  return m_name;
-}
-
-
-
-
-} // namespace ns3
-
-#ifdef RUN_SELF_TESTS
-
-#include "test.h"
-#include "object.h"
-
-namespace {
-
-
-class B : public ns3::Object
-{
-public:
-  static ns3::InterfaceId iid (void) {
-    static ns3::InterfaceId iid = ns3::InterfaceId ("B")
-      .SetParent<Object> ();
-    return iid;
-  }
-
-  B ();
-};
-
-B::B ()
-{}
-
-
-class A : public ns3::Object
-{
-public:
-  static const ns3::ClassId cidZero;
-  static const ns3::ClassId cidOneBool;
-  static const ns3::ClassId cidOneUi32;
-  static const ns3::ClassId cidOther;
-  static ns3::InterfaceId iid (void) {
-    static ns3::InterfaceId iid = ns3::InterfaceId ("A")
-      .SetParent<Object> ();
-    return iid;
-  }
-
-
-  A ();
-  A (bool);
-  A (uint32_t);
-
-  bool m_zeroInvoked;
-  bool m_oneBoolInvoked;
-  bool m_oneUi32Invoked;
-
-  bool m_bool;
-  int m_ui32;
-};
-
-const ns3::ClassId A::cidZero = ns3::MakeClassId<A> ("A", A::iid ());
-const ns3::ClassId A::cidOneBool = ns3::MakeClassId <A,bool> ("ABool", A::iid ());
-const ns3::ClassId A::cidOneUi32 = ns3::MakeClassId <A,uint32_t> ("AUi32", A::iid ());
-
-A::A ()
-  : m_zeroInvoked (true),
-    m_oneBoolInvoked (false),
-    m_oneUi32Invoked (false)
-{
-  ns3::Ptr<B> b = ns3::CreateObject<B> ();
-  AddInterface (b);
-}
-
-A::A (bool bo)
-  : m_zeroInvoked (false),
-    m_oneBoolInvoked (true),
-    m_oneUi32Invoked (false),
-    m_bool (bo)
-{
-  ns3::Ptr<B> b = ns3::CreateObject<B> ();
-  AddInterface (b);
-}
-
-A::A (uint32_t i)
-  : m_zeroInvoked (false),
-    m_oneBoolInvoked (false),
-    m_oneUi32Invoked (true),
-    m_ui32 (i)
-{
-  ns3::Ptr<B> b = ns3::CreateObject<B> ();
-  AddInterface (b);
-}
-
-class X : public A
-{
-public:
-  static ns3::InterfaceId iid (void) {
-    static ns3::InterfaceId iid = ns3::InterfaceId ("X")
-      .SetParent<A> ();
-    return iid;
-  }
-
-};
-class C : public X
-{
-public:
-  static ns3::InterfaceId iid (void) {
-    static ns3::InterfaceId iid = ns3::InterfaceId ("C")
-      .SetParent<X> ();
-    return iid;
-  }
-};
-class D : public C
-{
-public:
-  static ns3::InterfaceId iid (void) {
-    static ns3::InterfaceId iid = ns3::InterfaceId ("D")
-      .SetParent<C> ();
-    return iid;
-  }
-  static const ns3::ClassId cid;
-};
-
-const ns3::ClassId D::cid = ns3::MakeClassId<D> ("D", A::iid (), X::iid (), C::iid (), D::iid ());
-
-}
-
-namespace ns3 {
-
-class ComponentManagerTest : public Test
-{
-public:
-  ComponentManagerTest ();
-  virtual bool RunTests (void);
-};
-
-ComponentManagerTest::ComponentManagerTest ()
-  : Test ("ComponentManager")
-{}
-bool 
-ComponentManagerTest::RunTests (void)
-{
-  bool ok = true;
-
-  Ptr<A> a = 0;
-  a = ComponentManager::Create<A> (A::cidZero);
-  if (a == 0 ||
-      !a->m_zeroInvoked)
-    {
-      ok = false;
-    }
-
-  a = ComponentManager::Create<A,bool> (A::cidOneBool, true);
-  if (a == 0 ||
-      !a->m_oneBoolInvoked ||
-      !a->m_bool)
-    {
-      ok = false;
-    }
-
-  a = ComponentManager::Create<A,bool> (A::cidOneBool, false);
-  if (a == 0 ||
-      !a->m_oneBoolInvoked ||
-      a->m_bool)
-    {
-      ok = false;
-    }
-
-  a = ComponentManager::Create<A,uint32_t> (A::cidOneUi32, 10);
-  if (a == 0 ||
-      !a->m_oneUi32Invoked ||
-      a->m_ui32 != 10)
-    {
-      ok = false;
-    }
-
-  a = ComponentManager::Create<A> (A::cidOneUi32, (uint32_t)10);
-  if (a == 0 ||
-      !a->m_oneUi32Invoked ||
-      a->m_ui32 != 10)
-    {
-      ok = false;
-    }
-
-  Ptr<B> b = ComponentManager::Create<B,uint32_t> (A::cidOneUi32, 10);
-  if (b == 0)
-    {
-      ok = false;
-    }
-
-  return ok;
-}
-
-
-static ComponentManagerTest g_unknownManagerTest;
-
-} // namespace ns3
-
-#endif /* RUN_SELF_TESTS */
--- a/src/core/component-manager.h	Thu Jan 03 11:37:23 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,679 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef COMPONENT_MANAGER_H
-#define COMPONENT_MANAGER_H
-
-#include <string>
-#include <vector>
-#include <stdint.h>
-#include "callback.h"
-#include "object.h"
-#include "fatal-error.h"
-#include "ptr.h"
-#include "empty.h"
-#include "default-value.h"
-
-namespace {
-  // anonymous namespace for implementation code.
-template <typename T, typename T1 = ns3::empty, typename T2 = ns3::empty,
-          typename T3 = ns3::empty, typename T4 = ns3::empty, typename T5 = ns3::empty>
-struct ObjectMaker;
-}
-
-namespace ns3 {
-
-/**
- * \brief Unique Identifier for class constructors.
- *
- * Instances of this type must be allocated through
- * the ns3::MakeClassId class.
- */
-class ClassId
-{
-public:
-  /**
-   * \returns the symbolic name associated to this class id
-   *
-   * This name is the name which was associated to this class id
-   * by the ns3::Ns3UnknownManager::RegisterConstructor methods.
-   * This name is also the name which is expected to be input
-   * to ns3::UnknownManager::LookupByName.
-   */
-  std::string GetName (void) const;
-protected:
-  ClassId (std::string name);
-private:
-  ClassId (uint32_t classId);
-  friend class ComponentManager;
-  friend bool operator == (const ClassId &a, const ClassId &b);
-  uint32_t m_classId;
-};
-
-/**
- * \brief a class used to create ClassIds
- *
- * 
- */
-template <typename T, typename T1 = empty, typename T2 = empty,
-          typename T3 = empty, typename T4 = empty, typename T5 = empty>
-class MakeClassId : public ClassId
-{
-public:
-  /**
-   * \param name name of ClassId
-   *
-   * Create a ClassId with specified name.
-   */
-  MakeClassId (std::string name);
-  /**
-   * \param name name of ClassId
-   * \param iid interface id
-   *
-   * Create a ClassId with specified name. Register iid
-   * as a supported interface.
-   */
-  MakeClassId (std::string name, 
-               InterfaceId iid);
-  /**
-   * \param name name of ClassId
-   * \param iid0 interface id
-   * \param iid1 interface id
-   *
-   * Create a ClassId with specified name. Register iid0 and iid1
-   * as supported interfaces.
-   */
-  MakeClassId (std::string name, 
-               InterfaceId iid0, 
-               InterfaceId iid1);
-  /**
-   * \param name name of ClassId
-   * \param iid0 interface id
-   * \param iid1 interface id
-   * \param iid2 interface id
-   *
-   * Create a ClassId with specified name. Register iid0, iid1
-   * and iid2 as supported interfaces.
-   */
-  MakeClassId (std::string name, 
-               InterfaceId iid0, 
-               InterfaceId iid1,
-               InterfaceId iid2);
-  /**
-   * \param name name of ClassId
-   * \param iid0 interface id
-   * \param iid1 interface id
-   * \param iid2 interface id
-   * \param iid3 interface id
-   *
-   * Create a ClassId with specified name. Register iid0, iid1
-   * iid2, and iid3 as supported interfaces.
-   */
-  MakeClassId (std::string name, 
-               InterfaceId iid0, 
-               InterfaceId iid1,
-               InterfaceId iid2,
-               InterfaceId iid3);
-  /**
-   * \param name name of ClassId
-   * \param iid0 interface id
-   * \param iid1 interface id
-   * \param iid2 interface id
-   * \param iid3 interface id
-   * \param iid4 interface id
-   *
-   * Create a ClassId with specified name. Register iid0, iid1
-   * iid2, iid3, and iid4 as supported interfaces.
-   */
-  MakeClassId (std::string name, 
-               InterfaceId iid0, 
-               InterfaceId iid1,
-               InterfaceId iid2,
-               InterfaceId iid3,
-               InterfaceId iid4);
-private:
-  typedef ObjectMaker<T,T1,T2,T3,T4,T5> MakerType;
-  static Callback<Ptr<Object>,T1,T2,T3,T4,T5> m_callback;
-  void Register (InterfaceId array [], uint32_t n);
-};
-
-
-/**
- * \brief Create any Interface
- *
- * This class keeps track of a set of ClassId, each
- * of which uniquely identifies the constructor of an
- * object which derives from the Interface base class.
- * This class can also create an instance of any of
- * the objects tracked through any of their tracked
- * constructor/ClassId.
- */
-class ComponentManager
-{
-public:
-  /**
-   * \param name the symbolic name to lookup
-   * \returns the ClassId associated to the input name.
-   */
-  static ClassId LookupByName (std::string name);
-  static ClassId LookupByName (std::string name, bool *ok);
-  /**
-   * \param iid interface id to lookup
-   * \returns the list of ClassId which can be used to
-   *          create objects which support the requested 
-   *          interface.
-   *
-   * Note that this method will not necessarily return the
-   * complete list of objects which support a given interface
-   * since dynamic aggregation of objects is not under
-   * the control of this class.
-   */
-  static std::vector<ClassId> LookupByInterfaceId (InterfaceId iid);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId. This method invokes the default constructor.
-   */
-  static Ptr<Object> Create (ClassId classId);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 argument to pass to the constructor.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId.
-   */
-  template <typename T1>
-  static Ptr<Object> Create (ClassId classId, T1 a1);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to the constructor.
-   * \param a2 second argument to pass to the constructor.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId.
-   */
-  template <typename T1, typename T2>
-  static Ptr<Object> Create (ClassId classId, T1 a1, T2 a2);
-
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to the constructor.
-   * \param a2 second argument to pass to the constructor.
-   * \param a3 third argument to pass to the constructor.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId.
-   */
-  template <typename T1, typename T2, typename T3>
-  static Ptr<Object> Create (ClassId classId, T1 a1, T2 a2, T3 a3);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to the constructor.
-   * \param a2 second argument to pass to the constructor.
-   * \param a3 third argument to pass to the constructor.
-   * \param a4 fourth argument to pass to the constructor.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId.
-   */
-  template <typename T1, typename T2, typename T3, typename T4>
-  static Ptr<Object> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to the constructor.
-   * \param a2 second argument to pass to the constructor.
-   * \param a3 third argument to pass to the constructor.
-   * \param a4 fourth argument to pass to the constructor.
-   * \param a5 fifth argument to pass to the constructor.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId.
-   */
-  template <typename T1, typename T2, typename T3, typename T4, typename T5>
-  static Ptr<Object> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId, call QueryInterface on it, and return the 
-   * result.
-   */
-  template <typename T>
-  static Ptr<T> Create (ClassId classId);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to constructor
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId, call QueryInterface on it, and return the 
-   * result.
-   */
-  template <typename T, typename T1>
-  static Ptr<T> Create (ClassId classId, T1 a1);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to constructor
-   * \param a2 second argument to pass to constructor
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId, call QueryInterface on it, and return the 
-   * result.
-   */
-  template <typename T, typename T1, typename T2>
-  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to constructor
-   * \param a2 second argument to pass to constructor
-   * \param a3 third argument to pass to constructor
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId, call QueryInterface on it, and return the 
-   * result.
-   */
-  template <typename T, typename T1, typename T2, typename T3>
-  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to constructor
-   * \param a2 second argument to pass to constructor
-   * \param a3 third argument to pass to constructor
-   * \param a4 fourth argument to pass to constructor
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId, call QueryInterface on it, and return the 
-   * result.
-   */
-  template <typename T, typename T1, typename T2, typename T3, typename T4>
-  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4);
-
-  /**
-   * \param classId class id of the constructor to invoke.
-   * \param a1 first argument to pass to constructor
-   * \param a2 second argument to pass to constructor
-   * \param a3 third argument to pass to constructor
-   * \param a4 fourth argument to pass to constructor
-   * \param a5 fifth argument to pass to constructor
-   * \return a pointer to the instance created.
-   *
-   * Create an instance of the object identified by its
-   * ClassId, call QueryInterface on it, and return the 
-   * result.
-   */
-  template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
-  static Ptr<T> Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
-
-private:
-  friend void RegisterCallback (ClassId classId, CallbackBase *callback, 
-                                std::vector<InterfaceId> supportedInterfaces);
-  static void Register (ClassId classId, CallbackBase *callback, 
-                        std::vector<InterfaceId> supportedInterfaces);
-
-  template <typename T1, typename T2,
-            typename T3, typename T4,
-            typename T5>
-  static Callback<Ptr<Object>,T1,T2,T3,T4,T5> DoGetCallback (ClassId classId);
-
-  struct ClassIdEntry {
-    ClassIdEntry (ClassId classId);
-    ClassId m_classId;
-    CallbackBase *m_callback;
-    std::vector<InterfaceId> m_supportedInterfaces;
-  };
-
-  typedef std::vector<struct ClassIdEntry> List;
-  static List *GetList (void);
-  static CallbackBase *Lookup (ClassId classId);
-};
-
-/**
- * \brief a DefaultValue class to handle ClassIds
- *
- * This class provides the necessary glue to allow
- * the Bind function and the command-line arguments
- * to control the type of an object to create.
- */
-class ClassIdDefaultValue : public DefaultValueBase
-{
-public:
-  /**
-   * \param name the name of this default value.
-   * \param help the help text associated to this default value
-   * \param iid the interface id which all objects created
-   *        through this "default value" must support.
-   * \param defaultValue the name of the object to create
-   *        by default.
-   */
-  ClassIdDefaultValue (std::string name, 
-                       std::string help,
-                       InterfaceId iid,
-                       std::string defaultValue);
-  /**
-   * \returns the ClassId of the object selected by the user.
-   */
-  ClassId GetValue (void) const;
-  /**
-   * \param classId the new ClassId selected.
-   *
-   * Override the currently-selected value.
-   */
-  void SetValue (ClassId classId);
-  /**
-   * \param name the new object selected.
-   *
-   * Override the currently-selected value.
-   */
-  void SetValue (std::string name);
-private:
-  virtual bool DoParseValue (const std::string &value);
-  virtual std::string DoGetType (void) const;
-  virtual std::string DoGetDefaultValue (void) const;
-  std::string m_defaultName;
-  std::string m_name;
-  InterfaceId m_interfaceId;
-};
-
-} // namespace ns3 
-
-
-namespace {
-
-template <typename T>
-struct ObjectMaker<T,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> {
-  static ns3::Ptr<ns3::Object> 
-  MakeObject (void) {
-    return ns3::CreateObject<T> ();
-  }
-};
-
-template <typename T, typename T1>
-struct ObjectMaker<T,T1,ns3::empty,ns3::empty,ns3::empty,ns3::empty> {
-  static ns3::Ptr<ns3::Object> 
-  MakeObject (T1 a1) {
-    return ns3::CreateObject<T> (a1);
-  }
-};
-
-template <typename T, typename T1, typename T2>
-struct ObjectMaker<T,T1,T2,ns3::empty,ns3::empty,ns3::empty> {
-  static ns3::Ptr<ns3::Object> 
-  MakeObject (T1 a1, T2 a2) {
-    return ns3::CreateObject<T> (a1, a2);
-  }
-};
-
-template <typename T, typename T1, typename T2, typename T3>
-struct ObjectMaker<T,T1,T2,T3,ns3::empty,ns3::empty> {
-  static ns3::Ptr<ns3::Object> 
-  MakeObject (T1 a1, T2 a2, T3 a3) {
-    return ns3::CreateObject<T> (a1, a2, a3);
-  }
-};
-
-template <typename T, typename T1, typename T2, typename T3,
-          typename T4>
-struct ObjectMaker<T,T1,T2,T3,T4,ns3::empty> {
-  static ns3::Ptr<ns3::Object> 
-  MakeObject (T1 a1, T2 a2, T3 a3, T4 a4) {
-    return ns3::CreateObject<T> (a1, a2, a3, a4);
-  }
-};
-
-template <typename T, typename T1, typename T2, typename T3,
-          typename T4, typename T5>
-struct ObjectMaker {
-  static ns3::Ptr<ns3::Object> 
-  MakeObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
-    return ns3::CreateObject<T> (a1, a2, a3, a4, a5);
-  }
-};
-
-} // anonymous namespace
-
-namespace ns3 {
-  
-void RegisterCallback (ClassId classId, ns3::CallbackBase *callback, 
-                       std::vector<InterfaceId> supportedInterfaces);
-
-
-
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-void 
-MakeClassId<T,T1,T2,T3,T4,T5>::Register (InterfaceId array [], uint32_t n) 
-{
-  std::vector<InterfaceId> supportedInterfaces;
-  for (uint32_t i = 0; i < n; i++)
-    {
-      supportedInterfaces.push_back (array[i]);
-    }
-  RegisterCallback (*this, &m_callback, supportedInterfaces);
-}
-
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-MakeClassId<T,T1,T2,T3,T4,T5>::MakeClassId (std::string name) 
-  : ClassId (name) 
-{
-  InterfaceId array[] = {};
-  Register (array, sizeof (array)/sizeof(InterfaceId));
-}
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-MakeClassId<T,T1,T2,T3,T4,T5>::MakeClassId (std::string name, 
-                                            InterfaceId iid) 
-  : ClassId (name) 
-{
-  InterfaceId array[] = {iid};
-  Register (array, sizeof (array)/sizeof(InterfaceId));
-}
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-MakeClassId<T,T1,T2,T3,T4,T5>::MakeClassId (std::string name, 
-                                            InterfaceId iid0, 
-                                            InterfaceId iid1) 
-  : ClassId (name) 
-{
-  InterfaceId array[] = {iid0, iid1};
-  Register (array, sizeof (array)/sizeof(InterfaceId));
-}
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-MakeClassId<T,T1,T2,T3,T4,T5>::MakeClassId (std::string name, 
-                                            InterfaceId iid0, 
-                                            InterfaceId iid1,
-                                            InterfaceId iid2)
-  : ClassId (name) 
-{
-  InterfaceId array[] = {iid0, iid1, iid2};
-  Register (array, sizeof (array)/sizeof(InterfaceId));
-}
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-MakeClassId<T,T1,T2,T3,T4,T5>::MakeClassId (std::string name, 
-                                            InterfaceId iid0, 
-                                            InterfaceId iid1,
-                                            InterfaceId iid2,
-                                            InterfaceId iid3)
-  : ClassId (name) 
-{
-  InterfaceId array[] = {iid0, iid1, iid2, iid3};
-  Register (array, sizeof (array)/sizeof(InterfaceId));
-}
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-MakeClassId<T,T1,T2,T3,T4,T5>::MakeClassId (std::string name, 
-                                            InterfaceId iid0, 
-                                            InterfaceId iid1,
-                                            InterfaceId iid2,
-                                            InterfaceId iid3,
-                                            InterfaceId iid4)
-  : ClassId (name) 
-{
-  InterfaceId array[] = {iid0, iid1, iid2, iid3, iid4};
-  Register (array, sizeof (array)/sizeof(InterfaceId));
-}
-
-template <typename T, typename T1, typename T2,
-          typename T3, typename T4, typename T5>
-Callback<Ptr<Object>,T1,T2,T3,T4,T5> MakeClassId<T,T1,T2,T3,T4,T5>::m_callback = 
-  MakeCallback (&MakeClassId::MakerType::MakeObject);
-
-
-
-template <typename T1, typename T2,
-          typename T3, typename T4,
-          typename T5>
-Callback<Ptr<Object>,T1,T2,T3,T4,T5>
-ComponentManager::DoGetCallback (ClassId classId)
-{
-  CallbackBase *callback = Lookup (classId);
-  if (callback == 0)
-    {
-      NS_FATAL_ERROR ("Invalid Class Id.");
-    }
-  Callback<Ptr<Object>,T1,T2,T3,T4,T5> reference;
-  reference.Assign (*callback);
-  return reference;
-}
-
-
-template <typename T1>
-Ptr<Object>
-ComponentManager::Create (ClassId classId, T1 a1)
-{
-  Callback<Ptr<Object>,T1> callback = DoGetCallback<T1,empty,empty,empty,empty> (classId);
-  return callback (a1);
-}
-
-template <typename T1, typename T2>
-Ptr<Object> 
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2)
-{
-  Callback<Ptr<Object>,T1,T2> callback = DoGetCallback<T1,T2,empty,empty,empty> (classId);
-  return callback (a1, a2);
-}
-
-template <typename T1, typename T2, typename T3>
-Ptr<Object> 
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3)
-{
-  Callback<Ptr<Object>,T1,T2,T3> callback = DoGetCallback<T1,T2,T3,empty,empty> (classId);
-  return callback (a1, a2, a3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-Ptr<Object> 
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4)
-{
-  Callback<Ptr<Object>,T1,T2,T3,T4> callback = DoGetCallback<T1,T2,T3,T4,empty> (classId);
-  return callback (a1, a2, a3, a4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-Ptr<Object> 
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
-{
-  Callback<Ptr<Object>,T1,T2,T3,T4,T5> callback = DoGetCallback<T1,T2,T3,T4,T5> (classId);
-  return callback (a1, a2, a3, a4, a5);
-}
-
-
-template <typename T>
-Ptr<T>
-ComponentManager::Create (ClassId classId)
-{
-  Ptr<Object> obj = Create (classId);
-  Ptr<T> i = obj->QueryInterface<T> ();
-  return i;
-}
-
-template <typename T, typename T1>
-Ptr<T>
-ComponentManager::Create (ClassId classId, T1 a1)
-{
-  Ptr<Object> obj = Create (classId, a1);
-  Ptr<T> i = obj->QueryInterface<T> ();
-  return i;
-}
-
-template <typename T, typename T1, typename T2>
-Ptr<T>
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2)
-{
-  Ptr<Object> obj = Create (classId, a1, a2);
-  Ptr<T> i = obj->QueryInterface<T> ();
-  return i;
-}
-
-
-template <typename T, typename T1, typename T2, typename T3>
-Ptr<T>
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3)
-{
-  Ptr<Object> obj = Create (classId, a1, a2, a3);
-  Ptr<T> i = obj->QueryInterface<T> ();
-  return i;
-}
-
-template <typename T, typename T1, typename T2, typename T3, typename T4>
-Ptr<T>
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4)
-{
-  Ptr<Object> obj = Create (classId, a1, a2, a3, a4);
-  Ptr<T> i = obj->QueryInterface<T> ();
-  return i;
-}
-
-template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
-Ptr<T>
-ComponentManager::Create (ClassId classId, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
-{
-  Ptr<Object> obj = Create (classId, a1, a2, a3, a4, a5);
-  Ptr<T> i = obj->QueryInterface<T> ();
-  return i;
-}
-
-} // namespace ns3
-
-#endif /* COMPONENT_MANAGER_H */
--- a/src/core/wscript	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/core/wscript	Thu Jan 03 11:39:45 2008 +0100
@@ -40,7 +40,6 @@
         'default-value.cc',
         'command-line.cc',
         'type-name.cc',
-        'component-manager.cc',
         'random-variable-default-value.cc',
         'variable-tracer-test.cc',
         'trace-context.cc',
@@ -81,7 +80,6 @@
         'default-value.h',
         'command-line.h',
         'type-name.h',
-        'component-manager.h',
         'type-traits.h',
         'random-variable-default-value.h',
         'trace-source.h',
--- a/src/internet-node/arp-l3-protocol.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/internet-node/arp-l3-protocol.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -35,6 +35,8 @@
 
 const uint16_t ArpL3Protocol::PROT_NUMBER = 0x0806;
 
+NS_OBJECT_ENSURE_REGISTERED (ArpL3Protocol);
+
 InterfaceId 
 ArpL3Protocol::iid (void)
 {
--- a/src/internet-node/ipv4-l3-protocol.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/internet-node/ipv4-l3-protocol.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -42,6 +42,8 @@
 
 const uint16_t Ipv4L3Protocol::PROT_NUMBER = 0x0800;
 
+NS_OBJECT_ENSURE_REGISTERED (Ipv4L3Protocol);
+
 InterfaceId 
 Ipv4L3Protocol::iid (void)
 {
--- a/src/internet-node/ipv4-l4-demux.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/internet-node/ipv4-l4-demux.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -30,6 +30,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (Ipv4L4Demux);
+
 Ipv4L4ProtocolTraceContextElement::Ipv4L4ProtocolTraceContextElement ()
   : m_protocolNumber (0)
 {}
--- a/src/mobility/grid-topology.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/grid-topology.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -28,13 +28,13 @@
     m_n (n),
     m_deltaX (deltaX),
     m_deltaY (deltaY),
-    m_positionClassId (StaticMobilityModel::cid)
+    m_positionInterfaceId (StaticMobilityModel::iid ())
 {}
 
 void 
-GridTopology::SetMobilityModel (ClassId classId)
+GridTopology::SetMobilityModel (InterfaceId interfaceId)
 {
-  m_positionClassId = classId;
+  m_positionInterfaceId = interfaceId;
 }
 
 void 
@@ -43,7 +43,7 @@
   double x, y;
   x = m_xMin + m_deltaX * (i % m_n);
   y = m_yMin + m_deltaY * (i / m_n);
-  Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_positionClassId);
+  Ptr<MobilityModel> mobility = m_positionInterfaceId.CreateObject ()->QueryInterface<MobilityModel> ();
   object->AddInterface (mobility);
   mobility->SetPosition (Vector (x, y, 0.0));
 }
@@ -54,7 +54,7 @@
   double x, y;
   x = m_xMin + m_deltaX * (i / m_n);
   y = m_yMin + m_deltaY * (i % m_n);
-  Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_positionClassId);
+  Ptr<MobilityModel> mobility = m_positionInterfaceId.CreateObject ()->QueryInterface<MobilityModel> ();
   object->AddInterface (mobility);
   mobility->SetPosition (Vector (x, y, 0.0));
 }
--- a/src/mobility/grid-topology.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/grid-topology.h	Thu Jan 03 11:39:45 2008 +0100
@@ -21,8 +21,8 @@
 #define GRID_TOPOLOGY_H
 
 #include <vector>
-#include "ns3/component-manager.h"
 #include "ns3/ptr.h"
+#include "ns3/object.h"
 
 namespace ns3 {
 
@@ -44,17 +44,17 @@
   GridTopology (double xMin, double yMin, uint32_t n, double deltaX, double deltaY);
 
   /**
-   * \param classId the classId of the position object to attach to each
+   * \param interfaceId the interfaceId of the position object to attach to each
    *        input object.
    */
-  void SetMobilityModel (ClassId classId);
+  void SetMobilityModel (InterfaceId interfaceId);
 
   /**
    * \param begin an iterator to the first object to layout.
    * \param end an iterator to the last object to layout.
    *
    * Attach a position (the type of position is specified through 
-   * the ClassId given to SetMobilityModelModel) to each input object
+   * the InterfaceId given to SetMobilityModelModel) to each input object
    * and configure its initial location with a set
    * of coordinates arranged according to a regular rectangular grid,
    * one row after the other.
@@ -67,7 +67,7 @@
    * \param end an iterator to the last object to layout.
    *
    * Attach a position (the type of position is specified through 
-   * the ClassId given to SetMobilityModelModel) to each input object
+   * the InterfaceId given to SetMobilityModelModel) to each input object
    * and configure its initial location with a set
    * of coordinates arranged according to a regular rectangular grid,
    * one column after the other.
@@ -83,7 +83,7 @@
   uint32_t m_n;
   double m_deltaX;
   double m_deltaY;
-  ClassId m_positionClassId;
+  InterfaceId m_positionInterfaceId;
 };
 
 } // namespace ns3
--- a/src/mobility/hierarchical-mobility-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/hierarchical-mobility-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -22,6 +22,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (HierarchicalMobilityModel);
+
 InterfaceId 
 HierarchicalMobilityModel::iid (void)
 {
--- a/src/mobility/mobility-model-notifier.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/mobility-model-notifier.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -23,14 +23,12 @@
 
 namespace ns3 {
 
-const ClassId MobilityModelNotifier::cid = 
-  MakeClassId<MobilityModelNotifier> ("MobilityModelNotifier", 
-                                      MobilityModelNotifier::iid ());
 InterfaceId 
 MobilityModelNotifier::iid (void)
 {
   static InterfaceId iid = InterfaceId ("MobilityModelNotifier")
-    .SetParent<Object> ();
+    .SetParent<Object> ()
+    .AddConstructor<MobilityModelNotifier> ();
   return iid;
 }
 
--- a/src/mobility/mobility-model-notifier.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/mobility-model-notifier.h	Thu Jan 03 11:39:45 2008 +0100
@@ -21,7 +21,6 @@
 #define MOBILITY_MODEL_NOTIFIER_H
 
 #include "ns3/object.h"
-#include "ns3/component-manager.h"
 #include "ns3/callback.h"
 #include "ns3/callback-trace-source.h"
 #include "mobility-model.h"
@@ -34,7 +33,6 @@
 class MobilityModelNotifier : public Object
 {
 public:
-  static const ClassId cid;
   static InterfaceId iid (void);
 
   /**
--- a/src/mobility/random-direction-2d-mobility-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-direction-2d-mobility-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -31,9 +31,8 @@
 namespace ns3 {
 
 const double RandomDirection2dMobilityModel::PI = 3.14159265358979323846;
-const ClassId RandomDirection2dMobilityModel::cid = 
-  MakeClassId<RandomDirection2dMobilityModel> ("RandomDirection2dMobilityModel",
-                                               MobilityModel::iid ());
+
+NS_OBJECT_ENSURE_REGISTERED (RandomDirection2dMobilityModel);
 
 
 static RandomVariableDefaultValue 
@@ -111,6 +110,16 @@
   return parameters;
 }
 
+InterfaceId
+RandomDirection2dMobilityModel::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("RandomDirection2dMobilityModel")
+    .SetParent<MobilityModel> ()
+    .AddConstructor<RandomDirection2dMobilityModel> ()
+    .AddConstructor<RandomDirection2dMobilityModel,Ptr<RandomDirection2dMobilityModelParameters> > ();
+  return iid;
+}
+
 
 RandomDirection2dMobilityModel::RandomDirection2dMobilityModel ()
   : m_parameters (RandomDirection2dMobilityModelParameters::GetCurrent ())
--- a/src/mobility/random-direction-2d-mobility-model.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-direction-2d-mobility-model.h	Thu Jan 03 11:39:45 2008 +0100
@@ -25,7 +25,6 @@
 #include "ns3/ptr.h"
 #include "ns3/nstime.h"
 #include "ns3/event-id.h"
-#include "ns3/component-manager.h"
 #include "ns3/rectangle.h"
 #include "mobility-model.h"
 #include "static-speed-helper.h"
@@ -90,7 +89,7 @@
 class RandomDirection2dMobilityModel : public MobilityModel
 {
  public:
-  static const ClassId cid;
+  static InterfaceId iid (void);
 
   /**
    * Create from \valueref{RandomDirection2dSpeed},
--- a/src/mobility/random-position.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-position.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -58,6 +58,8 @@
 	 "The y coordinate of the center of the random position disc.",
 	 0.0);
 
+NS_OBJECT_ENSURE_REGISTERED (RandomPosition);
+
 InterfaceId 
 RandomPosition::iid (void)
 {
@@ -66,13 +68,6 @@
   return iid;
 }
 
-const ClassId RandomRectanglePosition::cid = 
-  MakeClassId<RandomRectanglePosition> ("RandomRectanglePosition", 
-					RandomPosition::iid ());
-const ClassId RandomDiscPosition::cid = 
-  MakeClassId<RandomDiscPosition> ("RandomDiscPosition", 
-				   RandomPosition::iid ());
-
 RandomPosition::RandomPosition ()
 {
 }
@@ -80,6 +75,18 @@
 RandomPosition::~RandomPosition ()
 {}
 
+NS_OBJECT_ENSURE_REGISTERED (RandomRectanglePosition);
+
+InterfaceId
+RandomRectanglePosition::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("RandomRectanglePosition")
+    .SetParent<RandomPosition> ()
+    .AddConstructor<RandomRectanglePosition> ()
+    .AddConstructor<RandomRectanglePosition, const RandomVariable &, const RandomVariable &> ();
+  return iid;
+}
+
 RandomRectanglePosition::RandomRectanglePosition ()
   : m_x (g_rectangleX.GetCopy ()),
     m_y (g_rectangleY.GetCopy ())
@@ -104,6 +111,18 @@
   return Vector (x, y, 0.0);
 }
 
+NS_OBJECT_ENSURE_REGISTERED (RandomDiscPosition);
+
+InterfaceId
+RandomDiscPosition::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("RandomDiscPosition")
+    .SetParent<RandomPosition> ()
+    .AddConstructor<RandomDiscPosition> ()
+    .AddConstructor<RandomDiscPosition, const RandomVariable &, const RandomVariable &, double, double> ();
+  return iid;
+}   
+
 RandomDiscPosition::RandomDiscPosition ()
   : m_theta (g_discTheta.GetCopy ()),
     m_rho (g_discRho.GetCopy ()),
--- a/src/mobility/random-position.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-position.h	Thu Jan 03 11:39:45 2008 +0100
@@ -21,7 +21,6 @@
 #define RANDOM_POSITION_H
 
 #include "ns3/object.h"
-#include "ns3/component-manager.h"
 #include "vector.h"
 
 namespace ns3 {
@@ -52,7 +51,7 @@
 class RandomRectanglePosition : public RandomPosition
 {
 public:
-  static const ClassId cid;
+  static InterfaceId iid (void);
   /**
    * Create a random position model with construction
    * values from \valueref{RandomRectanglePositionX}, and
@@ -81,7 +80,7 @@
 class RandomDiscPosition : public RandomPosition
 {
 public:
-  static const ClassId cid;
+  static InterfaceId iid (void);
   /**
    * Create a random position model with construction
    * values from \valueref{RandomDiscPositionTheta},
--- a/src/mobility/random-topology.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-topology.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -22,16 +22,17 @@
 #include "random-topology.h"
 #include "random-position.h"
 #include "mobility-model.h"
+#include "ns3/interface-id-default-value.h"
 
 namespace ns3 {
 
-static ClassIdDefaultValue
+static InterfaceIdDefaultValue
 g_position ("RandomTopologyPositionType",
             "The type of initial random position in a 3d topology.",
             RandomPosition::iid (),
             "RandomRectanglePosition");
 
-static ClassIdDefaultValue
+static InterfaceIdDefaultValue
 g_mobility ("RandomTopologyMobilityType",
             "The type of mobility model attached to an object in a 3d topology.",
             MobilityModel::iid (),
@@ -40,9 +41,9 @@
 RandomTopology::RandomTopology ()
   : m_mobilityModel (g_mobility.GetValue ())
 {
-  m_positionModel = ComponentManager::Create<RandomPosition> (g_position.GetValue ());
+  m_positionModel = g_position.GetValue ().CreateObject ()->QueryInterface<RandomPosition> ();
 }
-RandomTopology::RandomTopology (Ptr<RandomPosition> positionModel, ClassId mobilityModel)
+RandomTopology::RandomTopology (Ptr<RandomPosition> positionModel, InterfaceId mobilityModel)
   : m_positionModel (positionModel),
     m_mobilityModel (mobilityModel)
 {}
@@ -52,9 +53,9 @@
 }
 
 void 
-RandomTopology::SetMobilityModel (ClassId classId)
+RandomTopology::SetMobilityModel (InterfaceId interfaceId)
 {
-  m_mobilityModel = classId;
+  m_mobilityModel = interfaceId;
 }
 
 void 
@@ -66,7 +67,7 @@
 void 
 RandomTopology::LayoutOne (Ptr<Object> object)
 {
-  Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_mobilityModel);
+  Ptr<MobilityModel> mobility = m_mobilityModel.CreateObject ()->QueryInterface<MobilityModel> ();
   object->AddInterface (mobility);
   Vector position = m_positionModel->Get ();
   mobility->SetPosition (position);
--- a/src/mobility/random-topology.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-topology.h	Thu Jan 03 11:39:45 2008 +0100
@@ -23,7 +23,6 @@
 
 #include "ns3/ptr.h"
 #include "ns3/object.h"
-#include "ns3/component-manager.h"
 
 namespace ns3 {
 
@@ -55,15 +54,15 @@
    * specified position and mobility models.
    */
   RandomTopology (Ptr<RandomPosition> positionModel,
-                  ClassId mobilityModel);
+                  InterfaceId mobilityModel);
 
   ~RandomTopology ();
 
   /**
-   * \param classId the type of mobility model attached to each
+   * \param interfaceId the type of mobility model attached to each
    *        input object if it does not have one already.
    */
-  void SetMobilityModel (ClassId classId);
+  void SetMobilityModel (InterfaceId interfaceId);
   /**
    * \param positionModel the position model used to initialize
    *        the position of each object.
@@ -91,7 +90,7 @@
   void Layout (const T &begin, const T &end);
  private:
   Ptr<RandomPosition> m_positionModel;
-  ClassId m_mobilityModel;
+  InterfaceId m_mobilityModel;
 };
 
 } // namespace ns3
--- a/src/mobility/random-walk-2d-mobility-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-walk-2d-mobility-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -31,9 +31,7 @@
 
 namespace ns3 {
 
-const ClassId RandomWalk2dMobilityModel::cid = 
-  MakeClassId<RandomWalk2dMobilityModel> ("RandomWalk2dMobilityModel", RandomWalk2dMobilityModel::iid ());
-
+NS_OBJECT_ENSURE_REGISTERED (RandomWalk2dMobilityModel);
 
 static EnumDefaultValue<RandomWalk2dMobilityModelParameters::Mode> 
 g_mode ("RandomWalk2dMode",
@@ -131,12 +129,28 @@
   return parameters;
 }
 
+InterfaceId
+RandomWalk2dMobilityModel::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("RandomWalkMobilityModel")
+    .SetParent<MobilityModel> ()
+    .AddConstructor<RandomWalk2dMobilityModel> ()
+    .AddConstructor<RandomWalk2dMobilityModel,Ptr<RandomWalk2dMobilityModelParameters> > ();
+  return iid;
+}
+
 RandomWalk2dMobilityModel::RandomWalk2dMobilityModel ()
   : m_parameters (RandomWalk2dMobilityModelParameters::GetCurrent ())
 {
   m_event = Simulator::ScheduleNow (&RandomWalk2dMobilityModel::Start, this);
 }
 
+RandomWalk2dMobilityModel::RandomWalk2dMobilityModel (Ptr<RandomWalk2dMobilityModelParameters> parameters)
+  : m_parameters (parameters)
+{
+  m_event = Simulator::ScheduleNow (&RandomWalk2dMobilityModel::Start, this);
+}
+
 void
 RandomWalk2dMobilityModel::Start (void)
 {
--- a/src/mobility/random-walk-2d-mobility-model.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-walk-2d-mobility-model.h	Thu Jan 03 11:39:45 2008 +0100
@@ -23,7 +23,6 @@
 
 #include "ns3/object.h"
 #include "ns3/nstime.h"
-#include "ns3/component-manager.h"
 #include "ns3/event-id.h"
 #include "ns3/rectangle.h"
 #include "mobility-model.h"
@@ -116,7 +115,7 @@
 class RandomWalk2dMobilityModel : public MobilityModel 
 {
  public:
-  static const ClassId cid;
+  static InterfaceId iid (void);
   /**
    * Instantiate a set of RandomWalk parameters initialized
    * with construction values from \valueref{RandomWalk2dMode},
--- a/src/mobility/random-waypoint-mobility-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-waypoint-mobility-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -21,12 +21,14 @@
 #include "ns3/simulator.h"
 #include "ns3/random-variable.h"
 #include "ns3/random-variable-default-value.h"
-#include "ns3/component-manager.h"
+#include "ns3/interface-id-default-value.h"
 #include "random-waypoint-mobility-model.h"
 #include "random-position.h"
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (RandomWaypointMobilityModel);
+
 static RandomVariableDefaultValue
 g_speed ("RandomWaypointSpeed",
 	 "A random variable used to pick the speed of a random waypoint model.",
@@ -37,20 +39,18 @@
 	 "A random variable used to pick the pause of a random waypoint model.",
 	 "Constant:2");
 
-static ClassIdDefaultValue
+static InterfaceIdDefaultValue
 g_position ("RandomWaypointPosition",
 	    "A random position model used to pick the next waypoint position.",
 	    RandomPosition::iid (),
 	    "RandomRectanglePosition");
 
-const ClassId RandomWaypointMobilityModel::cid = 
-  MakeClassId<RandomWaypointMobilityModel> ("RandomWaypointMobilityModel", MobilityModel::iid ());
 
 RandomWaypointMobilityModelParameters::RandomWaypointMobilityModelParameters ()
   : m_speed (g_speed.GetCopy ()),
     m_pause (g_pause.GetCopy ())
 {
-  m_position = ComponentManager::Create<RandomPosition> (g_position.GetValue ());
+  m_position = g_position.GetValue ().CreateObject ()->QueryInterface<RandomPosition> ();
 }
 RandomWaypointMobilityModelParameters::RandomWaypointMobilityModelParameters (Ptr<RandomPosition> randomPosition,
 									      const RandomVariable &speed,
@@ -100,6 +100,16 @@
   return parameters;
 }
 
+InterfaceId
+RandomWaypointMobilityModel::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("RandomWaypointMobilityModel")
+    .SetParent<MobilityModel> ()
+    .AddConstructor<RandomWaypointMobilityModel> ()
+    .AddConstructor<RandomWaypointMobilityModel,Ptr<RandomWaypointMobilityModelParameters> > ();
+  return iid;
+}
+
 RandomWaypointMobilityModel::RandomWaypointMobilityModel ()
   : m_parameters (RandomWaypointMobilityModelParameters::GetCurrent ())
 {
--- a/src/mobility/random-waypoint-mobility-model.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/random-waypoint-mobility-model.h	Thu Jan 03 11:39:45 2008 +0100
@@ -86,8 +86,7 @@
 class RandomWaypointMobilityModel : public MobilityModel
 {
 public:
-  static const ClassId cid;
-
+  static InterfaceId iid (void);
   /**
    * Default parameters from \valueref{RandomWaypointPause},
    * and, \valueref{RandomWaypointPosition}.
--- a/src/mobility/static-mobility-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/static-mobility-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -21,8 +21,17 @@
 
 namespace ns3 {
 
-const ClassId StaticMobilityModel::cid = MakeClassId<StaticMobilityModel> ("StaticMobilityModel", 
-                                                                           MobilityModel::iid ());
+NS_OBJECT_ENSURE_REGISTERED (StaticMobilityModel);
+
+InterfaceId
+StaticMobilityModel::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("StaticMobilityModel")
+    .SetParent<MobilityModel> ()
+    .AddConstructor<StaticMobilityModel> ()
+    .AddConstructor<StaticMobilityModel,const Vector &> ();
+  return iid;
+}
   
 StaticMobilityModel::StaticMobilityModel ()
 {}
--- a/src/mobility/static-mobility-model.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/static-mobility-model.h	Thu Jan 03 11:39:45 2008 +0100
@@ -20,7 +20,6 @@
 #ifndef STATIC_MOBILITY_MODEL_H
 #define STATIC_MOBILITY_MODEL_H
 
-#include "ns3/component-manager.h"
 #include "mobility-model.h"
 
 namespace ns3 {
@@ -33,7 +32,7 @@
 class StaticMobilityModel : public MobilityModel 
 {
 public:
-  static const ClassId cid;
+  static InterfaceId iid (void);
   /**
    * Create a position located at coordinates (0,0,0)
    */
--- a/src/mobility/static-speed-mobility-model.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/static-speed-mobility-model.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -22,13 +22,15 @@
 
 namespace ns3 {
 
-const ClassId StaticSpeedMobilityModel::cid = 
-  MakeClassId<StaticSpeedMobilityModel> ("StaticSpeedMobilityModel", 
-                                         StaticSpeedMobilityModel::iid ());
+NS_OBJECT_ENSURE_REGISTERED (StaticSpeedMobilityModel);
+
 InterfaceId StaticSpeedMobilityModel::iid (void)
 {
   static InterfaceId iid = InterfaceId ("StaticSpeedMobilityModel")
-    .SetParent<MobilityModel> ();
+    .SetParent<MobilityModel> ()
+    .AddConstructor<StaticSpeedMobilityModel> ()
+    .AddConstructor<StaticSpeedMobilityModel,const Vector &> ()
+    .AddConstructor<StaticSpeedMobilityModel,const Vector &,const Vector &> ();
   return iid;
 }
 
--- a/src/mobility/static-speed-mobility-model.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/mobility/static-speed-mobility-model.h	Thu Jan 03 11:39:45 2008 +0100
@@ -23,7 +23,6 @@
 #include <stdint.h>
 #include "mobility-model.h"
 #include "ns3/nstime.h"
-#include "ns3/component-manager.h"
 #include "static-speed-helper.h"
 
 namespace ns3 {
@@ -36,7 +35,6 @@
 class StaticSpeedMobilityModel : public MobilityModel 
 {
 public:
-  static const ClassId cid;
   static InterfaceId iid (void);
   /**
    * Create position located at coordinates (0,0,0) with
--- a/src/node/channel.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/channel.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -24,6 +24,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (Channel);
+
 InterfaceId 
 Channel::iid (void)
 {
--- a/src/node/drop-tail-queue.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/drop-tail-queue.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -24,9 +24,15 @@
 
 namespace ns3 {
 
-const ClassId DropTailQueue::cid = 
-  MakeClassId<DropTailQueue> ("DropTailQueue", Queue::iid ());
+NS_OBJECT_ENSURE_REGISTERED (DropTailQueue);
 
+InterfaceId DropTailQueue::iid (void) 
+{
+  static InterfaceId iid = InterfaceId ("DropTailQueue")
+    .SetParent<Queue> ()
+    .AddConstructor<DropTailQueue> ();
+  return iid;
+}
 
 DropTailQueue::DropTailQueue () :
   Queue (),
--- a/src/node/drop-tail-queue.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/drop-tail-queue.h	Thu Jan 03 11:39:45 2008 +0100
@@ -23,7 +23,6 @@
 #include <queue>
 #include "ns3/packet.h"
 #include "ns3/queue.h"
-#include "ns3/component-manager.h"
 
 namespace ns3 {
 
@@ -36,7 +35,7 @@
  */
 class DropTailQueue : public Queue {
 public:
-  static const ClassId cid;
+  static InterfaceId iid (void);
   /**
    * \brief DropTailQueue Constructor
    *
--- a/src/node/ipv4.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/ipv4.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -25,6 +25,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (Ipv4);
+
 InterfaceId 
 Ipv4::iid (void)
 {
--- a/src/node/net-device.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/net-device.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -33,6 +33,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (NetDevice);
+
 InterfaceId NetDevice::iid (void)
 {
   static InterfaceId iid = InterfaceId ("NetDevice")
--- a/src/node/node.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/node.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -29,6 +29,8 @@
 
 namespace ns3{
 
+NS_OBJECT_ENSURE_REGISTERED (Node);
+
 InterfaceId 
 Node::iid (void)
 {
--- a/src/node/packet-socket-factory.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/packet-socket-factory.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -24,6 +24,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (PacketSocketFactory);
+
 InterfaceId 
 PacketSocketFactory::iid (void)
 {
--- a/src/node/queue.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/queue.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -20,15 +20,17 @@
 #include "ns3/log.h"
 #include "ns3/composite-trace-resolver.h"
 #include "ns3/default-value.h"
-#include "ns3/component-manager.h"
+#include "ns3/interface-id-default-value.h"
 #include "queue.h"
 
 NS_LOG_COMPONENT_DEFINE ("Queue");
 
 namespace ns3 {
 
-static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue",
-                                                  Queue::iid (), "DropTailQueue");
+static InterfaceIdDefaultValue g_interfaceIdDefaultValue ("Queue", "Packet Queue",
+                                                          Queue::iid (), "DropTailQueue");
+
+NS_OBJECT_ENSURE_REGISTERED (Queue);
 
 
 std::string 
@@ -281,8 +283,8 @@
 Queue::CreateDefault (void)
 {
   NS_LOG_FUNCTION;
-  ClassId classId = g_classIdDefaultValue.GetValue ();
-  Ptr<Queue> queue = ComponentManager::Create<Queue> (classId);
+  InterfaceId interfaceId = g_interfaceIdDefaultValue.GetValue ();
+  Ptr<Queue> queue = interfaceId.CreateObject ()->QueryInterface<Queue> ();
   return queue;
 }
 
--- a/src/node/socket-factory.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/socket-factory.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -22,6 +22,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (SocketFactory);
+
 InterfaceId SocketFactory::iid (void)
 {
   static InterfaceId iid = InterfaceId ("SocketFactory")
--- a/src/node/udp.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/node/udp.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -22,6 +22,8 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (Udp);
+
 InterfaceId Udp::iid (void)
 {
   static InterfaceId iid = InterfaceId ("Udp")
--- a/src/routing/global-routing/global-router-interface.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/routing/global-routing/global-router-interface.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -431,6 +431,8 @@
 //
 // ---------------------------------------------------------------------------
 
+NS_OBJECT_ENSURE_REGISTERED (GlobalRouter);
+
 InterfaceId 
 GlobalRouter::iid (void)
 {
--- a/src/routing/olsr/olsr-agent-impl.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/routing/olsr/olsr-agent-impl.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -148,6 +148,17 @@
 
 /********** OLSR class **********/
 
+NS_OBJECT_ENSURE_REGISTERED (AgentImpl);
+
+InterfaceId 
+AgentImpl::iid (void)
+{
+  static InterfaceId iid = InterfaceId ("OlsrAgentImpl")
+    .SetParent<Agent> ()
+    .AddConstructor<AgentImpl,Ptr<Node> > ();
+  return iid;
+}
+
 
 AgentImpl::AgentImpl (Ptr<Node> node)
   :
--- a/src/routing/olsr/olsr-agent-impl.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/routing/olsr/olsr-agent-impl.h	Thu Jan 03 11:39:45 2008 +0100
@@ -49,6 +49,8 @@
 class AgentImpl : public Agent
 {
 public:
+  static InterfaceId iid (void);
+
   AgentImpl (Ptr<Node> node);
 
   virtual void Start ();
--- a/src/routing/olsr/olsr-agent.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/routing/olsr/olsr-agent.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -19,12 +19,18 @@
  */
 
 #include "olsr-agent.h"
-#include "olsr-agent-impl.h"
+#include "ns3/interface-id-default-value.h"
 
 namespace ns3 {
 namespace olsr {
 
-const ClassId Agent::cid = MakeClassId< AgentImpl, Ptr<Node> > ("OlsrAgent", Agent::iid ());
+static InterfaceIdDefaultValue g_defaultImpl =
+  InterfaceIdDefaultValue ("OlsrAgentType",
+                           "The type of OlsrAgent implementation",
+                           Agent::iid (),
+                           "OlsrAgentImpl");
+
+NS_OBJECT_ENSURE_REGISTERED (Agent);
 
 InterfaceId 
 Agent::iid (void)
@@ -34,5 +40,13 @@
   return iid;
 }
 
+Ptr<Agent> 
+Agent::CreateDefault (Ptr<Node> node)
+{
+  InterfaceId iid = g_defaultImpl.GetValue ();
+  Ptr<Agent> agent = iid.CreateObject (node)->QueryInterface<Agent> ();
+  return agent;
+}
+
 
 }}
--- a/src/routing/olsr/olsr-agent.h	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/routing/olsr/olsr-agent.h	Thu Jan 03 11:39:45 2008 +0100
@@ -22,7 +22,6 @@
 #define OLSR_AGENT_H
 
 #include "ns3/node.h"
-#include "ns3/component-manager.h"
 
 namespace ns3 {
 namespace olsr {
@@ -38,7 +37,7 @@
  * Example:
  *
  * \code
- * Ptr<olsr::Agent> olsr = ComponentManager::Create<olsr::Agent, Ptr<Node> > (olsr::Agent::cid, olsr::Agent::iid, node);
+ * Ptr<olsr::Agent> olsr = Agend::CreateDefault ();
  * agent->SetMainInterface (2);
  * agent->Start ();
  * \endcode
@@ -47,7 +46,8 @@
 {
 public:
   static InterfaceId iid (void);
-  static const ClassId cid;
+
+  static Ptr<Agent> CreateDefault (Ptr<Node> node);
 
   /**
    * \brief Sets the main interface to be used by OLSR
--- a/src/routing/olsr/olsr.cc	Thu Jan 03 11:37:23 2008 +0100
+++ b/src/routing/olsr/olsr.cc	Thu Jan 03 11:39:45 2008 +0100
@@ -33,8 +33,7 @@
 void
 EnableNode (Ptr<Node> node)
 {
-  ComponentManager::Create<olsr::Agent, Ptr<Node> >
-    (olsr::Agent::cid, node)->Start ();
+  olsr::Agent::CreateDefault (node);
 }