LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007 INRIA | 3 * Copyright (c) 2007 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
19 */ | 19 */ |
20 #ifndef NS3_VECTOR_H | 20 #ifndef NS3_VECTOR_H |
21 #define NS3_VECTOR_H | 21 #define NS3_VECTOR_H |
22 | 22 |
23 #include "attribute.h" | 23 #include "attribute.h" |
24 #include "attribute-helper.h" | 24 #include "attribute-helper.h" |
25 #include "ns3dll.h" | 25 |
| 26 #include "ns3/ns3-module.h" |
| 27 #define NS3_MODULE NS3_CORE_MODULE |
| 28 #include "ns3/ns3-export.h" |
26 | 29 |
27 /** | 30 /** |
28 * \file | 31 * \file |
29 * \ingroup geometry | 32 * \ingroup geometry |
30 * ns3::Vector, ns3::Vector2D and ns3::Vector3D declarations. | 33 * ns3::Vector, ns3::Vector2D and ns3::Vector3D declarations. |
31 */ | 34 */ |
32 | 35 |
33 namespace ns3 { | 36 namespace ns3 { |
34 | 37 |
35 /** | 38 /** |
36 * \ingroup core | 39 * \ingroup core |
37 * \defgroup geometry Geometry primitives | 40 * \defgroup geometry Geometry primitives |
38 * \brief Primitives for geometry, such as vectors and angles. | 41 * \brief Primitives for geometry, such as vectors and angles. |
39 */ | 42 */ |
40 ·· | 43 ·· |
41 /** | 44 /** |
42 * \ingroup geometry | 45 * \ingroup geometry |
43 * \brief a 3d vector | 46 * \brief a 3d vector |
44 * \see attribute_Vector3D | 47 * \see attribute_Vector3D |
45 */ | 48 */ |
46 class Vector3D | 49 class NS3_EXPORT Vector3D |
47 { | 50 { |
48 public: | 51 public: |
49 /** | 52 /** |
50 * \param [in] _x X coordinate of vector | 53 * \param [in] _x X coordinate of vector |
51 * \param [in] _y Y coordinate of vector | 54 * \param [in] _y Y coordinate of vector |
52 * \param [in] _z Z coordinate of vector | 55 * \param [in] _z Z coordinate of vector |
53 * | 56 * |
54 * Create vector (_x, _y, _z) | 57 * Create vector (_x, _y, _z) |
55 */ | 58 */ |
56 Vector3D (double _x, double _y, double _z); | 59 Vector3D (double _x, double _y, double _z); |
57 /** Create vector (0.0, 0.0, 0.0) */ | 60 /** Create vector (0.0, 0.0, 0.0) */ |
58 Vector3D (); | 61 Vector3D (); |
59 ·· | 62 ·· |
60 double x; //!< x coordinate of vector | 63 double x; //!< x coordinate of vector |
61 double y; //!< y coordinate of vector | 64 double y; //!< y coordinate of vector |
62 double z; //!< z coordinate of vector | 65 double z; //!< z coordinate of vector |
63 | 66 |
64 /** | 67 /** |
65 * Compute the length (magnitude) of the vector. | 68 * Compute the length (magnitude) of the vector. |
66 * \returns the vector length. | 69 * \returns the vector length. |
67 */ | 70 */ |
68 double GetLength () const; | 71 double GetLength () const; |
69 ·· | 72 ·· |
70 /** | 73 /** |
71 * \brief Calculate the Cartesian distance between two points. | 74 * \brief Calculate the Cartesian distance between two points. |
72 * \param [in] a One point | 75 * \param [in] a One point |
73 * \param [in] b Another point | 76 * \param [in] b Another point |
74 * \returns The distance between \p a and \p b. | 77 * \returns The distance between \p a and \p b. |
75 */ | 78 */ |
76 friend double CalculateDistance (const Vector3D &a, const Vector3D &b); | 79 friend NS3_EXPORT double CalculateDistance (const Vector3D &a, const Vector3D
&b); |
77 ·· | 80 ·· |
78 /** | 81 /** |
79 * Output streamer. | 82 * Output streamer. |
80 * Vectors are written as "x:y:z". | 83 * Vectors are written as "x:y:z". |
81 * | 84 * |
82 * \param [in,out] os The stream. | 85 * \param [in,out] os The stream. |
83 * \param [in] vector The vector to stream | 86 * \param [in] vector The vector to stream |
84 * \return The stream. | 87 * \return The stream. |
85 */ | 88 */ |
86 friend std::ostream &operator << (std::ostream &os, const Vector3D &vector); | 89 friend NS3_EXPORT std::ostream &operator << (std::ostream &os, const Vector3D
&vector); |
87 | 90 |
88 /** | 91 /** |
89 * Input streamer. | 92 * Input streamer. |
90 * | 93 * |
91 * Vectors are expected to be in the form "x:y:z". | 94 * Vectors are expected to be in the form "x:y:z". |
92 * | 95 * |
93 * \param [in,out] is The stream. | 96 * \param [in,out] is The stream. |
94 * \param [in] vector The vector. | 97 * \param [in] vector The vector. |
95 * \returns The stream. | 98 * \returns The stream. |
96 */ | 99 */ |
97 friend std::istream &operator >> (std::istream &is, Vector3D &vector); | 100 friend NS3_EXPORT std::istream &operator >> (std::istream &is, Vector3D &vecto
r); |
98 | 101 |
99 /** | 102 /** |
100 * Less than comparison operator | 103 * Less than comparison operator |
101 * \param [in] a lhs vector | 104 * \param [in] a lhs vector |
102 * \param [in] b rhs vector | 105 * \param [in] b rhs vector |
103 * \returns \c true if \p a is less than \p b | 106 * \returns \c true if \p a is less than \p b |
104 */ | 107 */ |
105 friend bool operator < (const Vector3D &a, const Vector3D &b); | 108 friend NS3_EXPORT bool operator < (const Vector3D &a, const Vector3D &b); |
106 | 109 |
107 /** | 110 /** |
108 * Addition operator. | 111 * Addition operator. |
109 * \param [in] a lhs vector. | 112 * \param [in] a lhs vector. |
110 * \param [in] b rhs vector. | 113 * \param [in] b rhs vector. |
111 * \returns The vector sum of \p a and \p b. | 114 * \returns The vector sum of \p a and \p b. |
112 */ | 115 */ |
113 friend Vector3D operator + (const Vector3D &a, const Vector3D &b); | 116 friend NS3_EXPORT Vector3D operator + (const Vector3D &a, const Vector3D &b); |
114 | 117 |
115 /** | 118 /** |
116 * Subtraction operator. | 119 * Subtraction operator. |
117 * \param [in] a lhs vector. | 120 * \param [in] a lhs vector. |
118 * \param [in] b rhs vector. | 121 * \param [in] b rhs vector. |
119 * \returns The vector differend of \p a less \p b. | 122 * \returns The vector differend of \p a less \p b. |
120 */ | 123 */ |
121 friend Vector3D operator - (const Vector3D &a, const Vector3D &b); | 124 friend NS3_EXPORT Vector3D operator - (const Vector3D &a, const Vector3D &b); |
122 }; | 125 }; |
123 | 126 |
124 /** | 127 /** |
125 * \ingroup geometry | 128 * \ingroup geometry |
126 * \brief a 2d vector | 129 * \brief a 2d vector |
127 * \see attribute_Vector2D | 130 * \see attribute_Vector2D |
128 */ | 131 */ |
129 class Vector2D | 132 class NS3_EXPORT Vector2D |
130 { | 133 { |
131 public: | 134 public: |
132 /** | 135 /** |
133 * \param [in] _x X coordinate of vector | 136 * \param [in] _x X coordinate of vector |
134 * \param [in] _y Y coordinate of vector | 137 * \param [in] _y Y coordinate of vector |
135 * | 138 * |
136 * Create vector (_x, _y) | 139 * Create vector (_x, _y) |
137 */ | 140 */ |
138 Vector2D (double _x, double _y); | 141 Vector2D (double _x, double _y); |
139 /** Constructor: (0.0, 0.0) */ | 142 /** Constructor: (0.0, 0.0) */ |
140 Vector2D (); | 143 Vector2D (); |
141 double x; //!< x coordinate of vector | 144 double x; //!< x coordinate of vector |
142 double y; //!< y coordinate of vector | 145 double y; //!< y coordinate of vector |
143 | 146 |
144 // works: /** \copydoc ns3::Vector3D::GetLength() */ | 147 // works: /** \copydoc ns3::Vector3D::GetLength() */ |
145 /** \copydoc Vector3D::GetLength() */ | 148 /** \copydoc Vector3D::GetLength() */ |
146 double GetLength () const; | 149 double GetLength () const; |
147 ·· | 150 ·· |
148 /** | 151 /** |
149 * \brief Calculate the Cartesian distance between two points. | 152 * \brief Calculate the Cartesian distance between two points. |
150 * \param [in] a One point | 153 * \param [in] a One point |
151 * \param [in] b Another point | 154 * \param [in] b Another point |
152 * \returns The distance between \p a and \p b. | 155 * \returns The distance between \p a and \p b. |
153 */ | 156 */ |
154 friend double CalculateDistance (const Vector2D &a, const Vector2D &b); | 157 friend NS3_EXPORT double CalculateDistance (const Vector2D &a, const Vector2D
&b); |
155 ·· | 158 ·· |
156 /** | 159 /** |
157 * Output streamer. | 160 * Output streamer. |
158 * Vectors are written as "x:y". | 161 * Vectors are written as "x:y". |
159 * | 162 * |
160 * \param [in,out] os The stream. | 163 * \param [in,out] os The stream. |
161 * \param [in] vector The vector to stream | 164 * \param [in] vector The vector to stream |
162 * \return The stream. | 165 * \return The stream. |
163 */ | 166 */ |
164 friend std::ostream &operator << (std::ostream &os, const Vector2D &vector); | 167 friend NS3_EXPORT std::ostream &operator << (std::ostream &os, const Vector2D
&vector); |
165 | 168 |
166 /** | 169 /** |
167 * Input streamer. | 170 * Input streamer. |
168 * | 171 * |
169 * Vectors are expected to be in the form "x:y". | 172 * Vectors are expected to be in the form "x:y". |
170 * | 173 * |
171 * \param [in,out] is The stream. | 174 * \param [in,out] is The stream. |
172 * \param [in] vector The vector. | 175 * \param [in] vector The vector. |
173 * \returns The stream. | 176 * \returns The stream. |
174 */ | 177 */ |
175 friend std::istream &operator >> (std::istream &is, Vector2D &vector); | 178 friend NS3_EXPORT std::istream &operator >> (std::istream &is, Vector2D &vecto
r); |
176 | 179 |
177 /** | 180 /** |
178 * Less than comparison operator | 181 * Less than comparison operator |
179 * \param [in] a lhs vector | 182 * \param [in] a lhs vector |
180 * \param [in] b rhs vector | 183 * \param [in] b rhs vector |
181 * \returns \c true if \p a is less than \p b | 184 * \returns \c true if \p a is less than \p b |
182 */ | 185 */ |
183 friend bool operator < (const Vector2D &a, const Vector2D &b); | 186 friend NS3_EXPORT bool operator < (const Vector2D &a, const Vector2D &b); |
184 | 187 |
185 /** | 188 /** |
186 * Addition operator. | 189 * Addition operator. |
187 * \param [in] a lhs vector. | 190 * \param [in] a lhs vector. |
188 * \param [in] b rhs vector. | 191 * \param [in] b rhs vector. |
189 * \returns The vector sum of \p a and \p b. | 192 * \returns The vector sum of \p a and \p b. |
190 */ | 193 */ |
191 friend Vector2D operator + (const Vector2D &a, const Vector2D &b); | 194 friend NS3_EXPORT Vector2D operator + (const Vector2D &a, const Vector2D &b); |
192 | 195 |
193 /** | 196 /** |
194 * Subtraction operator. | 197 * Subtraction operator. |
195 * \param [in] a lhs vector. | 198 * \param [in] a lhs vector. |
196 * \param [in] b rhs vector. | 199 * \param [in] b rhs vector. |
197 * \returns The vector differend of \p a less \p b. | 200 * \returns The vector differend of \p a less \p b. |
198 */ | 201 */ |
199 friend Vector2D operator - (const Vector2D &a, const Vector2D &b); | 202 friend NS3_EXPORT Vector2D operator - (const Vector2D &a, const Vector2D &b); |
200 }; | 203 }; |
201 | 204 |
202 double CalculateDistance (const Vector3D &a, const Vector3D &b); | 205 /** |
203 double CalculateDistance (const Vector2D &a, const Vector2D &b); | 206 * \param [in] a One point |
204 std::ostream &operator << (std::ostream &os, const Vector3D &vector); | 207 * \param [in] b Another point |
205 std::ostream &operator << (std::ostream &os, const Vector2D &vector); | 208 * \returns The cartesian distance between a and b. |
206 std::istream &operator >> (std::istream &is, Vector3D &vector); | 209 */ |
207 std::istream &operator >> (std::istream &is, Vector2D &vector); | 210 NS3_EXPORT double CalculateDistance (const Vector3D &a, const Vector3D &b); |
208 bool operator < (const Vector3D &a, const Vector3D &b);· | 211 /** |
209 bool operator < (const Vector2D &a, const Vector2D &b); | 212 * \param [in] a One point |
210 ·· | 213 * \param [in] b Another point |
211 ATTRIBUTE_HELPER_HEADER_LIB (Vector3D, NS3CORELIB); | 214 * \returns The cartesian distance between a and b. |
212 ATTRIBUTE_HELPER_HEADER_LIB (Vector2D, NS3CORELIB); | 215 */ |
| 216 NS3_EXPORT double CalculateDistance (const Vector2D &a, const Vector2D &b); |
| 217 /** |
| 218 * Output streamer. |
| 219 * |
| 220 * Vectors are written as "x:y:z". |
| 221 * |
| 222 * \param [in,out] os The stream. |
| 223 * \param [in] vector The vector to stream |
| 224 * \return The stream. |
| 225 */ |
| 226 NS3_EXPORT std::ostream &operator << (std::ostream &os, const Vector3D &vector); |
| 227 /** |
| 228 * Output streamer. |
| 229 * |
| 230 * Vectors are written as "x:y". |
| 231 * |
| 232 * \param [in,out] os The stream. |
| 233 * \param [in] vector The vector to stream |
| 234 * \return The stream. |
| 235 */ |
| 236 NS3_EXPORT std::ostream &operator << (std::ostream &os, const Vector2D &vector); |
| 237 /** |
| 238 * Input streamer. |
| 239 * |
| 240 * Vectors are expected to be in the form "x:y:z". |
| 241 * |
| 242 * \param [in,out] is The stream. |
| 243 * \param [in] vector The vector. |
| 244 * \returns The stream. |
| 245 */ |
| 246 NS3_EXPORT std::istream &operator >> (std::istream &is, Vector3D &vector); |
| 247 /** |
| 248 * Input streamer. |
| 249 * |
| 250 * Vectors are expected to be in the form "x:y". |
| 251 * |
| 252 * \param [in,out] is The stream. |
| 253 * \param [in] vector The vector. |
| 254 * \returns The stream. |
| 255 */ |
| 256 NS3_EXPORT std::istream &operator >> (std::istream &is, Vector2D &vector); |
| 257 NS3_EXPORT bool operator < (const Vector3D &a, const Vector3D &b);· |
| 258 NS3_EXPORT bool operator < (const Vector2D &a, const Vector2D &b); |
| 259 ·· |
| 260 ATTRIBUTE_HELPER_HEADER_LIB (Vector3D, NS3_EXPORT); |
| 261 ATTRIBUTE_HELPER_HEADER_LIB (Vector2D, NS3_EXPORT); |
213 | 262 |
214 /** | 263 /** |
215 * \relates Vector3D | 264 * \relates Vector3D |
216 * Vector alias typedef for compatibility with mobility models | 265 * Vector alias typedef for compatibility with mobility models |
217 */ | 266 */ |
218 typedef Vector3D Vector; | 267 typedef Vector3D Vector; |
219 | 268 |
220 /** | 269 /** |
221 * \relates Vector3D | 270 * \relates Vector3D |
222 * Vector alias typedef for compatibility with mobility models | 271 * Vector alias typedef for compatibility with mobility models |
(...skipping 15 matching lines...) Expand all Loading... |
238 * \see AttributeAccessor | 287 * \see AttributeAccessor |
239 */ | 288 */ |
240 ·· | 289 ·· |
241 /** | 290 /** |
242 * \relates Vector3D | 291 * \relates Vector3D |
243 * \fn ns3::Ptr<const ns3::AttributeAccessor> ns3::MakeVectorAccessor (T1 a1, T2
a2) | 292 * \fn ns3::Ptr<const ns3::AttributeAccessor> ns3::MakeVectorAccessor (T1 a1, T2
a2) |
244 * \copydoc ns3::MakeAccessorHelper(T1,T2) | 293 * \copydoc ns3::MakeAccessorHelper(T1,T2) |
245 * \see AttributeAccessor | 294 * \see AttributeAccessor |
246 */ | 295 */ |
247 | 296 |
248 ATTRIBUTE_ACCESSOR_DEFINE_LIB (Vector, NS3CORELIB); | 297 ATTRIBUTE_ACCESSOR_DEFINE_LIB (Vector, NS3_EXPORT); |
249 | 298 |
250 /** | 299 /** |
251 * \relates Vector3D | 300 * \relates Vector3D |
252 * \returns The AttributeChecker. | 301 * \returns The AttributeChecker. |
253 * \see AttributeChecker | 302 * \see AttributeChecker |
254 */ | 303 */ |
255 Ptr<const AttributeChecker> MakeVectorChecker (void); | 304 NS3_EXPORT Ptr<const AttributeChecker> MakeVectorChecker (void); |
256 | 305 |
257 } // namespace ns3 | 306 } // namespace ns3 |
258 | 307 |
259 #endif /* NS3_VECTOR_H */ | 308 #endif /* NS3_VECTOR_H */ |
LEFT | RIGHT |