ome-xml 5.2.3

Public Types | Public Member Functions | Private Attributes | List of all members
ome::xml::model::primitives::Quantity< Unit, Value > Class Template Reference

A quantity of a defined unit. More...

`#include <ome/xml/model/primitives/Quantity.h>`

Inheritance diagram for ome::xml::model::primitives::Quantity< Unit, Value >:
[legend]
Collaboration diagram for ome::xml::model::primitives::Quantity< Unit, Value >:
[legend]

## Public Types
typedef Unit | unit_type
| The type of a unit.
typedef Value | value_type
| The type of a value.

## Public Member Functions
| Quantity ()
| Default construct a Quantity.
| Quantity (value_type value, unit_type unit)
| Construct a Quantity from a value and unit. More...
| Quantity (const Quantity &quantity)
| Copy construct a Quantity. More...
| ~Quantity ()
| Destructor.
value_type | getValue () const
| Get the value for this quantity. More...
unit_type | getUnit () const
| Get the unit for this quantity. More...
Quantity & | operator= (const Quantity &quantity)
| Assign the quantity from a quantity. More...
Quantity & | operator+= (const Quantity &quantity)
| Add a quantity to the quantity. More...
Quantity & | operator-= (const Quantity &quantity)
| Subtract a quantity from the quantity. More...
Quantity & | operator*= (const value_type &value)
| Multiply the quantity by a value. More...
Quantity & | operator/= (const value_type &value)
| Divide the quantity by a value. More...
Quantity & | operator%= (const value_type &value)
| Modulo of the quantity by a value. More...
Quantity & | operator++ ()
| Increment the quantity by one. More...
Quantity & | operator-- ()
| Decrement the quantity by one. More...
bool | operator< (const Quantity &quantity) const
| Check if the quantity is less than a quantity. More...
bool | operator== (const Quantity &quantity) const
| Check if the quantity is equal to a quantity. More...

## Private Attributes
value_type | value
| Quantity value.
unit_type | unit
| Quantity unit.

## Detailed Description

### template<class Unit, typename Value = double>
class ome::xml::model::primitives::Quantity< Unit, Value >

A quantity of a defined unit.

## Constructor & Destructor Documentation

## § Quantity() [1/2]

template<class Unit, typename Value = double>

ome::xml::model::primitives::Quantity< Unit, Value >::Quantity | ( | value_type | value,
|  | unit_type | unit
| ) |  |
| inline

Construct a Quantity from a value and unit.

Parameters

  value | the quantity value.
  unit | the quantity unit.

## § Quantity() [2/2]

template<class Unit, typename Value = double>

ome::xml::model::primitives::Quantity< Unit, Value >::Quantity | ( | const Quantity< Unit, Value > & | quantity | ) |
| inline

Copy construct a Quantity.

Parameters

  quantity | the quantity to copy.

## Member Function Documentation

## § getUnit()

template<class Unit, typename Value = double>

unit_type ome::xml::model::primitives::Quantity< Unit, Value >::getUnit | ( |  | ) | const
| inline

Get the unit for this quantity.

Returns
  the unit.

References ome::xml::model::primitives::Quantity< Unit, Value >::unit.

Referenced by ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsTemperature, Value >::operator()(), ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsFrequency, Value >::operator()(), ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsPower, Value >::operator()(), ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsElectricPotential, Value >::operator()(), ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsTime, Value >::operator()(), ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsPressure, Value >::operator()(), and ome::xml::model::primitives::QuantityConverter< ome::xml::model::enums::UnitsLength, Value >::operator()().

Here is the caller graph for this function:

## § getValue()

template<class Unit, typename Value = double>

value_type ome::xml::model::primitives::Quantity< Unit, Value >::getValue | ( |  | ) | const
| inline

Get the value for this quantity.

Returns
  the value.

References ome::xml::model::primitives::Quantity< Unit, Value >::value.

Referenced by ome::xml::model::primitives::operator<<().

Here is the caller graph for this function:

## § operator%=()

template<class Unit, typename Value = double>

Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator%= | ( | const value_type & | value | ) |
| inline

Modulo of the quantity by a value.

Parameters

  value | the value to compute the modulus with.

Returns
  the new quantity.

References ome::xml::model::primitives::Quantity< Unit, Value >::value.

## § operator*=()

template<class Unit, typename Value = double>

Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator*= | ( | const value_type & | value | ) |
| inline

Multiply the quantity by a value.

Parameters

  value | the value to multiply by.

Returns
  the new quantity.

References ome::xml::model::primitives::Quantity< Unit, Value >::value.

## § operator++()

template<class Unit, typename Value = double>

Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator++ | ( |  | ) |
| inline

Increment the quantity by one.

Returns
  the new value.

References ome::xml::model::primitives::Quantity< Unit, Value >::value.

## § operator+=()

template<class Unit , typename Value >

Quantity< Unit, Value > & ome::xml::model::primitives::Quantity< Unit, Value >::operator+= | ( | const Quantity< Unit, Value > & | quantity | ) |
| inline

Add a quantity to the quantity.

Parameters

  quantity | the quantity to add.

Returns
  the new quantity.

References ome::xml::model::primitives::convert(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

Referenced by ome::xml::model::primitives::Quantity< Unit, Value >::operator=().

Here is the caller graph for this function:

## § operator--()

template<class Unit, typename Value = double>

Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator-- | ( |  | ) |
| inline

Decrement the quantity by one.

Returns
  the new value.

References ome::xml::model::primitives::Quantity< Unit, Value >::operator<(), ome::xml::model::primitives::Quantity< Unit, Value >::operator==(), and ome::xml::model::primitives::Quantity< Unit, Value >::value.

## § operator-=()

template<class Unit , typename Value >

Quantity< Unit, Value > & ome::xml::model::primitives::Quantity< Unit, Value >::operator-= | ( | const Quantity< Unit, Value > & | quantity | ) |
| inline

Subtract a quantity from the quantity.

Parameters

  quantity | the quantity to subtract.

Returns
  the new quantity.

References ome::xml::model::primitives::convert(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

Referenced by ome::xml::model::primitives::Quantity< Unit, Value >::operator=().

Here is the caller graph for this function:

## § operator/=()

template<class Unit, typename Value = double>

Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator/= | ( | const value_type & | value | ) |
| inline

Divide the quantity by a value.

Parameters

  value | the value to divide by.

Returns
  the new quantity.

References ome::xml::model::primitives::Quantity< Unit, Value >::value.

## § operator<()

template<class Unit , typename Value >

bool ome::xml::model::primitives::Quantity< Unit, Value >::operator< | ( | const Quantity< Unit, Value > & | quantity | ) | const
| inline

Check if the quantity is less than a quantity.

Parameters

  quantity | the quantity to compare with.

Returns
  true if the condition is true, else false.

References ome::xml::model::primitives::convert(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

Referenced by ome::xml::model::primitives::Quantity< Unit, Value >::operator--().

Here is the caller graph for this function:

## § operator=()

template<class Unit, typename Value = double>

Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator= | ( | const Quantity< Unit, Value > & | quantity | ) |
| inline

Assign the quantity from a quantity.

Parameters

  quantity | the quantity to assign.

Returns
  the new quantity.

References ome::xml::model::primitives::Quantity< Unit, Value >::operator+=(), ome::xml::model::primitives::Quantity< Unit, Value >::operator-=(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

## § operator==()

template<class Unit , typename Value >

bool ome::xml::model::primitives::Quantity< Unit, Value >::operator== | ( | const Quantity< Unit, Value > & | quantity | ) | const
| inline

Check if the quantity is equal to a quantity.

Parameters

  quantity | the quantity to compare with.

Returns
  true if the condition is true, else false.

References ome::xml::model::primitives::convert(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

Referenced by ome::xml::model::primitives::Quantity< Unit, Value >::operator--().

Here is the caller graph for this function:

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

- ome/xml/model/primitives/Quantity.h