Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
PhQ::TransportEnergyConsumption< NumericType > Class Template Reference

Transport energy consumption, also known as energy consumption in transport. A measure of energy use per distance traveled. Energy consumption in transport is often measured in joules per metre (J/m), kilowatt-hours per kilometre (kW·hr/km), or kilowatt-hours per mile (kW·hr/mi). More...

#include "TransportEnergyConsumption.hpp"

Public Member Functions

 TransportEnergyConsumption ()=default
 Default constructor. Constructs a transport energy consumption with an uninitialized value. More...
 
 TransportEnergyConsumption (const NumericType value, const Unit::TransportEnergyConsumption unit)
 Constructor. Constructs a transport energy consumption with a given value expressed in a given transport energy consumption unit. More...
 
constexpr TransportEnergyConsumption (const Energy< NumericType > &energy, const Length< NumericType > &length)
 Constructor. Constructs a transport energy consumption from a given energy and length using the definition of transport energy consumption. More...
 
 ~TransportEnergyConsumption () noexcept=default
 Destructor. Destroys this transport energy consumption. More...
 
constexpr TransportEnergyConsumption (const TransportEnergyConsumption< NumericType > &other)=default
 Copy constructor. Constructs a transport energy consumption by copying another one. More...
 
template<typename OtherNumericType >
constexpr TransportEnergyConsumption (const TransportEnergyConsumption< OtherNumericType > &other)
 Copy constructor. Constructs a transport energy consumption by copying another one. More...
 
constexpr TransportEnergyConsumption (TransportEnergyConsumption< NumericType > &&other) noexcept=default
 Move constructor. Constructs a transport energy consumption by moving another one. More...
 
constexpr TransportEnergyConsumption< NumericType > & operator= (const TransportEnergyConsumption< NumericType > &other)=default
 Copy assignment operator. Assigns this transport energy consumption by copying another one. More...
 
template<typename OtherNumericType >
constexpr TransportEnergyConsumption< NumericType > & operator= (const TransportEnergyConsumption< OtherNumericType > &other)
 Copy assignment operator. Assigns this transport energy consumption by copying another one. More...
 
constexpr TransportEnergyConsumption< NumericType > & operator= (TransportEnergyConsumption< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this transport energy consumption by moving another one. More...
 
constexpr TransportEnergyConsumption< NumericType > operator+ (const TransportEnergyConsumption< NumericType > &transport_energy_consumption) const
 
constexpr TransportEnergyConsumption< NumericType > operator- (const TransportEnergyConsumption< NumericType > &transport_energy_consumption) const
 
constexpr TransportEnergyConsumption< NumericType > operator* (const NumericType number) const
 
constexpr Energy< NumericType > operator* (const Length< NumericType > length) const
 
constexpr Power< NumericType > operator* (const Speed< NumericType > speed) const
 
constexpr TransportEnergyConsumption< NumericType > operator/ (const NumericType number) const
 
constexpr NumericType operator/ (const TransportEnergyConsumption< NumericType > &transport_energy_consumption) const noexcept
 
constexpr void operator+= (const TransportEnergyConsumption< NumericType > &transport_energy_consumption) noexcept
 
constexpr void operator-= (const TransportEnergyConsumption< NumericType > &transport_energy_consumption) noexcept
 
constexpr void operator*= (const NumericType number) noexcept
 
constexpr void operator/= (const NumericType number) noexcept
 
constexpr double Value () const noexcept
 Value of this physical quantity expressed in its standard unit of measure. More...
 
double Value (const Unit::TransportEnergyConsumption unit) const
 Value of this physical quantity expressed in a given unit of measure. More...
 
constexpr double StaticValue () const
 Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time. More...
 
constexpr double & MutableValue () noexcept
 Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value. More...
 
constexpr void SetValue (const double value) noexcept
 Sets the value of this physical quantity expressed in its standard unit of measure to the given value. More...
 
std::string Print () const
 Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string Print (const Unit::TransportEnergyConsumption unit) const
 Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string JSON () const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string JSON (const Unit::TransportEnergyConsumption unit) const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string XML () const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string XML (const Unit::TransportEnergyConsumption unit) const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string YAML () const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string YAML (const Unit::TransportEnergyConsumption unit) const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure. More...
 

Static Public Member Functions

static constexpr TransportEnergyConsumption< NumericType > Zero ()
 Statically creates a transport energy consumption of zero. More...
 
template<Unit::TransportEnergyConsumption Unit>
static constexpr TransportEnergyConsumption< NumericType > Create (const NumericType value)
 Statically creates a transport energy consumption with a given value expressed in a given transport energy consumption unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::TransportEnergyConsumption Unit ()
 Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure. More...
 

Protected Attributes

double value
 Value of this physical quantity expressed in its standard unit of measure. More...
 

Private Member Functions

constexpr TransportEnergyConsumption (const NumericType value)
 Constructor. Constructs a transport energy consumption with a given value expressed in the standard transport energy consumption unit. More...
 

Detailed Description

template<typename NumericType = double>
class PhQ::TransportEnergyConsumption< NumericType >

Transport energy consumption, also known as energy consumption in transport. A measure of energy use per distance traveled. Energy consumption in transport is often measured in joules per metre (J/m), kilowatt-hours per kilometre (kW·hr/km), or kilowatt-hours per mile (kW·hr/mi).

Definition at line 44 of file TransportEnergyConsumption.hpp.

Constructor & Destructor Documentation

◆ TransportEnergyConsumption() [1/7]

template<typename NumericType = double>
PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( )
default

Default constructor. Constructs a transport energy consumption with an uninitialized value.

◆ TransportEnergyConsumption() [2/7]

template<typename NumericType = double>
PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( const NumericType  value,
const Unit::TransportEnergyConsumption< NumericType >  unit 
)
inline

Constructor. Constructs a transport energy consumption with a given value expressed in a given transport energy consumption unit.

Definition at line 53 of file TransportEnergyConsumption.hpp.

◆ TransportEnergyConsumption() [3/7]

template<typename NumericType = double>
constexpr PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( const Energy< NumericType > &  energy,
const Length< NumericType > &  length 
)
inlineconstexpr

Constructor. Constructs a transport energy consumption from a given energy and length using the definition of transport energy consumption.

Definition at line 58 of file TransportEnergyConsumption.hpp.

◆ ~TransportEnergyConsumption()

template<typename NumericType = double>
PhQ::TransportEnergyConsumption< NumericType >::~TransportEnergyConsumption ( )
defaultnoexcept

Destructor. Destroys this transport energy consumption.

◆ TransportEnergyConsumption() [4/7]

template<typename NumericType = double>
constexpr PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( const TransportEnergyConsumption< NumericType > &  other)
constexprdefault

Copy constructor. Constructs a transport energy consumption by copying another one.

◆ TransportEnergyConsumption() [5/7]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( const TransportEnergyConsumption< OtherNumericType > &  other)
inlineexplicitconstexpr

Copy constructor. Constructs a transport energy consumption by copying another one.

Definition at line 71 of file TransportEnergyConsumption.hpp.

◆ TransportEnergyConsumption() [6/7]

template<typename NumericType = double>
constexpr PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( TransportEnergyConsumption< NumericType > &&  other)
constexprdefaultnoexcept

Move constructor. Constructs a transport energy consumption by moving another one.

◆ TransportEnergyConsumption() [7/7]

template<typename NumericType = double>
constexpr PhQ::TransportEnergyConsumption< NumericType >::TransportEnergyConsumption ( const NumericType  value)
inlineexplicitconstexprprivate

Constructor. Constructs a transport energy consumption with a given value expressed in the standard transport energy consumption unit.

Definition at line 167 of file TransportEnergyConsumption.hpp.

Member Function Documentation

◆ Create()

template<typename NumericType = double>
template<Unit::TransportEnergyConsumption Unit>
static constexpr TransportEnergyConsumption<NumericType> PhQ::TransportEnergyConsumption< NumericType >::Create ( const NumericType  value)
inlinestaticconstexpr

Statically creates a transport energy consumption with a given value expressed in a given transport energy consumption unit.

Definition at line 106 of file TransportEnergyConsumption.hpp.

References PhQ::ConvertStatically(), PhQ::DimensionalScalar< Unit::TransportEnergyConsumption, double >::Unit(), and PhQ::DimensionalScalar< Unit::TransportEnergyConsumption, double >::value.

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::Dimensions ( )
inlinestaticconstexprinherited

Physical dimension set of this physical quantity.

Definition at line 54 of file DimensionalScalar.hpp.

◆ JSON() [1/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::JSON ( ) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 107 of file DimensionalScalar.hpp.

◆ JSON() [2/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::JSON ( const Unit::TransportEnergyConsumption  unit) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 117 of file DimensionalScalar.hpp.

◆ MutableValue()

constexpr double & PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::MutableValue ( )
inlineconstexprnoexceptinherited

Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value.

Definition at line 83 of file DimensionalScalar.hpp.

◆ operator*() [1/3]

template<typename NumericType = double>
constexpr Energy<NumericType> PhQ::TransportEnergyConsumption< NumericType >::operator* ( const Length< NumericType >  length) const
inlineconstexpr

Definition at line 129 of file TransportEnergyConsumption.hpp.

◆ operator*() [2/3]

template<typename NumericType = double>
constexpr TransportEnergyConsumption<NumericType> PhQ::TransportEnergyConsumption< NumericType >::operator* ( const NumericType  number) const
inlineconstexpr

◆ operator*() [3/3]

template<typename NumericType = double>
constexpr Power<NumericType> PhQ::TransportEnergyConsumption< NumericType >::operator* ( const Speed< NumericType >  speed) const
inlineconstexpr

Definition at line 133 of file TransportEnergyConsumption.hpp.

◆ operator*=()

template<typename NumericType = double>
constexpr void PhQ::TransportEnergyConsumption< NumericType >::operator*= ( const NumericType  number)
inlineconstexprnoexcept

◆ operator+()

template<typename NumericType = double>
constexpr TransportEnergyConsumption<NumericType> PhQ::TransportEnergyConsumption< NumericType >::operator+ ( const TransportEnergyConsumption< NumericType > &  transport_energy_consumption) const
inlineconstexpr

◆ operator+=()

template<typename NumericType = double>
constexpr void PhQ::TransportEnergyConsumption< NumericType >::operator+= ( const TransportEnergyConsumption< NumericType > &  transport_energy_consumption)
inlineconstexprnoexcept

◆ operator-()

template<typename NumericType = double>
constexpr TransportEnergyConsumption<NumericType> PhQ::TransportEnergyConsumption< NumericType >::operator- ( const TransportEnergyConsumption< NumericType > &  transport_energy_consumption) const
inlineconstexpr

◆ operator-=()

template<typename NumericType = double>
constexpr void PhQ::TransportEnergyConsumption< NumericType >::operator-= ( const TransportEnergyConsumption< NumericType > &  transport_energy_consumption)
inlineconstexprnoexcept

◆ operator/() [1/2]

template<typename NumericType = double>
constexpr TransportEnergyConsumption<NumericType> PhQ::TransportEnergyConsumption< NumericType >::operator/ ( const NumericType  number) const
inlineconstexpr

◆ operator/() [2/2]

template<typename NumericType = double>
constexpr NumericType PhQ::TransportEnergyConsumption< NumericType >::operator/ ( const TransportEnergyConsumption< NumericType > &  transport_energy_consumption) const
inlineconstexprnoexcept

◆ operator/=()

template<typename NumericType = double>
constexpr void PhQ::TransportEnergyConsumption< NumericType >::operator/= ( const NumericType  number)
inlineconstexprnoexcept

◆ operator=() [1/3]

template<typename NumericType = double>
constexpr TransportEnergyConsumption<NumericType>& PhQ::TransportEnergyConsumption< NumericType >::operator= ( const TransportEnergyConsumption< NumericType > &  other)
constexprdefault

Copy assignment operator. Assigns this transport energy consumption by copying another one.

◆ operator=() [2/3]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr TransportEnergyConsumption<NumericType>& PhQ::TransportEnergyConsumption< NumericType >::operator= ( const TransportEnergyConsumption< OtherNumericType > &  other)
inlineconstexpr

Copy assignment operator. Assigns this transport energy consumption by copying another one.

Definition at line 87 of file TransportEnergyConsumption.hpp.

References PhQ::DimensionalScalar< UnitType, NumericType >::Value(), and PhQ::DimensionalScalar< Unit::TransportEnergyConsumption, double >::value.

◆ operator=() [3/3]

template<typename NumericType = double>
constexpr TransportEnergyConsumption<NumericType>& PhQ::TransportEnergyConsumption< NumericType >::operator= ( TransportEnergyConsumption< NumericType > &&  other)
constexprdefaultnoexcept

Move assignment operator. Assigns this transport energy consumption by moving another one.

◆ Print() [1/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::Print ( ) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 95 of file DimensionalScalar.hpp.

◆ Print() [2/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::Print ( const Unit::TransportEnergyConsumption  unit) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure.

Definition at line 101 of file DimensionalScalar.hpp.

◆ SetValue()

constexpr void PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::SetValue ( const double  value)
inlineconstexprnoexceptinherited

Sets the value of this physical quantity expressed in its standard unit of measure to the given value.

Definition at line 89 of file DimensionalScalar.hpp.

◆ StaticValue()

constexpr double PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::StaticValue ( ) const
inlineconstexprinherited

Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time.

Definition at line 77 of file DimensionalScalar.hpp.

◆ Unit()

static constexpr Unit::TransportEnergyConsumption PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::Unit ( )
inlinestaticconstexprinherited

Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure.

Definition at line 60 of file DimensionalScalar.hpp.

◆ Value() [1/2]

constexpr double PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::Value ( ) const
inlineconstexprnoexceptinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 65 of file DimensionalScalar.hpp.

◆ Value() [2/2]

double PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::Value ( const Unit::TransportEnergyConsumption  unit) const
inlineinherited

Value of this physical quantity expressed in a given unit of measure.

Definition at line 70 of file DimensionalScalar.hpp.

◆ XML() [1/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::XML ( ) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 127 of file DimensionalScalar.hpp.

◆ XML() [2/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::XML ( const Unit::TransportEnergyConsumption  unit) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 137 of file DimensionalScalar.hpp.

◆ YAML() [1/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::YAML ( ) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 147 of file DimensionalScalar.hpp.

◆ YAML() [2/2]

std::string PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::YAML ( const Unit::TransportEnergyConsumption  unit) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 157 of file DimensionalScalar.hpp.

◆ Zero()

template<typename NumericType = double>
static constexpr TransportEnergyConsumption<NumericType> PhQ::TransportEnergyConsumption< NumericType >::Zero ( )
inlinestaticconstexpr

Statically creates a transport energy consumption of zero.

Definition at line 99 of file TransportEnergyConsumption.hpp.

Member Data Documentation

◆ value

double PhQ::DimensionalScalar< Unit::TransportEnergyConsumption , double >::value
protectedinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 221 of file DimensionalScalar.hpp.


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