Distance Class Reference

CPP API: mio::geo::Distance Class Reference
mio::geo::Distance Class Reference

Represents a distance. More...

#include <distance.h>

Public Member Functions

auto default_serialize ()
 This method is used by the default serialization feature. More...
 
 Distance ()=default
 Default ctor, unitinialized. More...
 
constexpr Distance (ScalarType meters)
 Creates a Distance from a specified distance in meters. More...
 
ScalarType kilometers () const
 return distance in kilometers. More...
 
ScalarType meters () const
 return distance in meters. More...
 
Comparison operators.
bool operator== (const Distance &other) const
 
bool operator!= (const Distance &other) const
 
bool operator< (const Distance &other) const
 
bool operator<= (const Distance &other) const
 
bool operator> (const Distance &other) const
 
bool operator>= (const Distance &other) const
 
Distance operator+ (const Distance &m) const
 Add or subtract a Distance. More...
 
Distanceoperator+= (const Distance &m)
 Add or subtract a Distance. More...
 
Distance operator- (const Distance &m) const
 Add or subtract a Distance. More...
 
Distanceoperator-= (const Distance &m)
 Add or subtract a Distance. More...
 

Private Attributes

ScalarType m_meters
 The distance in meters. More...
 

Detailed Description

Represents a distance.

Internally, all distances are stored in meters.

Constructor & Destructor Documentation

◆ Distance() [1/2]

mio::geo::Distance::Distance ( )
default

Default ctor, unitinialized.

◆ Distance() [2/2]

constexpr mio::geo::Distance::Distance ( ScalarType  meters)
inlineexplicitconstexpr

Creates a Distance from a specified distance in meters.

Parameters
[in]metersThe distance in meters.

Member Function Documentation

◆ default_serialize()

auto mio::geo::Distance::default_serialize ( )
inline

This method is used by the default serialization feature.

◆ kilometers()

ScalarType mio::geo::Distance::kilometers ( ) const
inline

return distance in kilometers.

◆ meters()

ScalarType mio::geo::Distance::meters ( ) const
inline

return distance in meters.

◆ operator!=()

bool mio::geo::Distance::operator!= ( const Distance other) const
inline

◆ operator+()

Distance mio::geo::Distance::operator+ ( const Distance m) const
inline

Add or subtract a Distance.

◆ operator+=()

Distance& mio::geo::Distance::operator+= ( const Distance m)
inline

Add or subtract a Distance.

◆ operator-()

Distance mio::geo::Distance::operator- ( const Distance m) const
inline

Add or subtract a Distance.

◆ operator-=()

Distance& mio::geo::Distance::operator-= ( const Distance m)
inline

Add or subtract a Distance.

◆ operator<()

bool mio::geo::Distance::operator< ( const Distance other) const
inline

◆ operator<=()

bool mio::geo::Distance::operator<= ( const Distance other) const
inline

◆ operator==()

bool mio::geo::Distance::operator== ( const Distance other) const
inline

◆ operator>()

bool mio::geo::Distance::operator> ( const Distance other) const
inline

◆ operator>=()

bool mio::geo::Distance::operator>= ( const Distance other) const
inline

Member Data Documentation

◆ m_meters

ScalarType mio::geo::Distance::m_meters
private

The distance in meters.