ome-xml  5.2.0-m5
Public Types | Public Member Functions | Private 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 Member Functions

value_type convert_value (const Quantity &quantity, unit_type unit) const
 Convert a quantity to a specific unit. 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

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.
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

template<class Unit, typename Value = double>
Quantity< Unit, Value >::value_type ome::xml::model::primitives::Quantity< Unit, Value >::convert_value ( const Quantity< Unit, Value > &  quantity,
unit_type  unit 
) const
inlineprivate

Convert a quantity to a specific unit.

Parameters
quantitythe quantity to convert.
unitthe unit to which to convert the quantity.
Returns
the converted quantity.

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

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

+ Here is the caller graph for this function:

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.

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::Quantity< Unit, Value >::convert_value(), and ome::xml::model::primitives::operator<<().

+ Here is the caller graph for this function:

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.

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.

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.

template<class Unit, typename Value = double>
Quantity& ome::xml::model::primitives::Quantity< Unit, Value >::operator+= ( const Quantity< Unit, Value > &  quantity)
inline
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 >::value.

template<class Unit, typename Value = double>
Quantity& 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::Quantity< Unit, Value >::convert_value(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

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.

template<class Unit, typename Value = double>
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::Quantity< Unit, Value >::convert_value(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.

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
quantitythe quantity to assign.
Returns
the new quantity.

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

template<class Unit, typename Value = double>
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::Quantity< Unit, Value >::convert_value(), ome::xml::model::primitives::Quantity< Unit, Value >::unit, and ome::xml::model::primitives::Quantity< Unit, Value >::value.


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