A Discrete-Event Network Simulator
API
Public Member Functions | Public Attributes | Friends | Related Functions | List of all members
ns3::Vector3D Class Reference

a 3d vector More...

#include "vector.h"

Public Member Functions

 Vector3D (double _x, double _y, double _z)
 
 Vector3D ()
 Create vector (0.0, 0.0, 0.0) More...
 
double GetLength () const
 Compute the length (magnitude) of the vector. More...
 

Public Attributes

double x
 x coordinate of vector More...
 
double y
 y coordinate of vector More...
 
double z
 z coordinate of vector More...
 

Friends

double CalculateDistance (const Vector3D &a, const Vector3D &b)
 Calculate the Cartesian distance between two points. More...
 
Vector3D operator+ (const Vector3D &a, const Vector3D &b)
 Addition operator. More...
 
Vector3D operator- (const Vector3D &a, const Vector3D &b)
 Subtraction operator. More...
 
bool operator< (const Vector3D &a, const Vector3D &b)
 Less than comparison operator. More...
 
std::ostream & operator<< (std::ostream &os, const Vector3D &vector)
 Output streamer. More...
 
std::istream & operator>> (std::istream &is, Vector3D &vector)
 Input streamer. More...
 

Related Functions

(Note that these are not member functions.)

ns3::Ptr< const ns3::AttributeAccessorMakeVectorAccessor (T1 a1)
 Create an AttributeAccessor for a class data member, or a lone class get functor or set method. More...
 
ns3::Ptr< const ns3::AttributeAccessorMakeVectorAccessor (T1 a1, T2 a2)
 Create an AttributeAccessor using a pair of get functor and set methods from a class. More...
 
Ptr< const AttributeCheckerMakeVectorChecker (void)
 
typedef Vector3D Vector
 
typedef Vector3DChecker VectorChecker
 
typedef Vector3DValue VectorValue
 

Detailed Description

a 3d vector

See also
Vector3D Attribute

Definition at line 45 of file vector.h.

Constructor & Destructor Documentation

◆ Vector3D() [1/2]

ns3::Vector3D::Vector3D ( double  _x,
double  _y,
double  _z 
)
Parameters
[in]_xX coordinate of vector
[in]_yY coordinate of vector
[in]_zZ coordinate of vector

Create vector (_x, _y, _z)

Definition at line 48 of file vector.cc.

References NS_LOG_FUNCTION.

◆ Vector3D() [2/2]

ns3::Vector3D::Vector3D ( )

Create vector (0.0, 0.0, 0.0)

Definition at line 56 of file vector.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ GetLength()

double ns3::Vector3D::GetLength ( ) const

Compute the length (magnitude) of the vector.

Returns
the vector length.

Definition at line 79 of file vector.cc.

References NS_LOG_FUNCTION, x, y, and z.

Friends And Related Function Documentation

◆ CalculateDistance

double CalculateDistance ( const Vector3D a,
const Vector3D b 
)
friend

Calculate the Cartesian distance between two points.

Parameters
[in]aOne point
[in]bAnother point
Returns
The distance between a and b.

Definition at line 92 of file vector.cc.

◆ MakeVectorAccessor() [1/2]

ns3::Ptr< const ns3::AttributeAccessor > MakeVectorAccessor ( T1  a1)
related

Create an AttributeAccessor for a class data member, or a lone class get functor or set method.

The get functor method should have a signature like

typedef U (T::*getter)(void) const

where T is the class and U is the type of the return value.

The set method should have one of these signatures:

typedef void (T::*setter)(U)
typedef bool (T::*setter)(U)

where T is the class and U is the type of the value to set the attribute to, which should be compatible with the specific AttributeValue type V which holds the value (or the type implied by the name Make<V>Accessor of this function.) In the case of a setter returning bool, the return value should be true if the value could be set successfully.

Template Parameters
V[explicit] (If present) The specific AttributeValue type to use to represent the Attribute. (If not present, the type V is implicit in the name of this function, as "Make<V>Accessor"
T1[deduced] The type of the class data member, or the type of the class get functor or set method.
Parameters
[in]a1The address of the data member, or the get or set method.
Returns
The AttributeAccessor
See also
AttributeAccessor

Definition at line 247 of file vector.h.

◆ MakeVectorAccessor() [2/2]

ns3::Ptr< const ns3::AttributeAccessor > MakeVectorAccessor ( T1  a1,
T2  a2 
)
related

Create an AttributeAccessor using a pair of get functor and set methods from a class.

The get functor method should have a signature like

typedef U (T::*getter)(void) const

where T is the class and U is the type of the return value.

The set method should have one of these signatures:

typedef void (T::*setter)(U)
typedef bool (T::*setter)(U)

where T is the class and U is the type of the value to set the attribute to, which should be compatible with the specific AttributeValue type V which holds the value (or the type implied by the name Make<V>Accessor of this function.) In the case of a setter returning bool, the return value should be true if the value could be set successfully.

In practice the setter and getter arguments can appear in either order, but setter first is preferred.

Template Parameters
V[explicit] (If present) The specific AttributeValue type to use to represent the Attribute. (If not present, the type V is implicit in the name of this function as "Make<V>Accessor"
T1[deduced] The type of the class data member, or the type of the class get functor or set method.
T2[deduced] The type of the getter class functor method.
Parameters
[in]a2The address of the class method to set the attribute.
[in]a1The address of the data member, or the get or set method.
Returns
The AttributeAccessor
See also
AttributeAccessor

Definition at line 247 of file vector.h.

◆ MakeVectorChecker()

Ptr< const AttributeChecker > MakeVectorChecker ( void  )
related
Returns
The AttributeChecker.
See also
AttributeChecker

Definition at line 41 of file vector.cc.

◆ operator+

Vector3D operator+ ( const Vector3D a,
const Vector3D b 
)
friend

Addition operator.

Parameters
[in]alhs vector.
[in]brhs vector.
Returns
The vector sum of a and b.

Definition at line 126 of file vector.cc.

◆ operator-

Vector3D operator- ( const Vector3D a,
const Vector3D b 
)
friend

Subtraction operator.

Parameters
[in]alhs vector.
[in]brhs vector.
Returns
The vector differend of a less b.

Definition at line 131 of file vector.cc.

◆ operator<

bool operator< ( const Vector3D a,
const Vector3D b 
)
friend

Less than comparison operator.

Parameters
[in]alhs vector
[in]brhs vector
Returns
true if a is less than b

Definition at line 120 of file vector.cc.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Vector3D vector 
)
friend

Output streamer.

Vectors are written as "x:y:z".

Parameters
[in,out]osThe stream.
[in]vectorThe vector to stream
Returns
The stream.

Definition at line 104 of file vector.cc.

◆ operator>>

std::istream& operator>> ( std::istream &  is,
Vector3D vector 
)
friend

Input streamer.

Vectors are expected to be in the form "x:y:z".

Parameters
[in,out]isThe stream.
[in]vectorThe vector.
Returns
The stream.

Definition at line 109 of file vector.cc.

◆ Vector

typedef Vector3D Vector
related

Vector alias typedef for compatibility with mobility models

Definition at line 217 of file vector.h.

◆ VectorChecker

typedef Vector3DChecker VectorChecker
related

Vector alias typedef for compatibility with mobility models

Definition at line 229 of file vector.h.

◆ VectorValue

typedef Vector3DValue VectorValue
related

Vector alias typedef for compatibility with mobility models

Definition at line 223 of file vector.h.

Member Data Documentation

◆ x

double ns3::Vector3D::x

◆ y

double ns3::Vector3D::y

◆ z

double ns3::Vector3D::z

z coordinate of vector

Definition at line 61 of file vector.h.

Referenced by GetLength(), ns3::operator+(), ns3::operator-(), ns3::operator<(), ns3::operator<<(), ns3::operator>>(), and showPosition().


The documentation for this class was generated from the following files: