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 Member Functions | Protected Attributes | List of all members
PhQ::DimensionlessScalar< NumericType > Class Template Reference

Abstract base class that represents any dimensionless scalar physical quantity. Such a physical quantity is composed only of a value where the value is a scalar number. Such a physical quantity has no unit of measure and no dimension set. More...

#include "DimensionlessScalar.hpp"

Public Member Functions

constexpr NumericType Value () const noexcept
 Value of this physical quantity. More...
 
constexpr NumericType & MutableValue () noexcept
 Returns the value of this physical quantity as a mutable value. More...
 
constexpr void SetValue (const NumericType value) noexcept
 Sets the value of this physical quantity to the given value. More...
 
std::string Print () const
 Prints this physical quantity as a string. More...
 
std::string JSON () const
 Serializes this physical quantity as a JSON message. More...
 
std::string XML () const
 Serializes this physical quantity as an XML message. More...
 
std::string YAML () const
 Serializes this physical quantity as a YAML message. More...
 

Static Public Member Functions

static constexpr PhQ::Dimensions Dimensions ()
 Physical dimension set of this physical quantity. Since this physical quantity is dimensionless, its physical dimension set is simply the null set. More...
 

Protected Member Functions

 DimensionlessScalar ()=default
 Default constructor. Constructs a dimensionless scalar physical quantity with an uninitialized value. More...
 
constexpr DimensionlessScalar (const NumericType value)
 Constructor. Constructs a dimensionless scalar physical quantity with a given value. More...
 
 ~DimensionlessScalar () noexcept=default
 Destructor. Destroys this dimensionless scalar physical quantity. More...
 
constexpr DimensionlessScalar (const DimensionlessScalar< NumericType > &other)=default
 Copy constructor. Constructs a dimensionless scalar physical quantity by copying another one. More...
 
template<typename OtherNumericType >
constexpr DimensionlessScalar (const DimensionlessScalar< OtherNumericType > &other)
 Copy constructor. Constructs a dimensionless scalar physical quantity by copying another one. More...
 
constexpr DimensionlessScalar (DimensionlessScalar< NumericType > &&other) noexcept=default
 Move constructor. Constructs a dimensionless scalar physical quantity by moving another one. More...
 
constexpr DimensionlessScalar< NumericType > & operator= (const DimensionlessScalar< NumericType > &other)=default
 Copy assignment operator. Assigns this dimensionless scalar physical quantity by copying another one. More...
 
template<typename OtherNumericType >
constexpr DimensionlessScalar< NumericType > & operator= (const DimensionlessScalar< OtherNumericType > &other)
 Copy assignment operator. Assigns this dimensionless scalar physical quantity by copying another one. More...
 
constexpr DimensionlessScalar< NumericType > & operator= (DimensionlessScalar< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this dimensionless scalar physical quantity by moving another one. More...
 

Protected Attributes

NumericType value
 Value of this physical quantity. More...
 

Detailed Description

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

Abstract base class that represents any dimensionless scalar physical quantity. Such a physical quantity is composed only of a value where the value is a scalar number. Such a physical quantity has no unit of measure and no dimension set.

Template Parameters
NumericTypeFloating-point numeric type: float, double, or long double. Defaults to double if unspecified.

Definition at line 47 of file DimensionlessScalar.hpp.

Constructor & Destructor Documentation

◆ DimensionlessScalar() [1/5]

template<typename NumericType = double>
PhQ::DimensionlessScalar< NumericType >::DimensionlessScalar ( )
protecteddefault

Default constructor. Constructs a dimensionless scalar physical quantity with an uninitialized value.

◆ DimensionlessScalar() [2/5]

template<typename NumericType = double>
constexpr PhQ::DimensionlessScalar< NumericType >::DimensionlessScalar ( const NumericType  value)
inlineexplicitconstexprprotected

Constructor. Constructs a dimensionless scalar physical quantity with a given value.

Definition at line 100 of file DimensionlessScalar.hpp.

◆ ~DimensionlessScalar()

template<typename NumericType = double>
PhQ::DimensionlessScalar< NumericType >::~DimensionlessScalar ( )
protecteddefaultnoexcept

Destructor. Destroys this dimensionless scalar physical quantity.

◆ DimensionlessScalar() [3/5]

template<typename NumericType = double>
constexpr PhQ::DimensionlessScalar< NumericType >::DimensionlessScalar ( const DimensionlessScalar< NumericType > &  other)
constexprprotecteddefault

Copy constructor. Constructs a dimensionless scalar physical quantity by copying another one.

◆ DimensionlessScalar() [4/5]

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

Copy constructor. Constructs a dimensionless scalar physical quantity by copying another one.

Template Parameters
OtherNumericTypeFloating-point numeric type of the other physical quantity. Deduced automatically.

Definition at line 114 of file DimensionlessScalar.hpp.

◆ DimensionlessScalar() [5/5]

template<typename NumericType = double>
constexpr PhQ::DimensionlessScalar< NumericType >::DimensionlessScalar ( DimensionlessScalar< NumericType > &&  other)
constexprprotecteddefaultnoexcept

Move constructor. Constructs a dimensionless scalar physical quantity by moving another one.

Member Function Documentation

◆ Dimensions()

template<typename NumericType = double>
static constexpr PhQ::Dimensions PhQ::DimensionlessScalar< NumericType >::Dimensions ( )
inlinestaticconstexpr

Physical dimension set of this physical quantity. Since this physical quantity is dimensionless, its physical dimension set is simply the null set.

Definition at line 55 of file DimensionlessScalar.hpp.

References PhQ::Dimensionless.

◆ JSON()

template<typename NumericType = double>
std::string PhQ::DimensionlessScalar< NumericType >::JSON ( ) const
inline

Serializes this physical quantity as a JSON message.

Definition at line 80 of file DimensionlessScalar.hpp.

References PhQ::Print(), and PhQ::DimensionlessScalar< NumericType >::value.

◆ MutableValue()

template<typename NumericType = double>
constexpr NumericType& PhQ::DimensionlessScalar< NumericType >::MutableValue ( )
inlineconstexprnoexcept

Returns the value of this physical quantity as a mutable value.

Definition at line 65 of file DimensionlessScalar.hpp.

References PhQ::DimensionlessScalar< NumericType >::value.

◆ operator=() [1/3]

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

Copy assignment operator. Assigns this dimensionless scalar physical quantity by copying another one.

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this dimensionless scalar physical quantity by copying another one.

Template Parameters
OtherNumericTypeFloating-point numeric type of the other physical quantity. Deduced automatically.

Definition at line 131 of file DimensionlessScalar.hpp.

References PhQ::DimensionlessScalar< NumericType >::Value(), and PhQ::DimensionlessScalar< NumericType >::value.

◆ operator=() [3/3]

template<typename NumericType = double>
constexpr DimensionlessScalar<NumericType>& PhQ::DimensionlessScalar< NumericType >::operator= ( DimensionlessScalar< NumericType > &&  other)
constexprprotecteddefaultnoexcept

Move assignment operator. Assigns this dimensionless scalar physical quantity by moving another one.

◆ Print()

template<typename NumericType = double>
std::string PhQ::DimensionlessScalar< NumericType >::Print ( ) const
inline

Prints this physical quantity as a string.

Definition at line 75 of file DimensionlessScalar.hpp.

References PhQ::Print(), and PhQ::DimensionlessScalar< NumericType >::value.

Referenced by PhQ::operator<<().

◆ SetValue()

template<typename NumericType = double>
constexpr void PhQ::DimensionlessScalar< NumericType >::SetValue ( const NumericType  value)
inlineconstexprnoexcept

Sets the value of this physical quantity to the given value.

Definition at line 70 of file DimensionlessScalar.hpp.

References PhQ::DimensionlessScalar< NumericType >::value.

◆ Value()

template<typename NumericType = double>
constexpr NumericType PhQ::DimensionlessScalar< NumericType >::Value ( ) const
inlineconstexprnoexcept

◆ XML()

template<typename NumericType = double>
std::string PhQ::DimensionlessScalar< NumericType >::XML ( ) const
inline

Serializes this physical quantity as an XML message.

Definition at line 85 of file DimensionlessScalar.hpp.

References PhQ::Print(), and PhQ::DimensionlessScalar< NumericType >::value.

◆ YAML()

template<typename NumericType = double>
std::string PhQ::DimensionlessScalar< NumericType >::YAML ( ) const
inline

Serializes this physical quantity as a YAML message.

Definition at line 90 of file DimensionlessScalar.hpp.

References PhQ::Print(), and PhQ::DimensionlessScalar< NumericType >::value.

Member Data Documentation

◆ value

template<typename NumericType = double>
NumericType PhQ::DimensionlessScalar< NumericType >::value
protected

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