A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vector.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 INRIA
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
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
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef NS3_VECTOR_H
21 #define NS3_VECTOR_H
22 
23 #include "attribute.h"
24 #include "attribute-helper.h"
25 
26 namespace ns3 {
27 
31 class Vector3D
32 {
33 public:
41  Vector3D (double _x, double _y, double _z);
45  Vector3D ();
49  double x;
53  double y;
57  double z;
58 };
59 
63 class Vector2D
64 {
65 public:
72  Vector2D (double _x, double _y);
76  Vector2D ();
80  double x;
84  double y;
85 };
86 
92 double CalculateDistance (const Vector3D &a, const Vector3D &b);
93 
99 double CalculateDistance (const Vector2D &a, const Vector2D &b);
100 
111 
112 std::ostream &operator << (std::ostream &os, const Vector3D &vector);
113 std::istream &operator >> (std::istream &is, Vector3D &vector);
114 std::ostream &operator << (std::ostream &os, const Vector2D &vector);
115 std::istream &operator >> (std::istream &is, Vector2D &vector);
116 
117 // for compatibility with mobility models
118 typedef Vector3D Vector;
120 typedef Vector3DChecker VectorChecker;
123 
124 } // namespace ns3
125 
126 #endif /* NS3_VECTOR_H */
Ptr< const AttributeChecker > MakeVectorChecker(void)
Definition: vector.cc:33
ATTRIBUTE_HELPER_HEADER(ObjectFactory)
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:49
double x
x coordinate of vector
Definition: vector.h:49
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
Vector3DChecker VectorChecker
Definition: vector.h:120
a 3d vector
Definition: vector.h:31
double x
x coordinate of vector
Definition: vector.h:80
Vector2D()
Create vector vector (0.0, 0.0)
Definition: vector.cc:63
double y
y coordinate of vector
Definition: vector.h:84
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition: vector.cc:71
Vector3D()
Create vector (0.0, 0.0, 0.0)
Definition: vector.cc:48
Vector3D Vector
Definition: vector.h:118
ATTRIBUTE_ACCESSOR_DEFINE(Boolean)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:43
a 3d vector
Definition: vector.h:63
double y
y coordinate of vector
Definition: vector.h:53
hold objects of type ns3::Vector3D
double z
z coordinate of vector
Definition: vector.h:57
Vector3DValue VectorValue
Definition: vector.h:119