PositionSetNotifier -> MobilityModelNotifier
This commit is contained in:
@@ -249,7 +249,7 @@ node.add_sources ([
|
||||
'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 @@ node.add_inst_headers ([
|
||||
'ipv4.h',
|
||||
'application.h',
|
||||
'position.h',
|
||||
'position-set-notifier.h',
|
||||
'mobility-model-notifier.h',
|
||||
'static-position.h',
|
||||
'static-speed-position.h',
|
||||
'grid-topology.h',
|
||||
|
||||
@@ -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 @@ int main (int argc, char *argv[])
|
||||
|
||||
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));
|
||||
|
||||
@@ -18,27 +18,27 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include "position-set-notifier.h"
|
||||
#include "mobility-model-notifier.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
const InterfaceId PositionSetNotifier::iid = MakeInterfaceId ("PositionSetNotifier", Object::iid);
|
||||
const ClassId PositionSetNotifier::cid =
|
||||
MakeClassId<PositionSetNotifier> ("PositionSetNotifier",
|
||||
PositionSetNotifier::iid);
|
||||
const InterfaceId MobilityModelNotifier::iid = MakeInterfaceId ("MobilityModelNotifier", Object::iid);
|
||||
const ClassId MobilityModelNotifier::cid =
|
||||
MakeClassId<MobilityModelNotifier> ("MobilityModelNotifier",
|
||||
MobilityModelNotifier::iid);
|
||||
|
||||
PositionSetNotifier::PositionSetNotifier ()
|
||||
MobilityModelNotifier::MobilityModelNotifier ()
|
||||
{
|
||||
SetInterfaceId (PositionSetNotifier::iid);
|
||||
SetInterfaceId (MobilityModelNotifier::iid);
|
||||
}
|
||||
|
||||
void
|
||||
PositionSetNotifier::RegisterListener (Listener listener)
|
||||
MobilityModelNotifier::RegisterListener (Listener listener)
|
||||
{
|
||||
m_listeners.push_back (listener);
|
||||
}
|
||||
void
|
||||
PositionSetNotifier::UnregisterListener (Listener callback)
|
||||
MobilityModelNotifier::UnregisterListener (Listener callback)
|
||||
{
|
||||
for (std::list<Listener>::iterator i = m_listeners.begin ();
|
||||
i != m_listeners.end ();)
|
||||
@@ -55,7 +55,7 @@ PositionSetNotifier::UnregisterListener (Listener callback)
|
||||
}
|
||||
}
|
||||
void
|
||||
PositionSetNotifier::Notify (Ptr<const Position> position) const
|
||||
MobilityModelNotifier::Notify (Ptr<const Position> position) const
|
||||
{
|
||||
for (std::list<Listener>::const_iterator i = m_listeners.begin ();
|
||||
i != m_listeners.end (); i++)
|
||||
@@ -18,8 +18,8 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef POSITION_SET_NOTIFIER_H
|
||||
#define POSITION_SET_NOTIFIER_H
|
||||
#ifndef MOBILITY_MODEL_NOTIFIER_H
|
||||
#define MOBILITY_MODEL_NOTIFIER_H
|
||||
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/component-manager.h"
|
||||
@@ -31,7 +31,7 @@ namespace ns3 {
|
||||
/**
|
||||
* \brief notify listeners of position changes.
|
||||
*/
|
||||
class PositionSetNotifier : public Object
|
||||
class MobilityModelNotifier : public Object
|
||||
{
|
||||
public:
|
||||
static const InterfaceId iid;
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
/**
|
||||
* Create a new position notifier
|
||||
*/
|
||||
PositionSetNotifier ();
|
||||
MobilityModelNotifier ();
|
||||
|
||||
/**
|
||||
* \param position the position which just changed.
|
||||
@@ -69,4 +69,4 @@ private:
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* POSITION_SET_NOTIFIER_H */
|
||||
#endif /* MOBILITY_MODEL_NOTIFIER_H */
|
||||
@@ -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 @@ Position::GetDistanceFrom (const Position &position) const
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user