SyDEVS  v0.7
Simulation-based analysis of complex systems involving people, devices, physical elements, and dynamic environments.
sydevs::quantity_base Class Reference

A base class for quantities, defining operations that do not depend on the dimension. More...

#include <quantity.h>

Inherited by sydevs::quantity< seconds >, sydevs::quantity< U >, and sydevs::quantity< no_units >.

Public Member Functions

constexpr bool valid () const
 Returns true if the quantity value is valid. More...
 
constexpr bool finite () const
 Returns true if the quantity value is finite. More...
 
constexpr int64 multiplier () const
 Returns the number that multiples the length precision. More...
 
constexpr scale precision () const
 Returns the length precision. More...
 
constexpr bool fixed () const
 Returns true if the quantity value has a fixed length precision. More...
 

Protected Member Functions

constexpr quantity_base ()
 
constexpr quantity_base (int64 multiplier)
 
constexpr quantity_base (int64 multiplier, scale precision)
 
constexpr quantity_base (int64 multiplier, scale precision, bool fixed)
 
constexpr quantity_base (scale precision, float64 multiplier, int8 fixed)
 
constexpr quantity_base (const quantity_base &)=default
 Copy constructor. More...
 
quantity_baseoperator= (const quantity_base &)=default
 Copy assignment. More...
 
 quantity_base (quantity_base &&)=default
 Move constructor. More...
 
quantity_baseoperator= (quantity_base &&)=default
 Move assignment. More...
 
 ~quantity_base ()=default
 Destructor. More...
 

Static Protected Member Functions

static constexpr int64 constexpr_abs (int64 n)
 
static constexpr float64 constexpr_abs (float64 x)
 
static constexpr float64 convert_multiplier (int64 multiplier)
 
static constexpr int64 convert_level (int64 multiplier, int64 level)
 
static constexpr float64 offset_multiplier (float64 multiplier)
 
static constexpr int64 truncate_multiplier (float64 multiplier)
 
static constexpr int64 round_multiplier (float64 multiplier)
 
static constexpr int64 scale_multiplier (float64 multiplier, float64 factor)
 

Protected Attributes

float64 multiplier_
 
scale precision_
 
int8 fixed_
 

Static Protected Attributes

static constexpr float64 inf_float64 = std::numeric_limits<float64>::infinity()
 
static constexpr float64 nan_float64 = std::numeric_limits<float64>::quiet_NaN()
 
static constexpr int64 inf_int64 = std::numeric_limits<int64>::max()
 
static constexpr int64 nan_int64 = std::numeric_limits<int64>::min()
 

Detailed Description

A base class for quantities, defining operations that do not depend on the dimension.

Constructor & Destructor Documentation

◆ quantity_base() [1/7]

constexpr sydevs::quantity_base::quantity_base ( )
constexprprotected

◆ quantity_base() [2/7]

constexpr sydevs::quantity_base::quantity_base ( int64  multiplier)
explicitconstexprprotected

◆ quantity_base() [3/7]

constexpr sydevs::quantity_base::quantity_base ( int64  multiplier,
scale  precision 
)
constexprprotected

◆ quantity_base() [4/7]

constexpr sydevs::quantity_base::quantity_base ( int64  multiplier,
scale  precision,
bool  fixed 
)
constexprprotected

◆ quantity_base() [5/7]

constexpr sydevs::quantity_base::quantity_base ( scale  precision,
float64  multiplier,
int8  fixed 
)
constexprprotected

◆ quantity_base() [6/7]

constexpr sydevs::quantity_base::quantity_base ( const quantity_base )
constexprprotecteddefault

Copy constructor.

◆ quantity_base() [7/7]

sydevs::quantity_base::quantity_base ( quantity_base &&  )
protecteddefault

Move constructor.

◆ ~quantity_base()

sydevs::quantity_base::~quantity_base ( )
protecteddefault

Destructor.

Member Function Documentation

◆ constexpr_abs() [1/2]

constexpr float64 sydevs::quantity_base::constexpr_abs ( float64  x)
staticconstexprprotected

◆ constexpr_abs() [2/2]

constexpr int64 sydevs::quantity_base::constexpr_abs ( int64  n)
staticconstexprprotected

◆ convert_level()

constexpr int64 sydevs::quantity_base::convert_level ( int64  multiplier,
int64  level 
)
staticconstexprprotected

◆ convert_multiplier()

constexpr float64 sydevs::quantity_base::convert_multiplier ( int64  multiplier)
staticconstexprprotected

◆ finite()

constexpr bool sydevs::quantity_base::finite ( ) const
constexpr

Returns true if the quantity value is finite.

◆ fixed()

constexpr bool sydevs::quantity_base::fixed ( ) const
constexpr

Returns true if the quantity value has a fixed length precision.

◆ multiplier()

constexpr int64 sydevs::quantity_base::multiplier ( ) const
constexpr

Returns the number that multiples the length precision.

◆ offset_multiplier()

constexpr float64 sydevs::quantity_base::offset_multiplier ( float64  multiplier)
staticconstexprprotected

◆ operator=() [1/2]

quantity_base& sydevs::quantity_base::operator= ( const quantity_base )
protecteddefault

Copy assignment.

◆ operator=() [2/2]

quantity_base& sydevs::quantity_base::operator= ( quantity_base &&  )
protecteddefault

Move assignment.

◆ precision()

constexpr scale sydevs::quantity_base::precision ( ) const
constexpr

Returns the length precision.

◆ round_multiplier()

constexpr int64 sydevs::quantity_base::round_multiplier ( float64  multiplier)
staticconstexprprotected

◆ scale_multiplier()

constexpr int64 sydevs::quantity_base::scale_multiplier ( float64  multiplier,
float64  factor 
)
staticconstexprprotected

◆ truncate_multiplier()

constexpr int64 sydevs::quantity_base::truncate_multiplier ( float64  multiplier)
staticconstexprprotected

◆ valid()

constexpr bool sydevs::quantity_base::valid ( ) const
constexpr

Returns true if the quantity value is valid.

Member Data Documentation

◆ fixed_

int8 sydevs::quantity_base::fixed_
protected

◆ inf_float64

constexpr float64 sydevs::quantity_base::inf_float64 = std::numeric_limits<float64>::infinity()
staticconstexprprotected

◆ inf_int64

constexpr int64 sydevs::quantity_base::inf_int64 = std::numeric_limits<int64>::max()
staticconstexprprotected

◆ multiplier_

float64 sydevs::quantity_base::multiplier_
protected

◆ nan_float64

constexpr float64 sydevs::quantity_base::nan_float64 = std::numeric_limits<float64>::quiet_NaN()
staticconstexprprotected

◆ nan_int64

constexpr int64 sydevs::quantity_base::nan_int64 = std::numeric_limits<int64>::min()
staticconstexprprotected

◆ precision_

scale sydevs::quantity_base::precision_
protected

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