roo_quantity
API Documentation for roo_quantity
Loading...
Searching...
No Matches
roo_quantity::Mass Class Reference

Representation of mass, internally stored as floating-point kilograms. More...

#include <mass.h>

Public Member Functions

 Mass ()
 Creates a mass object representing an 'unknown' mass.
 
float inTons () const
 Returns the mass in metric tonnes.
 
float inKilograms () const
 Returns the mass in kilograms.
 
float inKg () const
 
float inGrams () const
 Returns the mass in grams.
 
float inMilligrams () const
 Returns the mass in milligrams.
 
float inMicrograms () const
 Returns the mass in micrograms.
 
float inPounds () const
 Returns the mass in pounds.
 
float inLbs () const
 Returns the mass in pounds.
 
bool isUnknown () const
 Returns whether the object represents an unknown mass.
 
bool operator< (const Mass &other) const
 
bool operator== (const Mass &other) const
 
bool operator> (const Mass &other) const
 
bool operator<= (const Mass &other) const
 
bool operator>= (const Mass &other) const
 
bool operator!= (const Mass &other) const
 
Massoperator+= (const Mass &other)
 
Massoperator-= (const Mass &other)
 
Massoperator*= (float multi)
 
Massoperator/= (float div)
 

Friends

Mass UnknownMass ()
 Returns a mass object representing an unknown mass.
 
Mass MassInKilograms (float)
 Returns a mass object equivalent to the specified mass expressed in kilograms.
 

Detailed Description

Representation of mass, internally stored as floating-point kilograms.

Definition at line 19 of file mass.h.

Constructor & Destructor Documentation

◆ Mass()

roo_quantity::Mass::Mass ( )
inline

Creates a mass object representing an 'unknown' mass.

Definition at line 22 of file mass.h.

Member Function Documentation

◆ inGrams()

float roo_quantity::Mass::inGrams ( ) const
inline

Returns the mass in grams.

Definition at line 33 of file mass.h.

◆ inKg()

◆ inKilograms()

float roo_quantity::Mass::inKilograms ( ) const
inline

Returns the mass in kilograms.

Definition at line 28 of file mass.h.

Referenced by inKg().

◆ inLbs()

float roo_quantity::Mass::inLbs ( ) const
inline

Returns the mass in pounds.

Definition at line 45 of file mass.h.

References inPounds().

◆ inMicrograms()

float roo_quantity::Mass::inMicrograms ( ) const
inline

Returns the mass in micrograms.

Definition at line 39 of file mass.h.

◆ inMilligrams()

float roo_quantity::Mass::inMilligrams ( ) const
inline

Returns the mass in milligrams.

Definition at line 36 of file mass.h.

◆ inPounds()

float roo_quantity::Mass::inPounds ( ) const
inline

Returns the mass in pounds.

Definition at line 42 of file mass.h.

Referenced by inLbs().

◆ inTons()

float roo_quantity::Mass::inTons ( ) const
inline

Returns the mass in metric tonnes.

Definition at line 25 of file mass.h.

◆ isUnknown()

bool roo_quantity::Mass::isUnknown ( ) const
inline

Returns whether the object represents an unknown mass.

Definition at line 48 of file mass.h.

◆ operator!=()

bool roo_quantity::Mass::operator!= ( const Mass other) const
inline

Definition at line 60 of file mass.h.

◆ operator*=()

Mass & roo_quantity::Mass::operator*= ( float  multi)
inline

Definition at line 72 of file mass.h.

◆ operator+=()

Mass & roo_quantity::Mass::operator+= ( const Mass other)
inline

Definition at line 62 of file mass.h.

References inKg().

◆ operator-=()

Mass & roo_quantity::Mass::operator-= ( const Mass other)
inline

Definition at line 67 of file mass.h.

References inKg().

◆ operator/=()

Mass & roo_quantity::Mass::operator/= ( float  div)
inline

Definition at line 77 of file mass.h.

◆ operator<()

bool roo_quantity::Mass::operator< ( const Mass other) const
inline

Definition at line 50 of file mass.h.

◆ operator<=()

bool roo_quantity::Mass::operator<= ( const Mass other) const
inline

Definition at line 56 of file mass.h.

◆ operator==()

bool roo_quantity::Mass::operator== ( const Mass other) const
inline

Definition at line 52 of file mass.h.

◆ operator>()

bool roo_quantity::Mass::operator> ( const Mass other) const
inline

Definition at line 54 of file mass.h.

◆ operator>=()

bool roo_quantity::Mass::operator>= ( const Mass other) const
inline

Definition at line 58 of file mass.h.

Friends And Related Symbol Documentation

◆ MassInKilograms

Mass MassInKilograms ( float  mass)
friend

Returns a mass object equivalent to the specified mass expressed in kilograms.

Definition at line 109 of file mass.h.

◆ UnknownMass

Mass UnknownMass ( )
friend

Returns a mass object representing an unknown mass.

Definition at line 105 of file mass.h.


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