PositionSetNotifier -> MobilityModelNotifier
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 04 Jul 2007 09:56:22 +0200
changeset 1578 c06feb6d1f51
parent 1577 97fbb72ad779
child 1579 a4187ed1e45e
PositionSetNotifier -> MobilityModelNotifier
SConstruct
samples/main-random-walk.cc
src/node/mobility-model-notifier.cc
src/node/mobility-model-notifier.h
src/node/position-set-notifier.cc
src/node/position-set-notifier.h
src/node/position.cc
--- a/SConstruct	Wed Jul 04 09:48:49 2007 +0200
+++ b/SConstruct	Wed Jul 04 09:56:22 2007 +0200
@@ -249,7 +249,7 @@
     'ipv4.cc',
     'application.cc',
     'position.cc',
-    'position-set-notifier.cc',
+    'mobility-model-notifier.cc',
     'static-position.cc',
     'static-speed-position.cc',
     'grid-topology.cc',
@@ -274,7 +274,7 @@
     'ipv4.h',
     'application.h',
     'position.h',
-    'position-set-notifier.h',
+    'mobility-model-notifier.h',
     'static-position.h',
     'static-speed-position.h',
     'grid-topology.h',
--- a/samples/main-random-walk.cc	Wed Jul 04 09:48:49 2007 +0200
+++ b/samples/main-random-walk.cc	Wed Jul 04 09:56:22 2007 +0200
@@ -2,7 +2,7 @@
 
 #include "ns3/ptr.h"
 #include "ns3/position.h"
-#include "ns3/position-set-notifier.h"
+#include "ns3/mobility-model-notifier.h"
 #include "ns3/random-walk-position.h"
 #include "ns3/default-value.h"
 #include "ns3/command-line.h"
@@ -29,7 +29,7 @@
 
   CommandLine::Parse (argc, argv);
 
-  Ptr<PositionSetNotifier> notifier = Create<PositionSetNotifier> ();
+  Ptr<MobilityModelNotifier> notifier = Create<MobilityModelNotifier> ();
   Ptr<RandomWalkPosition> position = Create<RandomWalkPosition> ();
   position->AddInterface (notifier);
   notifier->RegisterListener (MakeCallback (&CourseChange));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mobility-model-notifier.cc	Wed Jul 04 09:56:22 2007 +0200
@@ -0,0 +1,68 @@
+/* -*-  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 "mobility-model-notifier.h"
+
+namespace ns3 {
+
+const InterfaceId MobilityModelNotifier::iid = MakeInterfaceId ("MobilityModelNotifier", Object::iid);
+const ClassId MobilityModelNotifier::cid = 
+  MakeClassId<MobilityModelNotifier> ("MobilityModelNotifier", 
+				    MobilityModelNotifier::iid);
+
+MobilityModelNotifier::MobilityModelNotifier ()
+{
+  SetInterfaceId (MobilityModelNotifier::iid);
+}
+
+void 
+MobilityModelNotifier::RegisterListener (Listener listener)
+{
+  m_listeners.push_back (listener);
+}
+void 
+MobilityModelNotifier::UnregisterListener (Listener callback)
+{
+  for (std::list<Listener>::iterator i = m_listeners.begin ();
+       i != m_listeners.end ();)
+    {
+      Listener listener = *i;
+      if (listener.IsEqual (callback))
+	{
+	  i = m_listeners.erase (i);
+	}
+      else
+	{
+	  i++;
+	}
+    }  
+}
+void 
+MobilityModelNotifier::Notify (Ptr<const Position> position) const
+{
+  for (std::list<Listener>::const_iterator i = m_listeners.begin ();
+       i != m_listeners.end (); i++)
+    {
+      Listener listener = *i;
+      listener (position);
+    }
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mobility-model-notifier.h	Wed Jul 04 09:56:22 2007 +0200
@@ -0,0 +1,72 @@
+/* -*-  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 MOBILITY_MODEL_NOTIFIER_H
+#define MOBILITY_MODEL_NOTIFIER_H
+
+#include "ns3/object.h"
+#include "ns3/component-manager.h"
+#include "ns3/callback.h"
+#include "position.h"
+
+namespace ns3 {
+
+/**
+ * \brief notify listeners of position changes.
+ */
+class MobilityModelNotifier : public Object
+{
+public:
+  static const InterfaceId iid;
+  static const ClassId cid;
+
+  typedef Callback<void,Ptr<const Position> > Listener;
+
+  /**
+   * Create a new position notifier
+   */
+  MobilityModelNotifier ();
+
+  /**
+   * \param position the position which just changed.
+   */
+  void Notify (Ptr<const Position> position) const;
+
+  /**
+   * \param listener listener to add
+   *
+   * The listener will be notified upon every position change.
+   */
+  void RegisterListener (Listener listener);
+  /**
+   * \param listener listener to remove
+   *
+   * The listener will not be notified anymore upon every 
+   * position change. It is not an error to try to unregister
+   * a non-registered liste
+   */
+  void UnregisterListener (Listener listener);
+private:
+  std::list<Listener> m_listeners;
+};
+
+} // namespace ns3
+
+#endif /* MOBILITY_MODEL_NOTIFIER_H */
--- a/src/node/position-set-notifier.cc	Wed Jul 04 09:48:49 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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 "position-set-notifier.h"
-
-namespace ns3 {
-
-const InterfaceId PositionSetNotifier::iid = MakeInterfaceId ("PositionSetNotifier", Object::iid);
-const ClassId PositionSetNotifier::cid = 
-  MakeClassId<PositionSetNotifier> ("PositionSetNotifier", 
-				    PositionSetNotifier::iid);
-
-PositionSetNotifier::PositionSetNotifier ()
-{
-  SetInterfaceId (PositionSetNotifier::iid);
-}
-
-void 
-PositionSetNotifier::RegisterListener (Listener listener)
-{
-  m_listeners.push_back (listener);
-}
-void 
-PositionSetNotifier::UnregisterListener (Listener callback)
-{
-  for (std::list<Listener>::iterator i = m_listeners.begin ();
-       i != m_listeners.end ();)
-    {
-      Listener listener = *i;
-      if (listener.IsEqual (callback))
-	{
-	  i = m_listeners.erase (i);
-	}
-      else
-	{
-	  i++;
-	}
-    }  
-}
-void 
-PositionSetNotifier::Notify (Ptr<const Position> position) const
-{
-  for (std::list<Listener>::const_iterator i = m_listeners.begin ();
-       i != m_listeners.end (); i++)
-    {
-      Listener listener = *i;
-      listener (position);
-    }
-}
-
-} // namespace ns3
--- a/src/node/position-set-notifier.h	Wed Jul 04 09:48:49 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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 POSITION_SET_NOTIFIER_H
-#define POSITION_SET_NOTIFIER_H
-
-#include "ns3/object.h"
-#include "ns3/component-manager.h"
-#include "ns3/callback.h"
-#include "position.h"
-
-namespace ns3 {
-
-/**
- * \brief notify listeners of position changes.
- */
-class PositionSetNotifier : public Object
-{
-public:
-  static const InterfaceId iid;
-  static const ClassId cid;
-
-  typedef Callback<void,Ptr<const Position> > Listener;
-
-  /**
-   * Create a new position notifier
-   */
-  PositionSetNotifier ();
-
-  /**
-   * \param position the position which just changed.
-   */
-  void Notify (Ptr<const Position> position) const;
-
-  /**
-   * \param listener listener to add
-   *
-   * The listener will be notified upon every position change.
-   */
-  void RegisterListener (Listener listener);
-  /**
-   * \param listener listener to remove
-   *
-   * The listener will not be notified anymore upon every 
-   * position change. It is not an error to try to unregister
-   * a non-registered liste
-   */
-  void UnregisterListener (Listener listener);
-private:
-  std::list<Listener> m_listeners;
-};
-
-} // namespace ns3
-
-#endif /* POSITION_SET_NOTIFIER_H */
--- a/src/node/position.cc	Wed Jul 04 09:48:49 2007 +0200
+++ b/src/node/position.cc	Wed Jul 04 09:56:22 2007 +0200
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "position.h"
-#include "position-set-notifier.h"
+#include "mobility-model-notifier.h"
 #include <math.h>
 
 namespace ns3 {
@@ -112,8 +112,8 @@
 void
 Position::NotifyCourseChange (void) const
 {
-  Ptr<PositionSetNotifier> notifier = 
-    QueryInterface<PositionSetNotifier> (PositionSetNotifier::iid);
+  Ptr<MobilityModelNotifier> notifier = 
+    QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
   if (notifier != 0)
     {
       notifier->Notify (this);