src/mobility/mobility-helper.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 08 Feb 2008 17:52:20 +0100
changeset 2401 281ea8b13525
parent 2399 fd9d94d518d2
child 2433 3a98e1db7f80
permissions -rw-r--r--
add hierarchical support to MobilityHelper
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2399
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
#ifndef MOBILITY_HELPER_H
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
#define MOBILITY_HELPER_H
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
#include <vector>
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
#include "ns3/object-factory.h"
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
#include "ns3/value.h"
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
#include "position-allocator.h"
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
namespace ns3 {
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
class PositionAllocator;
2401
281ea8b13525 add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2399
diff changeset
    12
class MobilityModel;
2399
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
class MobilityHelper
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
{
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
public:
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
  MobilityHelper ();
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
  void EnableNotifier (void);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
  void DisableNotifier (void);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
  void SetPositionAllocator (Ptr<PositionAllocator> allocator);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
  void SetPositionAllocator (std::string type,
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
			     std::string n1 = "", PValue v1 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
			     std::string n2 = "", PValue v2 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
			     std::string n3 = "", PValue v3 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
			     std::string n4 = "", PValue v4 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
			     std::string n5 = "", PValue v5 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
			     std::string n6 = "", PValue v6 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
			     std::string n7 = "", PValue v7 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
			     std::string n8 = "", PValue v8 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
			     std::string n9 = "", PValue v9 = PValue ());
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
  void SetMobilityModel (std::string type,
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
			 std::string n1 = "", PValue v1 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
			 std::string n2 = "", PValue v2 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
			 std::string n3 = "", PValue v3 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
			 std::string n4 = "", PValue v4 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
			 std::string n5 = "", PValue v5 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
			 std::string n6 = "", PValue v6 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
			 std::string n7 = "", PValue v7 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
			 std::string n8 = "", PValue v8 = PValue (),
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
			 std::string n9 = "", PValue v9 = PValue ());
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
2401
281ea8b13525 add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2399
diff changeset
    46
  void PushReferenceMobilityModel (Ptr<Object> reference);
281ea8b13525 add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2399
diff changeset
    47
  void PopReferenceMobilityModel (void);
281ea8b13525 add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2399
diff changeset
    48
2399
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
  std::string GetMobilityModelType (void) const;
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
  template <typename T>
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
  void Layout (T begin, T end);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
private:
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
  void Layout (const std::vector<Ptr<Object> > &objects);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
2401
281ea8b13525 add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2399
diff changeset
    56
  std::vector<Ptr<MobilityModel> > m_mobilityStack;
2399
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
  bool m_notifierEnabled;
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
  ObjectFactory m_mobility;
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  Ptr<PositionAllocator> m_position;
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
};
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
} // namespace ns3
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
namespace ns3 {
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
template <typename T>
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
void
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
MobilityHelper::Layout (T begin, T end)
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
{
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
  std::vector<Ptr<Object> > objects;
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
  for (T i = begin; i != end; i++)
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
    {
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
      Ptr<Object> object = *i;
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
      objects.push_back (object);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
    }
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
  Layout (objects);
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
}
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
} // namespace ns3
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
fd9d94d518d2 convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
#endif /* MOBILITY_HELPER_H */