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::ElectricCharge< NumericType > Class Template Reference

Electric charge. More...

#include "ElectricCharge.hpp"

Public Member Functions

 ElectricCharge ()=default
 Default constructor. Constructs an electric charge with an uninitialized value. More...
 
 ElectricCharge (const NumericType value, const Unit::ElectricCharge unit)
 Constructor. Constructs an electric charge with a given value expressed in a given electric charge unit. More...
 
constexpr ElectricCharge (const ElectricCurrent< NumericType > &electric_current, const Time< NumericType > &time)
 Constructor. Constructs an electric charge from a given electric current and time using the definition of electric current. More...
 
constexpr ElectricCharge (const ElectricCurrent< NumericType > &electric_current, const Frequency< NumericType > &frequency)
 Constructor. Constructs an electric charge from a given electric current and frequency using the definition of electric current. More...
 
 ~ElectricCharge () noexcept=default
 Destructor. Destroys this electric charge. More...
 
constexpr ElectricCharge (const ElectricCharge< NumericType > &other)=default
 Copy constructor. Constructs an electric charge by copying another one. More...
 
template<typename OtherNumericType >
constexpr ElectricCharge (const ElectricCharge< OtherNumericType > &other)
 Copy constructor. Constructs an electric charge by copying another one. More...
 
constexpr ElectricCharge (ElectricCharge< NumericType > &&other) noexcept=default
 Move constructor. Constructs an electric charge by moving another one. More...
 
constexpr ElectricCharge< NumericType > & operator= (const ElectricCharge< NumericType > &other)=default
 Copy assignment operator. Assigns this electric charge by copying another one. More...
 
template<typename OtherNumericType >
constexpr ElectricCharge< NumericType > & operator= (const ElectricCharge< OtherNumericType > &other)
 Copy assignment operator. Assigns this electric charge by copying another one. More...
 
constexpr ElectricCharge< NumericType > & operator= (ElectricCharge< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this electric charge by moving another one. More...
 
constexpr ElectricCharge< NumericType > operator+ (const ElectricCharge< NumericType > &electric_charge) const
 
constexpr ElectricCharge< NumericType > operator- (const ElectricCharge< NumericType > &electric_charge) const
 
constexpr ElectricCharge< NumericType > operator* (const NumericType number) const
 
constexpr ElectricCurrent< NumericType > operator* (const Frequency< NumericType > &frequency) const
 
constexpr ElectricCharge< NumericType > operator/ (const NumericType number) const
 
constexpr NumericType operator/ (const ElectricCharge< NumericType > &electric_charge) const noexcept
 
constexpr ElectricCurrent< NumericType > operator/ (const Time< NumericType > &time) const
 
constexpr Time< NumericType > operator/ (const ElectricCurrent< NumericType > &electric_current) const
 
constexpr void operator+= (const ElectricCharge< NumericType > &electric_charge) noexcept
 
constexpr void operator-= (const ElectricCharge< NumericType > &electric_charge) 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::ElectricCharge 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::ElectricCharge 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::ElectricCharge 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::ElectricCharge 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::ElectricCharge 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 ElectricCharge< NumericType > Zero ()
 Statically creates an electric charge of zero. More...
 
template<Unit::ElectricCharge Unit>
static constexpr ElectricCharge< NumericType > Create (const NumericType value)
 Statically creates an electric charge with a given value expressed in a given electric charge unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::ElectricCharge 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 ElectricCharge (const NumericType value)
 Constructor. Constructs an electric charge with a given value expressed in the standard electric charge unit. More...
 

Detailed Description

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

Electric charge.

Definition at line 51 of file ElectricCharge.hpp.

Constructor & Destructor Documentation

◆ ElectricCharge() [1/8]

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

Default constructor. Constructs an electric charge with an uninitialized value.

◆ ElectricCharge() [2/8]

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

Constructor. Constructs an electric charge with a given value expressed in a given electric charge unit.

Definition at line 58 of file ElectricCharge.hpp.

◆ ElectricCharge() [3/8]

template<typename NumericType = double>
constexpr PhQ::ElectricCharge< NumericType >::ElectricCharge ( const ElectricCurrent< NumericType > &  electric_current,
const Time< NumericType > &  time 
)
constexpr

Constructor. Constructs an electric charge from a given electric current and time using the definition of electric current.

◆ ElectricCharge() [4/8]

template<typename NumericType = double>
constexpr PhQ::ElectricCharge< NumericType >::ElectricCharge ( const ElectricCurrent< NumericType > &  electric_current,
const Frequency< NumericType > &  frequency 
)
constexpr

Constructor. Constructs an electric charge from a given electric current and frequency using the definition of electric current.

◆ ~ElectricCharge()

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

Destructor. Destroys this electric charge.

◆ ElectricCharge() [5/8]

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

Copy constructor. Constructs an electric charge by copying another one.

◆ ElectricCharge() [6/8]

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

Copy constructor. Constructs an electric charge by copying another one.

Definition at line 79 of file ElectricCharge.hpp.

◆ ElectricCharge() [7/8]

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

Move constructor. Constructs an electric charge by moving another one.

◆ ElectricCharge() [8/8]

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

Constructor. Constructs an electric charge with a given value expressed in the standard electric charge unit.

Definition at line 161 of file ElectricCharge.hpp.

Member Function Documentation

◆ Create()

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

Statically creates an electric charge with a given value expressed in a given electric charge unit.

Definition at line 108 of file ElectricCharge.hpp.

References PhQ::DimensionalScalar< Unit::ElectricCharge, double >::value.

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::ElectricCharge , 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::ElectricCharge , 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::ElectricCharge , double >::JSON ( const Unit::ElectricCharge  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::ElectricCharge , 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/2]

template<typename NumericType = double>
constexpr ElectricCurrent<NumericType> PhQ::ElectricCharge< NumericType >::operator* ( const Frequency< NumericType > &  frequency) const
constexpr

◆ operator*() [2/2]

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

◆ operator*=()

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-()

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

◆ operator-=()

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

◆ operator/() [1/4]

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

◆ operator/() [2/4]

template<typename NumericType = double>
constexpr Time<NumericType> PhQ::ElectricCharge< NumericType >::operator/ ( const ElectricCurrent< NumericType > &  electric_current) const
constexpr

◆ operator/() [3/4]

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

◆ operator/() [4/4]

template<typename NumericType = double>
constexpr ElectricCurrent<NumericType> PhQ::ElectricCharge< NumericType >::operator/ ( const Time< NumericType > &  time) const
constexpr

◆ operator/=()

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

◆ operator=() [1/3]

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

Copy assignment operator. Assigns this electric charge by copying another one.

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this electric charge by copying another one.

Definition at line 91 of file ElectricCharge.hpp.

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

◆ operator=() [3/3]

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

Move assignment operator. Assigns this electric charge by moving another one.

◆ Print() [1/2]

std::string PhQ::DimensionalScalar< Unit::ElectricCharge , 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::ElectricCharge , double >::Print ( const Unit::ElectricCharge  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::ElectricCharge , 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::ElectricCharge , 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::ElectricCharge PhQ::DimensionalScalar< Unit::ElectricCharge , 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::ElectricCharge , 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::ElectricCharge , double >::Value ( const Unit::ElectricCharge  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::ElectricCharge , 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::ElectricCharge , double >::XML ( const Unit::ElectricCharge  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::ElectricCharge , 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::ElectricCharge , double >::YAML ( const Unit::ElectricCharge  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 ElectricCharge<NumericType> PhQ::ElectricCharge< NumericType >::Zero ( )
inlinestaticconstexpr

Statically creates an electric charge of zero.

Definition at line 101 of file ElectricCharge.hpp.

Member Data Documentation

◆ value

double PhQ::DimensionalScalar< Unit::ElectricCharge , 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 file: