ome-xml  5.6.0
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 >:
+ Collaboration diagram for ome::xml::model::primitives::Quantity< Unit, Value >:

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...
 
Quantityoperator= (const Quantity &quantity)
 Assign the quantity from a quantity. More...
 
Quantityoperator+= (const Quantity &quantity)
 Add a quantity to the quantity. More...
 
Quantityoperator-= (const Quantity &quantity)
 Subtract a quantity from the quantity. More...
 
Quantityoperator*= (const value_type &value)
 Multiply the quantity by a value. More...
 
Quantityoperator/= (const value_type &value)
 Divide the quantity by a value. More...
 
Quantityoperator%= (const value_type &value)
 Modulo of the quantity by a value. More...
 
Quantityoperator++ ()
 Increment the quantity by one. More...
 
Quantityoperator-- ()
 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
valuethe quantity value.
unitthe 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
quantitythe 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

◆ 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
valuethe 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
valuethe 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
quantitythe 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

◆ 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
quantitythe 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
valuethe 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
quantitythe 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

◆ 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
quantitythe 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: