GraphLibrary  0.0.1
A simple library that implements various graph algorithms.
 All Classes Namespaces Files Functions Variables Typedefs Macros
gl::Distance< SCALAR > Class Template Reference

Implements a numerical distance that supports "infinite distance". More...

#include <Distance.hpp>

Public Member Functions

 Distance ()
 Default constructor. More...
 
 Distance (const SCALAR distance)
 Constructor with finite distance. More...
 
 Distance (const Distance &)=default
 Copy constructor. More...
 
 Distance (Distance &&) noexcept=default
 Move constructor. More...
 
Distanceoperator= (const Distance &)=default
 Copy assignment. More...
 
Distanceoperator= (Distance &&) noexcept=default
 Move assignment. More...
 
 ~Distance ()=default
 Destructor. More...
 
bool operator== (const Distance &rhs)
 'equality' operator More...
 
bool operator!= (const Distance &rhs)
 'inequality' operator More...
 
bool operator< (const Distance &rhs)
 'less than' operator More...
 
bool operator> (const Distance &rhs)
 'greater than' operator More...
 
Distance operator+ (const Distance &rhs)
 'addition' operator More...
 
std::string getDistance () const
 Gets the distance. More...
 
SCALAR scalarDistance () const
 Gets the numerical value of the distance. If the distance is infinite, returns the maximum value of the Distance type. More...
 
void setDistance (SCALAR distance)
 Allows updating the distance. More...
 
bool isInfinite () const
 Checks whether the distance is infinite. More...
 
void setInfinite () const
 Sets the distance to infinity. More...
 
bool isZero () const
 Checks whether the distance is zero. More...
 

Private Attributes

bool isInfinite_
 
SCALAR distance_
 

Detailed Description

template<class SCALAR>
class gl::Distance< SCALAR >

Implements a numerical distance that supports "infinite distance".

Constructor & Destructor Documentation

template<class SCALAR>
gl::Distance< SCALAR >::Distance ( )
inline

Default constructor.

template<class SCALAR>
gl::Distance< SCALAR >::Distance ( const SCALAR  distance)
inline

Constructor with finite distance.

template<class SCALAR>
gl::Distance< SCALAR >::Distance ( const Distance< SCALAR > &  )
default

Copy constructor.

template<class SCALAR>
gl::Distance< SCALAR >::Distance ( Distance< SCALAR > &&  )
defaultnoexcept

Move constructor.

template<class SCALAR>
gl::Distance< SCALAR >::~Distance ( )
default

Destructor.

Member Function Documentation

template<class SCALAR>
Distance& gl::Distance< SCALAR >::operator= ( const Distance< SCALAR > &  )
default

Copy assignment.

template<class SCALAR>
Distance& gl::Distance< SCALAR >::operator= ( Distance< SCALAR > &&  )
defaultnoexcept

Move assignment.

template<class SCALAR>
bool gl::Distance< SCALAR >::operator== ( const Distance< SCALAR > &  rhs)
inline

'equality' operator

Parameters
[in]rhsDistance that will get compared
Returns
true if lhs is equal to rhs, false otherwise
template<class SCALAR>
bool gl::Distance< SCALAR >::operator!= ( const Distance< SCALAR > &  rhs)
inline

'inequality' operator

Parameters
[in]rhsDistance that will get compared
Returns
true if lhs is not equal to rhs, false otherwise
template<class SCALAR>
bool gl::Distance< SCALAR >::operator< ( const Distance< SCALAR > &  rhs)
inline

'less than' operator

Parameters
[in]rhsDistance that will get compared
Returns
true if lhs is less than rhs, false otherwise
template<class SCALAR>
bool gl::Distance< SCALAR >::operator> ( const Distance< SCALAR > &  rhs)
inline

'greater than' operator

Parameters
[in]rhsDistance that will get compared
Returns
true if lhs is greater than rhs, false otherwise
template<class SCALAR>
Distance gl::Distance< SCALAR >::operator+ ( const Distance< SCALAR > &  rhs)
inline

'addition' operator

Parameters
[in]rhsDistance that will get added to 'this'
Returns
Distance with the combined distances.
template<class SCALAR>
std::string gl::Distance< SCALAR >::getDistance ( ) const
inline

Gets the distance.

Returns
String of numerical distance, or 'Inf' if the distance is infinite.
template<class SCALAR>
SCALAR gl::Distance< SCALAR >::scalarDistance ( ) const
inline

Gets the numerical value of the distance. If the distance is infinite, returns the maximum value of the Distance type.

Returns
Scalar type of numerical distance
template<class SCALAR>
void gl::Distance< SCALAR >::setDistance ( SCALAR  distance)
inline

Allows updating the distance.

Parameters
[in]distanceNew distance.
template<class SCALAR>
bool gl::Distance< SCALAR >::isInfinite ( ) const
inline

Checks whether the distance is infinite.

Returns
true if the distance is infinite, false otherwise
template<class SCALAR>
void gl::Distance< SCALAR >::setInfinite ( ) const
inline

Sets the distance to infinity.

template<class SCALAR>
bool gl::Distance< SCALAR >::isZero ( ) const
inline

Checks whether the distance is zero.

Returns
true if the distance is zero, false otherwise

Member Data Documentation

template<class SCALAR>
bool gl::Distance< SCALAR >::isInfinite_
private
template<class SCALAR>
SCALAR gl::Distance< SCALAR >::distance_
private

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