SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::dimensions::QuantityValue< Quantity > Class Template Referencefinal

This is the non derivative equivalent to PartialDerivative. This associates a dimension with a value and, if that value can be determined at compile time, can be decomposed to a transparent double through .value() More...

#include <quantities.hpp>

Public Member Functions

constexpr QuantityValue (const double value) noexcept
 
constexpr double value () const noexcept
 

Private Attributes

double m_value
 Numeric value associated with the dimension of QuantityValue.
 

Friends

constexpr bool operator== (const QuantityValue &, const QuantityValue &) noexcept=default
 
constexpr QuantityValue operator+ (const QuantityValue &lhs, const QuantityValue &rhs) noexcept
 
constexpr QuantityValue operator- (const QuantityValue &lhs, const QuantityValue &rhs) noexcept
 
template<IsNumeric Scalar>
constexpr QuantityValue operator* (const QuantityValue &lhs, const Scalar rhs) noexcept
 
template<IsNumeric Scalar>
constexpr QuantityValue operator* (const Scalar lhs, const QuantityValue &rhs) noexcept
 
template<IsNumeric Scalar>
constexpr QuantityValue operator/ (const QuantityValue &lhs, const Scalar rhs) noexcept
 
template<IsNumeric Scalar>
constexpr std::partial_ordering operator<=> (const QuantityValue &lhs, const Scalar rhs) noexcept
 
template<IsNumeric Scalar>
constexpr std::partial_ordering operator<=> (const Scalar lhs, const QuantityValue &rhs) noexcept
 
constexpr std::partial_ordering operator<=> (const QuantityValue &lhs, const QuantityValue &rhs) noexcept
 

Detailed Description

template<PhysicalQuantityType Quantity>
class serif::dimensions::QuantityValue< Quantity >

This is the non derivative equivalent to PartialDerivative. This associates a dimension with a value and, if that value can be determined at compile time, can be decomposed to a transparent double through .value()

Template Parameters
QuantitySome valid PhysicalQuantityType. Note all the dimensions in dimensions.hpp are of type PhysicalQuantity. There should be no other dimensions in the code.

Constructor & Destructor Documentation

◆ QuantityValue()

template<PhysicalQuantityType Quantity>
serif::dimensions::QuantityValue< Quantity >::QuantityValue ( const double value)
inlineexplicitconstexprnoexcept

Member Function Documentation

◆ value()

template<PhysicalQuantityType Quantity>
double serif::dimensions::QuantityValue< Quantity >::value ( ) const
inlinenodiscardconstexprnoexcept

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<PhysicalQuantityType Quantity>
template<IsNumeric Scalar>
QuantityValue operator* ( const QuantityValue< Quantity > & lhs,
const Scalar rhs )
friend

@breif Overload of the * operator for a left quantity and some right numeric, scalar, value.

Template Parameters
ScalarA value satisfying IsNumeric
Parameters
lhssome quantity value
rhssome scalar value
Returns
some quantity value with the same type as lhs but with value = lhs.m_value * scalar

◆ operator* [2/2]

template<PhysicalQuantityType Quantity>
template<IsNumeric Scalar>
QuantityValue operator* ( const Scalar lhs,
const QuantityValue< Quantity > & rhs )
friend

@breif Overload of the * operator for a right quantity and some left numeric, scalar, value.

Template Parameters
ScalarA value satisfying IsNumeric
Parameters
lhssome scalar value
rhssome quantity value
Returns
some quantity value with the same type as lhs but with value = scalar * lhs.m_value

◆ operator+

template<PhysicalQuantityType Quantity>
QuantityValue operator+ ( const QuantityValue< Quantity > & lhs,
const QuantityValue< Quantity > & rhs )
friend

@breif overload of + operator for two quantities with the same PhysicalQuantityType

Parameters
lhsOne Quantity
rhsOther Quantity
Returns
a new quantity with the same PhysicalQuantityType but with a value = lhs.m_value + rhs.m_value

◆ operator-

template<PhysicalQuantityType Quantity>
QuantityValue operator- ( const QuantityValue< Quantity > & lhs,
const QuantityValue< Quantity > & rhs )
friend

@breif overload of - operator for two quantities with the same PhysicalQuantityType

Parameters
lhsOne Quantity
rhsOther Quantity
Returns
a new quantity with the same PhysicalQuantityType but with a value = lhs.m_value - rhs.m_value

◆ operator/

template<PhysicalQuantityType Quantity>
template<IsNumeric Scalar>
QuantityValue operator/ ( const QuantityValue< Quantity > & lhs,
const Scalar rhs )
friend

@breif Overload of the / operator for a left quantity and some right numeric, scalar, value.

Template Parameters
ScalarA value satisfying IsNumeric
Parameters
lhssome quantity value
rhssome scalar value
Returns
some quantity value with the same type as lhs but with value = lhs.m_value / scalar

◆ operator<=> [1/3]

template<PhysicalQuantityType Quantity>
std::partial_ordering operator<=> ( const QuantityValue< Quantity > & lhs,
const QuantityValue< Quantity > & rhs )
friend

@breif partial ordering overload to compare two quantity values of the same type

Parameters
lhsSome quantity value
rhsOther quantity value
Returns
the partial ordering of lhs.m_value <=> rhs.m_value

◆ operator<=> [2/3]

template<PhysicalQuantityType Quantity>
template<IsNumeric Scalar>
std::partial_ordering operator<=> ( const QuantityValue< Quantity > & lhs,
const Scalar rhs )
friend

@breif Partial ordering overload for some left quantity and right scalar

Template Parameters
ScalarA value satisfying IsNumeric
Parameters
lhssome quantity value
rhssome scalar value
Returns
The partial ordering comparing lhs.m_value to scalar

◆ operator<=> [3/3]

template<PhysicalQuantityType Quantity>
template<IsNumeric Scalar>
std::partial_ordering operator<=> ( const Scalar lhs,
const QuantityValue< Quantity > & rhs )
friend

@breif Partial ordering overload for some right quantity and left scalar

Template Parameters
ScalarA value satisfying IsNumeric
Parameters
lhssome scalar value
rhssome quantity value
Returns
The partial ordering comparing scalar to lhs.m_value

◆ operator==

template<PhysicalQuantityType Quantity>
bool operator== ( const QuantityValue< Quantity > & ,
const QuantityValue< Quantity > &  )
friend

@breif Default comparison operator for two QuantityValues. Note that there is an implicit requirement these be of the same specialization. E.g. each have the same PhysicalQuantityType Quantity type parameter. Because this is the default and this class has only one trivially comparable member this just checks if m_value == m_value.

Returns
true if the values in both are equal.

Member Data Documentation

◆ m_value

template<PhysicalQuantityType Quantity>
double serif::dimensions::QuantityValue< Quantity >::m_value
private

Numeric value associated with the dimension of QuantityValue.


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