|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2006 INRIA |
|
4 * All rights reserved. |
|
5 * |
|
6 * This program is free software; you can redistribute it and/or modify |
|
7 * it under the terms of the GNU General Public License version 2 as |
|
8 * published by the Free Software Foundation; |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program; if not, write to the Free Software |
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 * |
|
19 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
20 */ |
|
21 #include "static-mobility-model.h" |
|
22 |
|
23 namespace ns3 { |
|
24 |
|
25 const InterfaceId StaticMobilityModel::iid = MakeInterfaceId ("StaticMobilityModel", MobilityModel::iid); |
|
26 const ClassId StaticMobilityModel::cid = MakeClassId<StaticMobilityModel,double, double> ("StaticMobilityModel", |
|
27 StaticMobilityModel::iid); |
|
28 |
|
29 StaticMobilityModel::StaticMobilityModel () |
|
30 : m_x (0.0), m_y (0.0), m_z (0.0) |
|
31 { |
|
32 SetInterfaceId (StaticMobilityModel::iid); |
|
33 } |
|
34 StaticMobilityModel::StaticMobilityModel (double x, double y) |
|
35 : m_x (x), m_y (y), m_z (0.0) |
|
36 { |
|
37 SetInterfaceId (StaticMobilityModel::iid); |
|
38 } |
|
39 StaticMobilityModel::StaticMobilityModel (double x, double y, double z) |
|
40 : m_x (x), m_y (y), m_z (z) |
|
41 { |
|
42 SetInterfaceId (StaticMobilityModel::iid); |
|
43 } |
|
44 StaticMobilityModel::~StaticMobilityModel () |
|
45 {} |
|
46 |
|
47 void |
|
48 StaticMobilityModel::DoGet (double &x, double &y, double &z) const |
|
49 { |
|
50 x = m_x; |
|
51 y = m_y; |
|
52 z = m_z; |
|
53 } |
|
54 void |
|
55 StaticMobilityModel::DoSet (double x, double y, double z) |
|
56 { |
|
57 bool changed = false; |
|
58 if (m_x != x || m_y != y || m_z != z) |
|
59 { |
|
60 changed = true; |
|
61 } |
|
62 m_x = x; |
|
63 m_y = y; |
|
64 m_z = z; |
|
65 if (changed) |
|
66 { |
|
67 NotifyCourseChange (); |
|
68 } |
|
69 } |
|
70 |
|
71 |
|
72 }; // namespace ns3 |