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

Computer memory. For the time rate of change of computer memory, see PhQ::MemoryRate; see also PhQ::Time and PhQ::Frequency. More...

#include "Memory.hpp"

Public Member Functions

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

Detailed Description

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

Computer memory. For the time rate of change of computer memory, see PhQ::MemoryRate; see also PhQ::Time and PhQ::Frequency.

Definition at line 52 of file Memory.hpp.

Constructor & Destructor Documentation

◆ Memory() [1/8]

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

Default constructor. Constructs a memory quantity with an uninitialized value.

◆ Memory() [2/8]

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

Constructor. Constructs a memory quantity with a given value expressed in a given memory unit.

Definition at line 59 of file Memory.hpp.

◆ Memory() [3/8]

template<typename NumericType = double>
constexpr PhQ::Memory< NumericType >::Memory ( const MemoryRate< NumericType > &  memory_rate,
const Time< NumericType > &  time 
)
constexpr

Constructor. Constructs a memory quantity from a given memory rate and time duration using the definition of memory rate.

◆ Memory() [4/8]

template<typename NumericType = double>
constexpr PhQ::Memory< NumericType >::Memory ( const MemoryRate< NumericType > &  memory_rate,
const Frequency< NumericType > &  frequency 
)
constexpr

Constructor. Constructs a memory quantity from a given memory rate and frequency using the definition of memory rate.

◆ ~Memory()

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

Destructor. Destroys this memory quantity.

◆ Memory() [5/8]

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

Copy constructor. Constructs a memory quantity by copying another one.

◆ Memory() [6/8]

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

Copy constructor. Constructs a memory quantity by copying another one.

Definition at line 79 of file Memory.hpp.

◆ Memory() [7/8]

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

Move constructor. Constructs a memory quantity by moving another one.

◆ Memory() [8/8]

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

Constructor. Constructs a memory quantity with a given value expressed in the standard memory unit.

Definition at line 156 of file Memory.hpp.

Member Function Documentation

◆ Create()

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

Statically creates a memory quantity with a given value expressed in a given memory unit.

Definition at line 106 of file Memory.hpp.

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

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::Memory , 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::Memory , 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::Memory , double >::JSON ( const Unit::Memory  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::Memory , 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 MemoryRate<NumericType> PhQ::Memory< NumericType >::operator* ( const Frequency< NumericType > &  frequency) const
constexpr

◆ operator*() [2/2]

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

Definition at line 119 of file Memory.hpp.

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

◆ operator*=()

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

Definition at line 145 of file Memory.hpp.

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

◆ operator+()

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

◆ operator+=()

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

Definition at line 137 of file Memory.hpp.

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

◆ operator-()

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

◆ operator-=()

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

Definition at line 141 of file Memory.hpp.

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

◆ operator/() [1/4]

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

Definition at line 133 of file Memory.hpp.

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

◆ operator/() [2/4]

template<typename NumericType = double>
constexpr Time<NumericType> PhQ::Memory< NumericType >::operator/ ( const MemoryRate< NumericType > &  memory_rate) const
constexpr

◆ operator/() [3/4]

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

Definition at line 125 of file Memory.hpp.

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

◆ operator/() [4/4]

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

◆ operator/=()

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

Definition at line 149 of file Memory.hpp.

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

◆ operator=() [1/3]

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

Copy assignment operator. Assigns this memory quantity by copying another one.

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this memory quantity by copying another one.

Definition at line 90 of file Memory.hpp.

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

◆ operator=() [3/3]

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

Move assignment operator. Assigns this memory quantity by moving another one.

◆ Print() [1/2]

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

Statically creates a memory quantity of zero.

Definition at line 99 of file Memory.hpp.

Member Data Documentation

◆ value

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