src/node/mobility-model.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 17 Jul 2007 11:13:34 +0200
changeset 1590 6c3a3ed42635
parent 1588 51b44f1f4ae5
child 1598 e31df5943d6a
permissions -rw-r--r--
remove unused class declarations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2006,2007 INRIA
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 * All rights reserved.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 * GNU General Public License for more details.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
 */
1581
95a193d3ac1d POSITION_H -> MOBILITY_MODEL_H
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1580
diff changeset
    21
#ifndef MOBILITY_MODEL_H
95a193d3ac1d POSITION_H -> MOBILITY_MODEL_H
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1580
diff changeset
    22
#define MOBILITY_MODEL_H
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "ns3/object.h"
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
namespace ns3 {
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
1590
6c3a3ed42635 remove unused class declarations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1588
diff changeset
    28
class Position
1582
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    29
{
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    30
public:
1590
6c3a3ed42635 remove unused class declarations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1588
diff changeset
    31
  Position (double x, double y, double z);
1582
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    32
  double x;
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    33
  double y;
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    34
  double z;
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    35
};
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    36
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
/**
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
 * \brief keep track of the current position of an object
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
 *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
 * All space coordinates in this class and its subclasses are
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
 * understood to be meters or meters/s. i.e., they are all
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
 * metric international units.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
 */
1579
a4187ed1e45e Position -> MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1556
diff changeset
    44
class MobilityModel : public Object
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
{
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
public:
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
  static const InterfaceId iid;
1579
a4187ed1e45e Position -> MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1556
diff changeset
    48
  MobilityModel ();
a4187ed1e45e Position -> MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1556
diff changeset
    49
  virtual ~MobilityModel () = 0;
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
  /**
1583
470803bf9961 use new MobilityModel::Get and remove old one.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1582
diff changeset
    52
   * \returns the current position
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
   * Unit is meters
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
   */
1582
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    55
  Position Get (void) const;
1554
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    56
1544
55080c1f8a22 add Position::DoSet et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1542
diff changeset
    57
  void Set (double x, double y, double z);
1582
92a3e76ec1c5 add Position class and Get/Set methods on MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1581
diff changeset
    58
  void Set (const Position &position);
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  /**
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
   * \param position a reference to another position object instance
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
   * \returns the distance between the two objects.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
   *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
   * Unit is meters
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
   */
1579
a4187ed1e45e Position -> MobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1556
diff changeset
    65
  double GetDistanceFrom (const MobilityModel &position) const;
1554
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    66
protected:
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    67
  /**
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    68
   * Must be invoked by subclasses when the course of the
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    69
   * position changes to notify course change listeners.
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    70
   */
76e781c120bb rework the notification mechanism to allow its optional use with every position model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1545
diff changeset
    71
  void NotifyCourseChange (void) const;
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
private:
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
  /**
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
   * \param x reference to floating-point variable for x coordinate.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
   * \param y reference to floating-point variable for y coordinate.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
   * \param z reference to floating-point variable for z coordinate.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
   *
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
   * Store in the x, y, and z variables the current coordinates
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
   * managed by this position object. Concrete subclasses of this 
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
   * base class must implement this method.
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
   * Unit is meters
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
   */
1584
b612c5fe9e6b new version of DoGet and DoSet
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1583
diff changeset
    83
  virtual Position DoGet (void) const = 0;
b612c5fe9e6b new version of DoGet and DoSet
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1583
diff changeset
    84
  virtual void DoSet (const Position &position) = 0;
1542
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
};
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
}; // namespace ns3
7d62f83de7d3 position models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
1581
95a193d3ac1d POSITION_H -> MOBILITY_MODEL_H
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1580
diff changeset
    89
#endif /* MOBILITY_MODEL_H */