Poco::Util::Units

template < typename V, typename U >

class Value

Library: Util
Package: Units
Header: Poco/Util/Units.h

Description

A Value with a unit.

  • V is the type you are storing
  • U is the unit of the Value

This class is usually not used directly; client code should use the typedef'd instantiations defined in the Values and Constants namespace.

Example:

using namespace Poco::Util::Units::Values;

std::cout << "One mile is " << km(mile(1)) << std::endl;
    // Output: One mile is 1.60934 km

std::cout << "Flow rate is " << m3(mile(1)*inch(80)*foot(9))/s(minute(5));
    // Output: Flow rate is 29.9026 (m)^3.(s)^-1

hours h;
h = cm(3);   // Compile-time error: incompatible units
h = 4;       // Compile-time error: 4 of what?
h = days(4); // Ok: h is 96 hours

Member Summary

Member Functions: get, operator !=, operator *, operator *=, operator +, operator ++, operator +=, operator -, operator --, operator -=, operator /, operator /=, operator <, operator <=, operator =, operator ==, operator >, operator >=

Types

Unit

typedef U Unit;

ValueType

typedef V ValueType;

Constructors

Value inline

Value();

Value inline

explicit Value(
    const ValueType & v
);

Value inline

template < typename OV, typename OU > Value(
    const Value < OV, OU > & v
);

Member Functions

get inline

const ValueType & get() const;

operator != inline

template < typename OV, typename OU > bool operator != (
    const Value < OV, OU > & other
) const;

operator * inline

template < typename OV, typename OU > Value < V, Compose < U, OU > > operator * (
    const Value < OV, OU > & other
) const;

operator * inline

Value operator * (
    const ValueType & v
) const;

operator *= inline

Value & operator *= (
    const ValueType & v
);

operator + inline

template < typename OV, typename OU > Value operator + (
    const Value < OV, OU > & other
) const;

operator ++ inline

Value & operator ++ ();

operator ++ inline

Value operator ++ (
    int
);

operator += inline

template < typename OV, typename OU > Value & operator += (
    const Value < OV, OU > & other
);

operator - inline

template < typename OV, typename OU > Value operator - (
    const Value < OV, OU > & other
) const;

operator - inline

Value operator - () const;

operator -- inline

Value & operator -- ();

operator -- inline

Value operator -- (
    int
);

operator -= inline

template < typename OV, typename OU > Value & operator -= (
    const Value < OV, OU > & other
);

operator / inline

template < typename OV, typename OU > Value < V, Compose < U, Power < OU, - 1 > > > operator / (
    const Value < OV, OU > & other
) const;

operator / inline

Value operator / (
    const ValueType & v
) const;

operator /= inline

Value & operator /= (
    const ValueType & v
);

operator < inline

template < typename OV, typename OU > bool operator < (
    const Value < OV, OU > & other
) const;

operator <= inline

template < typename OV, typename OU > bool operator <= (
    const Value < OV, OU > & other
) const;

operator = inline

template < typename OV, typename OU > Value & operator = (
    const Value < OV, OU > & other
);

operator == inline

template < typename OV, typename OU > bool operator == (
    const Value < OV, OU > & other
) const;

operator > inline

template < typename OV, typename OU > bool operator > (
    const Value < OV, OU > & other
) const;

operator >= inline

template < typename OV, typename OU > bool operator >= (
    const Value < OV, OU > & other
) const;