quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > Class Template Reference

Variable: specialization. More...

#include <Variable.h>

Inheritance diagram for quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >:

quantity::Quantity< QT, ST > quantity::Quantities

List of all members.

Public Types

typedef
QuantityTraits< QT >
::Dimension 
DIM
 the dimension
typedef
QuantityTraits< QT >
::UnitType 
UT
 the unit type
typedef
QuantityTraits< QT >
::UnitList 
UL
 the unit list
typedef
QuantityTraits< QT >
::DefaultUnit 
DU
 the default unit
typedef
unit::CheckUnit
< unit::Unit< UT >,
SU >::Check 
StorageUnit
 the storage unit
typedef Quantity< QT,
ST > 
BQ
 the base quantity type
typedef Variable< BQ,
DerivedQuantity< QT,
SU, DQT > > 
V
 the variable type

Public Member Functions

 Variable (void)
 default constructor
 Variable (const ST &value)
 constructor with a value
 Variable (const ST &value, const std::string &namestring, const std::string &symbolstring)
 constructor with a value, name and symbol strings
template<typename NU>
 Variable (const ST &value, const NU &)
 constructor with a value and a unit object
template<typename NU>
 Variable (const ST &value, const NU &, const std::string &namestring, const std::string &symbolstring)
 constructor with a value, a unit object, name and symbol strings
 Variable (const ST value, const std::string &unitsymbol)
 constructor from unit symbol given by std::string
 Variable (const ST value, const char *unitsymbol)
 constructor from unit symbol given by C-type string constant
template<template< typename, typename > class SM, typename SST>
 Variable (const SM< Quantity< QT, SST >, DQT > &quantity)
 copy constructor
template<template< typename, typename > class SM, typename SST, typename SSU, typename SDQT>
 Variable (const SM< Quantity< QT, SST >, DerivedQuantity< QT, SSU, SDQT > > &quantity)
 copy constructor from quantity with different unit or storage type (conversion)
template<template< typename, typename > class SM, typename SDIM, typename SST, typename SSU, typename SDQT>
 Variable (const SM< Quantity< GenericClass< SDIM >, SST >, DerivedQuantity< GenericClass< SDIM >, SSU, SDQT > > &quantity)
 copy constructor from quantity with different unit or storage type (conversion)
template<template< typename, typename > class SM, typename SQT, typename SST, typename SSU, typename SDQT>
 Variable (const SM< Quantity< SQT, SST >, DerivedQuantity< SQT, SSU, SDQT > > &quantity)
 copy constructor for some other quantity
template<typename SST>
 Variable (const Dynamic< SST > &dynamic)
 copy construction from Dynamic
Variable & operator= (const Variable &variable)
 assignment operator= from identical type
template<template< typename, typename > class SM, typename SST, typename SSU, typename SDQT>
Variable & operator= (const SM< Quantity< QT, SST >, DerivedQuantity< QT, SSU, SDQT > > &quantity)
 assignment operator= from same quantity type
template<typename SDIM, typename SST, typename SSU, typename SDQT>
Variable & operator= (const Variable< Quantity< GenericClass< SDIM >, SST >, DerivedQuantity< GenericClass< SDIM >, SSU, SDQT > > &quantity)
 assignment operator= from generated quantity
template<template< typename, typename > class SM, typename SQT, typename SST, typename SSU, typename SDQT>
Variable & operator= (const SM< Quantity< SQT, SST >, DerivedQuantity< SQT, SSU, SDQT > > &quantity)
 assignment operator = from type for which an explicit conversion exists
template<typename SST>
Variable & operator= (const Dynamic< SST > &dynamic)
 assignment operator= from Dynamic
Variable & operator= (const std::string &str)
 assignment from a std::string
Variable & operator= (const char *str)
 assignment from a C type string
template<typename T>
Variable & operator= (const T &)
 assignment operator= for prohibited types
ST value (void) const
 return the value in the storage unit;
ST standard_value (void) const
 return the value in the standard unit;
template<typename NU>
Variable< Quantity
< QT, ST >,
DerivedQuantity< QT,
NU, DQT > > 
value (const NU &) const
 return the value in a unit NU (conversion)
ST value (const std::string &symbol)
 return the value in a unit with symbol string symbolstring;
std::string unitsymbol (void) const
 return the storage unit symbol;
std::string unitname (void) const
 return the storage unit name;
Variable & operator+= (const Variable &variable)
 add and assign; operator+=
template<template< typename, typename > class M1, typename ST1, typename SU1, typename DQT1>
Variable & operator+= (const M1< Quantity< QT, ST1 >, DerivedQuantity< QT, SU1, DQT1 > > &quantity)
 add and assign; operator+=
template<template< typename, typename > class M1, typename DIM1, typename ST1, typename SU1, typename DQT1>
Variable & operator+= (const M1< Quantity< GenericClass< DIM1 >, ST1 >, DerivedQuantity< GenericClass< DIM1 >, SU1, DQT1 > > &quantity)
 add and assign; operator+=
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable & operator+= (const M1< Variable< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &quantity)
 add and assign; operator+=
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable operator+ (const M1< Quantity< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &quantity) const
 addition: binary operator+
template<typename SST>
Variable operator+ (const Dynamic< SST > &quantity) const
 addition: binary operator+
Variable & operator-= (const Variable &variable)
 subtract and assign; operator-=
template<template< typename, typename > class M1, typename ST1, typename SU1, typename DQT1>
Variable & operator-= (const M1< Quantity< QT, ST1 >, DerivedQuantity< QT, SU1, DQT1 > > &quantity)
 subtract and assign; operator-=
template<template< typename, typename > class M1, typename DIM1, typename ST1, typename SU1, typename DQT1>
Variable & operator-= (const M1< Quantity< GenericClass< DIM1 >, ST1 >, DerivedQuantity< GenericClass< DIM1 >, SU1, DQT1 > > &quantity)
 subtract and assign; operator-=
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable & operator-= (const M1< Quantity< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &quantity)
 subtract and assign; operator-=
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable operator- (const M1< Quantity< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &quantity) const
 subtraction: binary operator-
Variable operator- (const Dynamic< ST > &quantity) const
 subtraction: binary operator-
Variable & operator *= (const ST factor)
 operator*= for multiplication with ST and assignment
Variable operator * (const ST factor) const
 operator* for right hand multiplication with ST
template<typename RHSST>
Dynamic< RHSST > operator * (const Dynamic< RHSST > &rhs) const
 operator* for right hand multiplication with a Dynamic
template<template< typename, typename > class FM, typename FQT, typename FST, typename FSU, typename FDQT>
GenerateVariable< V,
FM< Quantity< FQT,
FST >,
DerivedQuantity
< FQT, FSU, FDQT >
> >::Add 
operator * (const FM< Quantity< FQT, FST >, DerivedQuantity< FQT, FSU, FDQT > > &factor) const
 multiplication of variables with a quantity
Variable & operator/= (const ST divisor)
 operator/= for division by ST and assignment
Variable operator/ (const ST divisor) const
 operator/ for division by ST
template<class Q>
GenerateVariable
< Variable, Q >::Sub 
operator/ (const Q &factor) const
 division of a variable by a quantity
const Variable operator+ (void) const
 unary operator+
const Variable operator- (void) const
 unary operator-; change sign
Variable & operator++ ()
 prefix increment: operator++
Variable & operator-- ()
 prefix decrement: operator--
const Variable operator++ (int)
 postfix increment: operator++
const Variable operator-- (int)
 postfix decrement: operator--
template<long N, long D>
GenerateVariable
< Variable,
BSUtilities::Rational
< N, D > >::Mult 
pow (const BSUtilities::Rational< N, D > &) const
 the pow function with static rational exponent
template<class T>
Dynamic< ST > pow (const T &exp) const
 the pow function with dynamic exponent
GenerateVariable
< Variable,
BSUtilities::Rational< 1,
2 > >::Mult 
sqrt (void) const
 the sqrt function
std::ostream & print_value (std::ostream &os) const
 print the value and the unit of the variable
void operator>> (std::string &str) const
 store the value and unit of the variable in a std::string
std::ostream & operator>> (std::ostream &os) const
 print the variable
void read_value (const std::string &str)
 read variable value and unit from a string
void operator<< (const std::string &str)
 read from string to the right of operator<<
std::istream & operator<< (std::istream &is)
 read from a std::istream to the right of operator<<
template<int I>
GenerateVariable
< Variable,
BSUtilities::Rational
< I, long(1 
pow (const typename Loki::Int2Type< I >) const )> >::Mult
 the pow function with static integer exponent

Static Public Member Functions

static std::string Unitsymbol (void)
 return the storage unit symbol;
static std::string Unitname (void)
 return the storage unit name;

Private Member Functions

template<typename Archive>
void serialize (Archive &ar, const unsigned int)
 serialization of Variable

Private Attributes

ST _value
 the value of the Variable

Friends

class boost::serialization::access
 allow access of boost::serialization library
template<template< typename, typename > class M1, typename ST1>
Variable operator+ (const Dynamic< ST1 > &quantity1, const M1< BQ, DerivedQuantity< QT, SU, DQT > > &quantity2)
 addition: binary operator+
template<template< typename, typename > class M1, typename ST1>
Variable operator- (const Dynamic< ST1 > &quantity1, const M1< BQ, DerivedQuantity< QT, SU, DQT > > &quantity2)
 subtraction: binary operator-
template<template< typename, typename > class Q>
V operator * (const ST factor, const Q< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &variable)
 operator* for left hand multiplication by FST
GenerateVariable
< Variable,
Loki::NullType >
::Inv 
operator/ (const ST numerator, const Variable &factor)
 division of a number by a variable
void operator>> (const std::string &str, Variable &variable)
 read from string to the left of operator>>
std::istream & operator>> (std::istream &is, Variable &variable)
 read from a std::istream to the left of operator>>

Classes

struct  Minus
 subtraction helper More...
struct  MinusGenerated
 subtraction helper More...
struct  Plus
 addition helper More...
struct  PlusGenerated
 addition helper More...


Detailed Description

template<typename QT, typename ST, typename SU, typename DQT>
class quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >

Variable: specialization.

version for base quantity being a Quantity; template parameters:

The Variable class is derived from the base quantity.

Definition at line 249 of file Variable.h.


Member Typedef Documentation

template<typename QT, typename ST, typename SU, typename DQT>
typedef QuantityTraits<QT>::Dimension quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::DIM

the dimension

taken from the quantity traits template

Definition at line 255 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
typedef QuantityTraits<QT>::UnitType quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::UT

the unit type

taken from the quantity traits template

Reimplemented from quantity::Quantity< QT, ST >.

Definition at line 260 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
typedef QuantityTraits<QT>::UnitList quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::UL

the unit list

taken from the quantity traits template

Reimplemented from quantity::Quantity< QT, ST >.

Definition at line 265 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
typedef QuantityTraits<QT>::DefaultUnit quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::DU

the default unit

taken from the quantity traits template

Reimplemented from quantity::Quantity< QT, ST >.

Definition at line 270 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
typedef unit::CheckUnit<unit::Unit<UT>, SU>::Check quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::StorageUnit

the storage unit

check the SU and if ok, make it known as Unit. StorageUnit is checked to be subclassed from Unit<UT>. This ensures that it (a) is a unit, (b) is a descendant of Unit<UT>, and (c) can be instantiated; since CheckUnit returns the test unit, this is typedef'ed for further use.

Definition at line 279 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
typedef Quantity<QT, ST> quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::BQ

the base quantity type

The Quantity which is the abstract base class for this quantity. It is used in other classes and must be public.

Definition at line 285 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
typedef Variable<BQ, DerivedQuantity<QT, SU, DQT> > quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::V

the variable type

the Variable itself

Definition at line 290 of file Variable.h.


Constructor & Destructor Documentation

template<typename QT, typename ST, typename SU, typename DQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( void   )  [inline]

default constructor

Set the value to 0 (or equivalent) in terms of storage type. It is assumed that this value is in the storage unit. The name and symbol strings on the base Quantity object are set according to the OverWrite instructions given in the DerivedQuantityTraits template.

Definition at line 312 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const ST &  value  )  [inline]

constructor with a value

Set the value to value (in storage type ST). It is assumed that this value is in the storage unit. The name and symbol strings on the base Quantity object are set according to the OverWrite instructions given in the DerivedQuantityTraits template.

Definition at line 322 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const ST &  value,
const std::string &  namestring,
const std::string &  symbolstring 
) [inline]

constructor with a value, name and symbol strings

Set the value to value (in storage type ST). It is assumed that the value is in the storage unit. The default name and symbol as defined by the QuantityTraits and DerivedQuantityTraits templates are overwritten by the name and symbol arguments. The qualifiers BQ:: for name() and symbol() are necessary to avoid gcc compiler errors.

Definition at line 333 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename NU>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const ST &  value,
const NU &   
) [inline]

constructor with a value and a unit object

Set the value to value (in storage type ST). The name and symbol strings on the base Quantity object are set according to the OverWrite instructions given in the DerivedQuantityTraits template. It is assumed that this value is in unit NU. It is converted into the storage unit. NU must be a member of the UnitList UL.

Definition at line 346 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename NU>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const ST &  value,
const NU &  ,
const std::string &  namestring,
const std::string &  symbolstring 
) [inline]

constructor with a value, a unit object, name and symbol strings

Set the value to value (in storage type ST). The default name and symbol as defined in BQ are overwritten by the name and symbol arguments. The name and symbol in the DerivedQuantityTraits traits template are not considered, even if the Overwrite bools are true. The qualifiers BQ:: for name() and symbol() are necessary to avoid gcc compiler errors. It is assumed that the value is in unit NU. It is converted into the storage unit. NU must be a member of the UnitList UL.

Definition at line 362 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const ST  value,
const std::string &  unitsymbol 
) [inline]

constructor from unit symbol given by std::string

takes a std:string defining the symbol of the unit as the second argument; the symbol is checked at run time and returned as a pointer to the base unit type UT; the unit object pointed to is later destroyed; the value is first dynamically standardized on the base of the unit determined, and then recalculated into the storage unit; first initializes base class; findBySymbol may throw a UnitMismatch exception. The name and symbol strings on the base Quantity object are set according to the OverWrite instructions given in the DerivedQuantityTraits template.

Definition at line 381 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const ST  value,
const char *  unitsymbol 
) [inline]

constructor from unit symbol given by C-type string constant

takes a const char * defining the symbol of the unit as the second argument; the symbol is checked at run time for dynamic access; the value is first standardized on the base of the unit determined, and recalculated into the storage unit; first initializes base class; findBySymbol may throw a UnitMismatch exception. The name and symbol strings of the base Quantity object are set according to the OverWrite instructions given in the DerivedQuantityTraits template.

Definition at line 401 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class SM, typename SST>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const SM< Quantity< QT, SST >, DQT > &  quantity  )  [inline]

copy constructor

copy from a source object of same base and derived quantity types; Initialize the base quantity BQ, then copy the value, the name and symbol string of variable. Any mode, works if copy construction between ST and SST works.

Definition at line 426 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class SM, typename SST, typename SSU, typename SDQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const SM< Quantity< QT, SST >, DerivedQuantity< QT, SSU, SDQT > > &  quantity  )  [inline]

copy constructor from quantity with different unit or storage type (conversion)

specialized version for same quantity type QT; then we can be sure that the value of the source quantity can be recalculated into the unit of the target Variable; the result of this calculation is used in an initializer. The name and the symbol of the quantity are copied in the body of the function. The form of SM<> must satisfy the template parameter sequence for a Variable or other classes similarly derived fom Quantity; this prohibits the conversion from general objects (string etc.).

Definition at line 443 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class SM, typename SDIM, typename SST, typename SSU, typename SDQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const SM< Quantity< GenericClass< SDIM >, SST >, DerivedQuantity< GenericClass< SDIM >, SSU, SDQT > > &  quantity  )  [inline]

copy constructor from quantity with different unit or storage type (conversion)

specialized version for a source quantity derived from Quantity with a unit list typical for a generated quantity using a GenericUnit; this special case is the only exception when a quantity of different base unit type can be converted into the target Variable, provided the dimensions of the two objects are equal. This is tested with CheckSecondDimension.

Definition at line 459 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class SM, typename SQT, typename SST, typename SSU, typename SDQT>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const SM< Quantity< SQT, SST >, DerivedQuantity< SQT, SSU, SDQT > > &  quantity  )  [inline]

copy constructor for some other quantity

this copy constructor only succeeds if the target quantity is a generated variable object, and the dimensions of the source and the target base quantities is identical. It allows copy construction of a generated variable from a commensurable source quantity. All other target quantities do not fit into this pattern, and in these cases, at compile time VariableError<true> is attempted to be instantiated, which never succeeds. Consequently, in these cases, a compile time error is emitted. Such a copy construction should only work, if a specialized version of a copy constructor is provided. !!!!!!!!!!!! describe: specialization needed for generated and other left hand side types !!!!!!

Definition at line 485 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename SST>
quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Variable ( const Dynamic< SST > &  dynamic  )  [inline]

copy construction from Dynamic

this copy constructor has to do run-time checking of the dimensional information in Dynamic; this is done through Dynamic's isCommensurable member function.

Definition at line 498 of file Variable.h.

References quantity::Dynamic< ST >::isCommensurable(), and quantity::Dynamic< ST >::value().


Member Function Documentation

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  variable  )  [inline]

assignment operator= from identical type

assignment from same type; comparison against self assignment is done by direct comparison of pointers; no need to convert values, since unit must be the same; raw value of new_variable is used, since no conversion into default unit is desired; only the variable value is assigned, name and symbol are not touched.

Definition at line 522 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class SM, typename SST, typename SSU, typename SDQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const SM< Quantity< QT, SST >, DerivedQuantity< QT, SSU, SDQT > > &  quantity  )  [inline]

assignment operator= from same quantity type

version for a base quantity of the same quantity type; template parameters:

used if the base quantity of the source (right hand side) and target (left hand side) quantity are identical except for possibly the storage type. We can be sure that the value of the source can be recalculated into the unit of the target, as long as the storage types are compatible. The source quantity can be of any mode SM. The form of SM must satisfy the template parameter sequence for a derived quantity. Since the two objects are of different type, there is no need to test for self-assignment. The value of the source in the storage unit is extracted, transformed into the standardized value, and then converted into the unit of the target quantity, and the result is stored. Only the _value is assigned, name and symbol of the target variable are not touched.

Definition at line 553 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename SDIM, typename SST, typename SSU, typename SDQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const Variable< Quantity< GenericClass< SDIM >, SST >, DerivedQuantity< GenericClass< SDIM >, SSU, SDQT > > &  quantity  )  [inline]

assignment operator= from generated quantity

version for a source quantity with a base quantity characterized by a GenericClass<> quantity type. template parameters:

SM should always be Variable, and SDQT should always be characterized by a quantity type GenericClass<SDIM>.

This special case is an exception when a quantity of different type can be assigned to the target Variable, provided the dimensions of the two objects are equal. This is tested with CheckSecondDimension. Note, that the call to Standardize<>::VAL() has no numerical effect, since the standardization ratio of the unit for a generated quantity is always equal to unity.

Since the two objects are of different type, there is no need to test for self-assignment. The value of the source quantity in the storage unit is extracted, converted into the unit of the present object, and the result is stored. Only the _value is assigned, name and symbol of the present variable are not touched.

Definition at line 588 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class SM, typename SQT, typename SST, typename SSU, typename SDQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const SM< Quantity< SQT, SST >, DerivedQuantity< SQT, SSU, SDQT > > &  quantity  )  [inline]

assignment operator = from type for which an explicit conversion exists

version for quantity with a different quantity type SQT; template parameters:

This assignment succeeds for special cases, where particular specializations for the conversion by copy construction are provided. If such a conversion does not exist, the copy constructor can not be instantiated and a VariableError<true> message is provided. If the conversion exists, a transient object of the left hand side type is assigned to the left hand side object.

Definition at line 617 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename SST>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const Dynamic< SST > &  dynamic  )  [inline]

assignment operator= from Dynamic

version for assignment from a Dynamic quantity as source quantity. template paranmeter:

This assignment operator has to do run-time checking of the dimensional information in Dynamic; this is done by using Dynamic's member function isCommensurable.

Definition at line 632 of file Variable.h.

References quantity::Dynamic< ST >::isCommensurable(), and quantity::Dynamic< ST >::value().

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const std::string &  str  )  [inline]

assignment from a std::string

this function forwards argument str to read_value, where it is converted into value and a unit, which is checked. Assumes that name, symbol, and equal sign are present, if requested by the ReadStatus.

Definition at line 645 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const char *  str  )  [inline]

assignment from a C type string

this function forwards argument str to read_value, where it is converted into value and a unit, which is checked. Assumes that name, symbol, and equal sign are present, if requested by the ReadStatus.

Definition at line 652 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename T>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator= ( const T &   )  [inline]

assignment operator= for prohibited types

All types T used for arguments to an assignment to Variable should be prohibited, if not handled above. Thus, this most general assignment operator is declared but never defined. Trying to assign from any object which is not given above, produces a compile time error. This is needed to prohibit assignment from a char, but also forbids assignment from double, int etc. While it might be desired to be able to make such an assignment by assuming the default unit attached to the number, missing of such a feature supports the notion that within quantity calculus a number should never be used without a unit.

template<typename QT, typename ST, typename SU, typename DQT>
ST quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::value ( void   )  const [inline, virtual]

return the value in the storage unit;

The stored _value is returned without recalculation.

Implements quantity::Quantity< QT, ST >.

Definition at line 680 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
ST quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::standard_value ( void   )  const [inline, virtual]

return the value in the standard unit;

The stored _value is standardized using the Standardize () function for the storage unit

Implements quantity::Quantity< QT, ST >.

Definition at line 686 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename NU>
Variable<Quantity<QT, ST>, DerivedQuantity<QT, NU, DQT> > quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::value ( const NU &   )  const [inline]

return the value in a unit NU (conversion)

The value is returned in a variable object with storage unit NU. The stored _value is first standardized using the Standardize () function for the storage unit, and then converted into NU, which is checked against AllUnits; only the type of NU is used. The storage type of the return variable is ST.

Definition at line 697 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
ST quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::value ( const std::string &  symbol  )  [inline]

return the value in a unit with symbol string symbolstring;

The string is checked at run time, this allows dynamic access. Consequently, when supplying an incorrect string for the symbol, this can not be detected at compile time, but only at run time. The stored _value is first standardized using the Standardize () function for the storage unit, and then recalculated into the unit found with findBySymbol. The allocated object pointed to by unitp is deleted. If symbol is not found by findBySymbol, a UnitMismatch exception is thrown.

Definition at line 712 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
std::string quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::unitsymbol ( void   )  const [inline, virtual]

return the storage unit symbol;

the symbol is interrogated from the storage unit; dynamic access.

Implements quantity::Quantities.

Definition at line 727 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
static std::string quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Unitsymbol ( void   )  [inline, static]

return the storage unit symbol;

the symbol is interrogated from the storage unit; static access.

Definition at line 732 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
std::string quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::unitname ( void   )  const [inline, virtual]

return the storage unit name;

the name is interrogated from the storage unit; dynamic access.

Implements quantity::Quantities.

Definition at line 737 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
static std::string quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::Unitname ( void   )  [inline, static]

return the storage unit name;

the name is interrogated from the storage unit; static access.

Definition at line 742 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+= ( const Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  variable  )  [inline]

add and assign; operator+=

for two identical Variables; Dimensions are not checked, since the base quantity ensures that they must be the same, as defined by the QuantityTraits template QT. In order to avoid assignment to a generated Variable object, it is checked if the unit list UL of the target quantity is identical to a unit list of a generated quantity. If that is the case, the target is a generated quantity object. Then, the compiler tries to instantiate AssignmentError<true>, which is not defined. Thus, a compiler error message occurs. If UL is different, i.e. the target is not a generated Variable, AssignmentError<false> is instantiated, its RET member is true, and the += operation is performed. The operator can be chained as in a += b += c.

Definition at line 767 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename ST1, typename SU1, typename DQT1>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+= ( const M1< Quantity< QT, ST1 >, DerivedQuantity< QT, SU1, DQT1 > > &  quantity  )  [inline]

add and assign; operator+=

version for operands being derived from the same base quantity; template parameters:

Definition at line 794 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename DIM1, typename ST1, typename SU1, typename DQT1>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+= ( const M1< Quantity< GenericClass< DIM1 >, ST1 >, DerivedQuantity< GenericClass< DIM1 >, SU1, DQT1 > > &  quantity  )  [inline]

add and assign; operator+=

version for a right hand side operand which is a quantity with a base quantity characterized by a GenericClass<> quantity type. template parameters:

Value of both operands recalculated into standard unit, reverse standardization of the result before stored in _value. During the standardization of the right hand side value, commensurability is checked with CheckSecondDimension. Note, that the standardization ratio of the right hand side generated object is always unity. The operator can be chained as in a -= b -= c.

Definition at line 821 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+= ( const M1< Variable< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &  quantity  )  [inline]

add and assign; operator+=

version for two quantities from different base quantities where the second is NOT a generated quantity; template parameters:

The case of QT and QT1 being the same type is handled by the more specialized versions of operator= above. Thus, if trying to instantiate, QT and QT1 are always different, and SameType<>::sameType is false. The IF construct tries to instantiate DimensionError<true> which is never defined. Consequently, this member function should never be instantiated correctly. Return is only for syntactic correctness.

Definition at line 852 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+ ( const M1< Quantity< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &  quantity  )  const [inline]

addition: binary operator+

takes any right hand side quantity object and decides (at compile time) which of the helper structure static exec member functions should be used, based on the type of its unit, i.e. if this is typical for a generated quantity object or not. Commensurability is checked in the helper functions.

Definition at line 901 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename SST>
Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+ ( const Dynamic< SST > &  quantity  )  const [inline]

addition: binary operator+

handles the case of addition of a Dynamic object on the right hand side of the operator; this is converted into an object of the left hand side type; this is only successful at run time, if the Dynamic object is commensurate; failure is indicated by a DimensionMismatch exception; finally addition is forwarded to the `generic' addition operator above.

Definition at line 920 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator-= ( const Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  variable  )  [inline]

subtract and assign; operator-=

for two identical Variables; Dimensions are not checked, since the base quantity ensures that they must be the same, as defined by the QuantityTraits template QT. In order to avoid assignment to a generated Variable object, it is checked if the unit list UL of the target quantity is identical to a unit list of a generated quantity. If that is the case, the target is a generated quantity object. Then, the compiler tries to instantiate AssignmentError<true>, which is not defined. Thus, a compiler error message occurs. If UL is different, i.e. the target is not a generated Variable, AssignmentError<false> is instantiated, its RET member is true, and the -= operation is performed. The operator can be chained as in a -= b -= c.

Definition at line 956 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename ST1, typename SU1, typename DQT1>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator-= ( const M1< Quantity< QT, ST1 >, DerivedQuantity< QT, SU1, DQT1 > > &  quantity  )  [inline]

subtract and assign; operator-=

version for operands being derived from the same base quantity; template parameters:

Definition at line 983 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename DIM1, typename ST1, typename SU1, typename DQT1>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator-= ( const M1< Quantity< GenericClass< DIM1 >, ST1 >, DerivedQuantity< GenericClass< DIM1 >, SU1, DQT1 > > &  quantity  )  [inline]

subtract and assign; operator-=

version for a right hand side operand which is a quantity with a base quantity characterized by a GenericClass<> quantity type. template parameters:

Value of both operands recalculated into standard unit, reverse standardization of the result before stored in _value. During the standardization of the right hand side value, commensurability is checked with CheckSecondDimension. Note, that the standardization ratio of the right hand side generated object is always unity. The operator can be chained as in a -= b -= c.

Definition at line 1011 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator-= ( const M1< Quantity< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &  quantity  )  [inline]

subtract and assign; operator-=

version for two quantities from different base quantities where the second is NOT a generated quantity; template parameters:

The case of QT and QT1 being the same type is handled by the more specialized versions of operator= above. Thus, if trying to instantiate, QT and QT1 are always different, and SameType<>::sameType is false. The IF construct tries to instantiate DimensionError<true> which is never defined. Consequently, this member function should never be instantiated correctly. Return is only for syntactic correctness.

Definition at line 1042 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename QT1, typename ST1, typename SU1, typename DQT1>
Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator- ( const M1< Quantity< QT1, ST1 >, DerivedQuantity< QT1, SU1, DQT1 > > &  quantity  )  const [inline]

subtraction: binary operator-

takes any right left side quantity object and decides (at compile time) which of the helper structure static exec member functions should be used, based on the type of its unit, i.e. if this is typical for a generated quantity object or not. Commensurability is checked in the helper functions.

Definition at line 1090 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator- ( const Dynamic< ST > &  quantity  )  const [inline]

subtraction: binary operator-

handles the case of addition of a Dynamic object on the right hand side of the operator; this is converted into an object of the left hand side type; this is only successful at run time, if the Dynamic object is commensurate; failure is indicated by a DimensionMismatch exception; finally addition is forwarded to the `generic' addition operator above.

Definition at line 1108 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator *= ( const ST  factor  )  [inline]

operator*= for multiplication with ST and assignment

only right hand side ST makes sense, since the product can not be assigned to a ST in general

Definition at line 1133 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator * ( const ST  factor  )  const [inline]

operator* for right hand multiplication with ST

generates new object; can be chained as in a * b * c;

Definition at line 1141 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename RHSST>
Dynamic<RHSST> quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator * ( const Dynamic< RHSST > &  rhs  )  const [inline]

operator* for right hand multiplication with a Dynamic

this function uses the right hand side Dynamic as the left hand side object for a multiplication with a Dynamic on the left hand side.

Definition at line 1151 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class FM, typename FQT, typename FST, typename FSU, typename FDQT>
GenerateVariable<V, FM<Quantity<FQT, FST>, DerivedQuantity<FQT, FSU, FDQT> > >::Add quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator * ( const FM< Quantity< FQT, FST >, DerivedQuantity< FQT, FSU, FDQT > > &  factor  )  const [inline]

multiplication of variables with a quantity

the type of the result is generated through GenerateVariable by adding the dimensions of the two quantities;

Definition at line 1181 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator/= ( const ST  divisor  )  [inline]

operator/= for division by ST and assignment

only right hand side ST makes sense, since the result of this operation with a left hand side ST can not be assigned to a ST in general

Definition at line 1193 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator/ ( const ST  divisor  )  const [inline]

operator/ for division by ST

generates new object; can be chained as in a * b / c;

Definition at line 1201 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<class Q>
GenerateVariable<Variable, Q>::Sub quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator/ ( const Q factor  )  const [inline]

division of a variable by a quantity

the type of the result is generated through GenerateVariable by subtracting the dimensions of the two quantities; only GenerateVariable with two quantities as arguments does have an Sub typedef, thus, Q does not need to be specified.

Definition at line 1214 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
const Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator+ ( void   )  const [inline]

unary operator+

returns a const temporary object of same type and same value. const qualifier prevents misuse of returned temporary

Definition at line 1237 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
const Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator- ( void   )  const [inline]

unary operator-; change sign

returns a const temporary object of same type and same value with changed sign. const qualifier prevents misuse of returned temporary

Definition at line 1244 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator++ (  )  [inline]

prefix increment: operator++

increments the value; returns the object itself, see Dryhurst, 2004

Definition at line 1251 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
Variable& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator-- (  )  [inline]

prefix decrement: operator--

decrements the value; returns the object itself, see Dryhurst, 2004

Definition at line 1260 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
const Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator++ ( int   )  [inline]

postfix increment: operator++

increments the value; dummy integer argument; returns a temprary copy of the object itself - before incrementing, see Dryhurst, 2004; const qualifier prevents misuse of returned temporary

Definition at line 1270 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
const Variable quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator-- ( int   )  [inline]

postfix decrement: operator--

decrements the value; dummy integer argument returns a temporary copy of the object itself - before decrementing, see Dryhurst, 2004; const qualifier prevents misuse of returned temporary

Definition at line 1281 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<long N, long D>
GenerateVariable<Variable, BSUtilities::Rational<N, D> >::Mult quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::pow ( const BSUtilities::Rational< N, D > &   )  const [inline]

the pow function with static rational exponent

returns a transient variable with the dimension of the first argument multiplied by Rational<N, D>; standardized value to be used, since the transient variable assumes a standardization factor of unity. used as object.pow (r);

Definition at line 1351 of file Variable.h.

References quantity::pow().

template<typename QT, typename ST, typename SU, typename DQT>
template<class T>
Dynamic<ST> quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::pow ( const T &  exp  )  const [inline]

the pow function with dynamic exponent

returns a transient Dynamic variable with the dimensions of the first argument multiplied by exp; used as object.pow (r); forwards action to pow function with quantity and dynamic exponent (static functions in Dynamic for specific T's).

Definition at line 1376 of file Variable.h.

References quantity::pow().

template<typename QT, typename ST, typename SU, typename DQT>
GenerateVariable<Variable, BSUtilities::Rational<1, 2> >::Mult quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::sqrt ( void   )  const [inline]

the sqrt function

returns a transient variable with the dimension of the first argument multiplied by 0.5; standardized value to be used, since the transient variable assumes a standardization factor of unity. used as object.sqrt ();

Definition at line 1389 of file Variable.h.

References quantity::sqrt().

template<typename QT, typename ST, typename SU, typename DQT>
std::ostream& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::print_value ( std::ostream &  os  )  const [inline, virtual]

print the value and the unit of the variable

places these items on the ostream os and returns the reference to the os object, thus allowing chaining of operator<< calls.

Implements quantity::Quantity< QT, ST >.

Definition at line 1408 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
void quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator>> ( std::string &  str  )  const [inline, virtual]

store the value and unit of the variable in a std::string

converts to a string by template Conversion

Implements quantity::Quantity< QT, ST >.

Definition at line 1414 of file Variable.h.

References BSUtilities::Conversion< T >::to_string().

template<typename QT, typename ST, typename SU, typename DQT>
std::ostream& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator>> ( std::ostream &  os  )  const [inline, virtual]

print the variable

used if the variable is placed to the left of operator>>; calls print_value () indirectly through Quantity<>::print, thus including name and symbol of quantity if requested.

Implements quantity::Quantity< QT, ST >.

Definition at line 1422 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
void quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::read_value ( const std::string &  str  )  [inline]

read variable value and unit from a string

central function for all input functions.

read_value implementation: important note: if a name is to be read, a corresponding string token has to be present, similar for symbol!

Definition at line 1494 of file Variable.h.

References RS, and BSUtilities::Conversion< T >::string_to().

template<typename QT, typename ST, typename SU, typename DQT>
void quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator<< ( const std::string &  str  )  [inline]

read from string to the right of operator<<

Definition at line 1438 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
std::istream& quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::operator<< ( std::istream &  is  )  [inline]

read from a std::istream to the right of operator<<

creates an intermediary string into which the data are read which are subsequently interpreted with read_value; the reference to the istream object is returned to allow chaining.

Definition at line 1445 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<typename Archive>
void quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::serialize ( Archive &  ar,
const unsigned  int 
) [inline, private]

serialization of Variable

uses boost::serialization

Reimplemented from quantity::Quantity< QT, ST >.

Definition at line 1472 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<int I>
GenerateVariable<Variable, BSUtilities::Rational<I, long(1 quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::pow ( const typename Loki::Int2Type< I >   )  const [inline]

the pow function with static integer exponent

returns a transient variable with the dimension of the first argument multiplied by I; standardized value to be used, since the transient variable assumes a standardization factor of unity. used as object.pow (r);

Definition at line 1365 of file Variable.h.

References quantity::pow().


Friends And Related Function Documentation

template<typename QT, typename ST, typename SU, typename DQT>
friend class boost::serialization::access [friend]

allow access of boost::serialization library

Reimplemented from quantity::Quantity< QT, ST >.

Definition at line 1466 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename ST1>
Variable operator+ ( const Dynamic< ST1 > &  quantity1,
const M1< BQ, DerivedQuantity< QT, SU, DQT > > &  quantity2 
) [friend]

addition: binary operator+

handles the case of addition of a Dynamic object on the left hand side of the operator; this is converted into a Variable object of the right hand side type, which is only successful, if the Dynamic object is commensurate; finally addition is forwarded to the `generic' addition operator above; must be friend of the Variable class, since the first argument is not a Variable.

Definition at line 935 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class M1, typename ST1>
Variable operator- ( const Dynamic< ST1 > &  quantity1,
const M1< BQ, DerivedQuantity< QT, SU, DQT > > &  quantity2 
) [friend]

subtraction: binary operator-

handles the case of addition of a Dynamic object on the left hand side of the operator; this is converted into a Variable object of the right hand side type, which is only successful, if the Dynamic object is commensurate; finally addition is forwarded to the `generic' addition operator above; must be friend of the Variable class, since the first argument is not a Variable.

Definition at line 1123 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
template<template< typename, typename > class Q>
V operator * ( const ST  factor,
const Q< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  variable 
) [friend]

operator* for left hand multiplication by FST

generates new object to be returned; due to promotion and conversions, this may also work for factors with a type different !!!!!!!! adapt documentation !!!!!!!!!!!!!!!! !!!!!!!! allow different factor ST by defining various specialized versions !!!!!!!!!!!!!!! from ST, as long as it can be matched; out of class declaration without friend does not work with factor type different from storage type, since in that case first the template argument ST is deduced from the first function argument, and 'this deduction does not consider ... conversions' (Vandevoorde/Josuttis, p. 489); second argument can be quantity object of any mode.

Definition at line 1169 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
GenerateVariable<Variable, Loki::NullType>::Inv operator/ ( const ST  numerator,
const Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  factor 
) [friend]

division of a number by a variable

the type of the result is generated through GenerateVariable by negating the dimension of the variable;

Definition at line 1226 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
void operator>> ( const std::string &  str,
Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  variable 
) [friend]

read from string to the left of operator>>

must be a friend to have std::string as the type of the first object

Definition at line 1434 of file Variable.h.

template<typename QT, typename ST, typename SU, typename DQT>
std::istream& operator>> ( std::istream &  is,
Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > > &  variable 
) [friend]

read from a std::istream to the left of operator>>

must be a friend to have std::istream & as the type of the first object; uses read from istream to the right of operator<<.

Definition at line 1454 of file Variable.h.


Member Data Documentation

template<typename QT, typename ST, typename SU, typename DQT>
ST quantity::Variable< Quantity< QT, ST >, DerivedQuantity< QT, SU, DQT > >::_value [private]

the value of the Variable

The value is stored in the storage unit and in an object of the storage type ST. This data member is private, and can only be accessed through member functions value ().

Definition at line 298 of file Variable.h.


The documentation for this class was generated from the following file:
Generated on Mon Jul 27 15:55:47 2009 for Quantities by  doxygen 1.5.3