Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU > Class Template Reference

a vector of variables More...

#include <QuantityCluster.h>

List of all members.

Public Types

typedef Variable< Quantity<
GT, Loki::Typelist< Head,
Tail >, DU, ST >, SU > 
V
 the Variable

typedef SU Unit
 the storage unit


Public Member Functions

 VariableVector (void)
 default constructor

template<class NU>  VariableVector (const VariableVector< PQ, NU > &new_vector)
 copy constructor from different unit (conversion)

int length (void) const
 return the number of elements

template<template< class, class > class Q1, class GT1, class Head1, class Tail1, class DU1, class SU1, class ST1> void add (const Q1< Quantity< GT1, Loki::Typelist< Head1, Tail1 >, DU1, ST1 >, SU1 > &new_quantity)
 add a new element to the vector

template<template< class, class > class Q1, class GT1, class Head1, class Tail1, class DU1, class SU1, class ST1> void add (const Q1< Quantity< GT1, Loki::Typelist< Head1, Tail1 >, DU1, ST1 >, SU1 > &new_quantity, const int index)
 add a new element to the vector at position index

template<template< class, class > class Q1, class GT1, class Head1, class Tail1, class DU1, class SU1, class ST1> void replace (const Q1< Quantity< GT1, Loki::Typelist< Head1, Tail1 >, DU1, ST1 >, SU1 > &new_quantity, const int index)
 replace an element in the vector at position index

void remove (const int index)
 remove the element at position index

void clear (void)
 clear all elements from vector

value (const int index) const
 return the value located in the VariableVector at index

operator[] (const int index) const
 return the value located in the VariableVector at index

template<class NU> Variable< Quantity< GT, Loki::Typelist<
Head, Tail >, DU, ST >, NU > 
value (const int index, const NU &unit) const
 return the value located in the VariableVector at index in unit NU

max (void) const
 return maximum

template<class NU> Variable< Quantity< GT, Loki::Typelist<
Head, Tail >, DU, ST >, NU > 
max (const NU &unit) const
 return maximum in unit NU

min (void) const
 return minimum

template<class NU> Variable< Quantity< GT, Loki::Typelist<
Head, Tail >, DU, ST >, NU > 
min (const NU &unit) const
 return minimum in unit NU


Protected Attributes

std::vector< ST > values
 the storage vector


Private Types

typedef Units::CheckUnit<
Units::Unit< GT, ST >, SU
>::Check 
Checked
 check the unit SU

typedef Quantity< GT, Loki::Typelist<
Head, Tail >, DU, ST > 
PQ
 the parent quantity type


Detailed Description

template<class GT, class Head, class Tail, class DU, class SU, class ST>
class Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >

a vector of variables

specialization for PQ being a Quantity. the elements of the quantity vector are stored as a vector values of objects of type ST.

Definition at line 94 of file QuantityCluster.h.


Member Function Documentation

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<template< class, class > class Q1, class GT1, class Head1, class Tail1, class DU1, class SU1, class ST1>
void Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::add const Q1< Quantity< GT1, Loki::Typelist< Head1, Tail1 >, DU1, ST1 >, SU1 > &  new_quantity,
const int  index
[inline]
 

add a new element to the vector at position index

this element can be a quantity based on the parent quantity PQ; its value is recalculated into the storage unit SU of the vector; range checked.

Definition at line 174 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<template< class, class > class Q1, class GT1, class Head1, class Tail1, class DU1, class SU1, class ST1>
void Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::add const Q1< Quantity< GT1, Loki::Typelist< Head1, Tail1 >, DU1, ST1 >, SU1 > &  new_quantity  )  [inline]
 

add a new element to the vector

this element can be a quantity based on the parent quantity PQ; its value is recalculated into the storage unit USU of the vector; it is appended at the end of the vector.

Definition at line 156 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
int Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::length void   )  const [inline]
 

return the number of elements

The length function returns an integer which gives the number of elements in the vector. This is calculated using the STL vector function size().

Definition at line 147 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<class NU>
Variable<Quantity<GT, Loki::Typelist<Head, Tail>, DU, ST>, NU> Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::max const NU &  unit  )  const [inline]
 

return maximum in unit NU

calculate the maximum of the values stored in the vector, convert into NU and return in an appropriate object

Definition at line 281 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
V Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::max void   )  const [inline]
 

return maximum

calculate the maximum of the values stored in the vector and return it in an object of type V

Definition at line 264 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<class NU>
Variable<Quantity<GT, Loki::Typelist<Head, Tail>, DU, ST>, NU> Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::min const NU &  unit  )  const [inline]
 

return minimum in unit NU

calculate the minimum of the values stored in the vector, convert into NU and return in an appropriate object

Definition at line 304 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
V Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::min void   )  const [inline]
 

return minimum

calculate the minimum of the values stored in the vector and return it in an object of type V

Definition at line 287 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
V Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::operator[] const int  index  )  const [inline]
 

return the value located in the VariableVector at index

read access to one element in the VariableVector; uses value (index).

Definition at line 248 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
void Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::remove const int  index  )  [inline]
 

remove the element at position index

range checked.

Definition at line 219 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<template< class, class > class Q1, class GT1, class Head1, class Tail1, class DU1, class SU1, class ST1>
void Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::replace const Q1< Quantity< GT1, Loki::Typelist< Head1, Tail1 >, DU1, ST1 >, SU1 > &  new_quantity,
const int  index
[inline]
 

replace an element in the vector at position index

this element can be a quantity based on the parent quantity PQ; its value is recalculated into the storage unit Unit of the vector; range checked.

Definition at line 199 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<class NU>
Variable<Quantity<GT, Loki::Typelist<Head, Tail>, DU, ST>, NU> Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::value const int  index,
const NU &  unit
const [inline]
 

return the value located in the VariableVector at index in unit NU

use value (index) and convert the result into NU; the conversion routine between variables checks that NU is available in the unit list.

Definition at line 257 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
V Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::value const int  index  )  const [inline]
 

return the value located in the VariableVector at index

alternative to operator[]; used by operator[]; range checked.

Definition at line 237 of file QuantityCluster.h.

template<class GT, class Head, class Tail, class DU, class SU, class ST>
template<class NU>
Quantities::VariableVector< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >, SU >::VariableVector const VariableVector< PQ, NU > &  new_vector  )  [inline]
 

copy constructor from different unit (conversion)

reserves a std::vector<ST> of same length as the vector in the new_vector object, and fills it with the elements of new_vector converted to the storage unit of the present variable vector, SU; the conversion routine checks that NU is appropriate.

Definition at line 132 of file QuantityCluster.h.


The documentation for this class was generated from the following file:
Generated on Sun Jan 15 13:58:00 2006 for Quantity by doxygen 1.3.6