A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
anonymous_namespace{length.cc} Namespace Reference

Unnamed namespace. More...

Classes

class  EnumHash
 Functor for hashing Length::Unit values. More...
 

Functions

double Convert (const ns3::Length::Quantity &from, ns3::Length::Unit toUnit)
 Convert a Length::Quantity to the equivalent value in another unit.
 
double Convert (double value, ns3::Length::Unit fromUnit, ns3::Length::Unit toUnit)
 Convert a value in one unit to the equivalent value in another unit.
 
double FootToMeter (double value)
 Convert a value in feet to the equivalent value in meters.
 
double MeterToFoot (double value)
 Convert a value in meters to the equivalent value in feet.
 
template<class R >
double MeterToUS (double value)
 Convert a value from meters to a US Customary unit (inches, feet, yards etc.)
 
template<class R >
double ScaleValue (double value)
 Helper function to scale an input value by a given ratio.
 
template<class R >
double USToMeter (double value)
 Convert a value from a US Customary unit (inches, feet, yards etc.) to meters.
 

Detailed Description

Unnamed namespace.

Function Documentation

◆ Convert() [1/2]

double anonymous_namespace{length.cc}::Convert ( const ns3::Length::Quantity & from,
ns3::Length::Unit toUnit )

Convert a Length::Quantity to the equivalent value in another unit.

Parameters
fromQuantity with the current value and unit
toUnitTarget unit
Returns
Result of converting the quantity value to the requested units

Definition at line 195 of file length.cc.

References Convert(), ns3::Length::Quantity::Unit(), and ns3::Length::Quantity::Value().

+ Here is the call graph for this function:

◆ Convert() [2/2]

double anonymous_namespace{length.cc}::Convert ( double value,
ns3::Length::Unit fromUnit,
ns3::Length::Unit toUnit )

Convert a value in one unit to the equivalent value in another unit.

Parameters
valueLength value in fromUnit units
fromUnitUnit of value
toUnitTarget unit
Returns
Result of converting value from fromUnit to toUnit

Helper to generate hash values from pairs of Length::Units

Definition at line 127 of file length.cc.

References FootToMeter(), MeterToFoot(), MeterToUS(), NS_FATAL_ERROR, ScaleValue(), and USToMeter().

Referenced by Convert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FootToMeter()

double anonymous_namespace{length.cc}::FootToMeter ( double value)

Convert a value in feet to the equivalent value in meters.

Parameters
valueInput value in feet
Returns
Equivalent value in meters

Definition at line 63 of file length.cc.

Referenced by Convert(), and USToMeter().

+ Here is the caller graph for this function:

◆ MeterToFoot()

double anonymous_namespace{length.cc}::MeterToFoot ( double value)

Convert a value in meters to the equivalent value in feet.

Parameters
valueInput value in meters
Returns
Equivalent value in feet

Definition at line 76 of file length.cc.

Referenced by Convert(), and MeterToUS().

+ Here is the caller graph for this function:

◆ MeterToUS()

template<class R >
double anonymous_namespace{length.cc}::MeterToUS ( double value)

Convert a value from meters to a US Customary unit (inches, feet, yards etc.)

Value is converted to feet then scaled to the desired US Customary unit

Template Parameters
Rstd::ratio needed to convert feet to desired US customary unit
Parameters
valueInput value in meters
Returns
Equivalent value in a US customary unit

Definition at line 112 of file length.cc.

References MeterToFoot(), and ScaleValue().

Referenced by Convert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScaleValue()

template<class R >
double anonymous_namespace{length.cc}::ScaleValue ( double value)

Helper function to scale an input value by a given ratio.

Template Parameters
Ra std::ratio
Parameters
valueInput value to scale by R
Returns
The result of value * R::num / R::den

Definition at line 50 of file length.cc.

Referenced by Convert(), MeterToUS(), and USToMeter().

+ Here is the caller graph for this function:

◆ USToMeter()

template<class R >
double anonymous_namespace{length.cc}::USToMeter ( double value)

Convert a value from a US Customary unit (inches, feet, yards etc.) to meters.

Value is scaled to feet then converted to meters

Template Parameters
Rstd::ratio needed to convert value to feet
Parameters
valueInput value in some US Customary unit
Returns
Equivalent value in meters

Definition at line 94 of file length.cc.

References FootToMeter(), and ScaleValue().

Referenced by Convert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: