RandomRectangleTopology -> RandomTopology
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 18 Jul 2007 10:53:53 +0200
changeset 1597 990f0fd3bf87
parent 1596 181db96ac3a4
child 1598 e31df5943d6a
RandomRectangleTopology -> RandomTopology
SConstruct
src/node/random-rectangle-topology.cc
src/node/random-rectangle-topology.h
src/node/random-topology.cc
src/node/random-topology.h
--- a/SConstruct	Wed Jul 18 10:46:44 2007 +0200
+++ b/SConstruct	Wed Jul 18 10:53:53 2007 +0200
@@ -253,7 +253,7 @@
     'static-mobility-model.cc',
     'static-speed-mobility-model.cc',
     'grid-topology.cc',
-    'random-rectangle-topology.cc',
+    'random-topology.cc',
     'random-walk-mobility-model.cc',
     'random-mobility-model.cc',
     'random-direction-mobility-model.cc',
@@ -284,7 +284,7 @@
     'static-mobility-model.h',
     'static-speed-mobility-model.h',
     'grid-topology.h',
-    'random-rectangle-topology.h',
+    'random-topology.h',
     'random-walk-mobility-model.h',
     'random-mobility-model.h',
     'random-direction-mobility-model.h',
--- a/src/node/random-rectangle-topology.cc	Wed Jul 18 10:46:44 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +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 "ns3/random-variable-default-value.h"
-#include "random-rectangle-topology.h"
-#include "random-2d-position.h"
-#include "mobility-model.h"
-
-namespace ns3 {
-
-static ClassIdDefaultValue
-g_position ("Random2dTopologyType",
-            "The type of initial random position in a 2d topology.",
-            Random2dPosition::iid,
-            "Rectangle");
-
-static ClassIdDefaultValue
-g_mobility ("Random2dTopologyMobilityModelType",
-            "The type of mobility model attached to an object in a 2d topology.",
-            MobilityModel::iid,
-            "StaticMobilityModel");
-
-RandomRectangleTopology::RandomRectangleTopology ()
-  : m_mobilityModel (g_mobility.GetValue ())
-{
-  m_positionModel = ComponentManager::Create<Random2dPosition> (g_position.GetValue (), 
-                                                                Random2dPosition::iid);
-}
-RandomRectangleTopology::RandomRectangleTopology (Ptr<Random2dPosition> positionModel, ClassId mobilityModel)
-  : m_positionModel (positionModel),
-    m_mobilityModel (mobilityModel)
-{}
-RandomRectangleTopology::~RandomRectangleTopology ()
-{
-  m_positionModel = 0;
-}
-
-void 
-RandomRectangleTopology::SetMobilityModel (ClassId classId)
-{
-  m_mobilityModel = classId;
-}
-
-void 
-RandomRectangleTopology::SetPositionModel (Ptr<Random2dPosition> positionModel)
-{
-  m_positionModel = positionModel;
-}
-
-void 
-RandomRectangleTopology::LayoutOne (Ptr<Object> object)
-{
-  Position2d position2d = m_positionModel->Get ();
-  Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_mobilityModel, 
-                                                                         MobilityModel::iid);
-  Position position = mobility->Get ();
-  position.x = position2d.x;
-  position.y = position2d.y;
-  mobility->Set (position);
-  object->AddInterface (mobility);
-}
-
-
-} // namespace ns3
--- a/src/node/random-rectangle-topology.h	Wed Jul 18 10:46:44 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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 RANDOM_RECTANGLE_TOPOLOGY_H
-#define RANDOM_RECTANGLE_TOPOLOGY_H
-
-#include "ns3/ptr.h"
-#include "ns3/object.h"
-#include "ns3/component-manager.h"
-
-namespace ns3 {
-
-class Random2dPosition;
-
-class RandomRectangleTopology
-{
- public:
-  RandomRectangleTopology ();
-  RandomRectangleTopology (Ptr<Random2dPosition> positionModel,
-                           ClassId mobilityModel);
-
-  ~RandomRectangleTopology ();
-
-  void SetMobilityModel (ClassId classId);
-  void SetPositionModel (Ptr<Random2dPosition> positionModel);
-
-  void LayoutOne (Ptr<Object> object);
-
-  template <typename T>
-  void Layout (const T &begin, const T &end);
- private:
-  Ptr<Random2dPosition> m_positionModel;
-  ClassId m_mobilityModel;
-};
-
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T>
-void 
-RandomRectangleTopology::Layout (const T &begin, const T &end)
-{
-  for (T i = begin; i != end; i++)
-    {
-      LayoutOne (*i);
-    }
-}
-
-
-} // namespace ns3 
-
-#endif /* RANDOM_RECTANGLE_TOPOLOGY_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-topology.cc	Wed Jul 18 10:53:53 2007 +0200
@@ -0,0 +1,81 @@
+/* -*-  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 "ns3/random-variable-default-value.h"
+#include "random-topology.h"
+#include "random-2d-position.h"
+#include "mobility-model.h"
+
+namespace ns3 {
+
+static ClassIdDefaultValue
+g_position ("Random2dTopologyType",
+            "The type of initial random position in a 2d topology.",
+            Random2dPosition::iid,
+            "Rectangle");
+
+static ClassIdDefaultValue
+g_mobility ("Random2dTopologyMobilityModelType",
+            "The type of mobility model attached to an object in a 2d topology.",
+            MobilityModel::iid,
+            "StaticMobilityModel");
+
+RandomTopology::RandomTopology ()
+  : m_mobilityModel (g_mobility.GetValue ())
+{
+  m_positionModel = ComponentManager::Create<Random2dPosition> (g_position.GetValue (), 
+                                                                Random2dPosition::iid);
+}
+RandomTopology::RandomTopology (Ptr<Random2dPosition> positionModel, ClassId mobilityModel)
+  : m_positionModel (positionModel),
+    m_mobilityModel (mobilityModel)
+{}
+RandomTopology::~RandomTopology ()
+{
+  m_positionModel = 0;
+}
+
+void 
+RandomTopology::SetMobilityModel (ClassId classId)
+{
+  m_mobilityModel = classId;
+}
+
+void 
+RandomTopology::SetPositionModel (Ptr<Random2dPosition> positionModel)
+{
+  m_positionModel = positionModel;
+}
+
+void 
+RandomTopology::LayoutOne (Ptr<Object> object)
+{
+  Position2d position2d = m_positionModel->Get ();
+  Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_mobilityModel, 
+                                                                         MobilityModel::iid);
+  Position position = mobility->Get ();
+  position.x = position2d.x;
+  position.y = position2d.y;
+  mobility->Set (position);
+  object->AddInterface (mobility);
+}
+
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-topology.h	Wed Jul 18 10:53:53 2007 +0200
@@ -0,0 +1,70 @@
+/* -*-  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 RANDOM_TOPOLOGY_H
+#define RANDOM_TOPOLOGY_H
+
+#include "ns3/ptr.h"
+#include "ns3/object.h"
+#include "ns3/component-manager.h"
+
+namespace ns3 {
+
+class Random2dPosition;
+
+class RandomTopology
+{
+ public:
+  RandomTopology ();
+  RandomTopology (Ptr<Random2dPosition> positionModel,
+                           ClassId mobilityModel);
+
+  ~RandomTopology ();
+
+  void SetMobilityModel (ClassId classId);
+  void SetPositionModel (Ptr<Random2dPosition> positionModel);
+
+  void LayoutOne (Ptr<Object> object);
+
+  template <typename T>
+  void Layout (const T &begin, const T &end);
+ private:
+  Ptr<Random2dPosition> m_positionModel;
+  ClassId m_mobilityModel;
+};
+
+} // namespace ns3
+
+namespace ns3 {
+
+template <typename T>
+void 
+RandomTopology::Layout (const T &begin, const T &end)
+{
+  for (T i = begin; i != end; i++)
+    {
+      LayoutOne (*i);
+    }
+}
+
+
+} // namespace ns3 
+
+#endif /* RANDOM_TOPOLOGY_H */