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

quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU > Class Template Reference

a vector of variables More...

#include <QuantityCluster.h>

Inheritance diagram for quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >:

quantity::QuantityVector< Quantity< DIM, BT, UL, DU, ST > > List of all members.

Public Types

typedef Quantity< DIM, BT,
UL, DU, ST > 
PQ
 the parent quantity type

typedef Variable< Quantity<
DIM, BT, UL, 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)

void save (BSUtilities::xmlw::XmlStream &os) const
 save a QuantityVector to XML

void load (const TiXmlHandle node)
 load a QuantityVector from XML

bool operator== (const VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU > &vector) const
 equality

int size (void) const
 return the number of elements

template<template< class, class > class Q1, class BT1, class DIM1, class UL1, class DU1, class SU1, class ST1> void push_back (const Q1< Quantity< DIM1, BT1, UL1, DU1, ST1 >, SU1 > &new_quantity)
 add a new element at the end of the vector

template<template< class, class > class Q1, class BT1, class DIM1, class UL1, class DU1, class SU1, class ST1> void insert (const Q1< Quantity< DIM1, BT1, UL1, 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 BT1, class DIM1, class UL1, class DU1, class SU1, class ST1> void replace (const Q1< Quantity< DIM1, BT1, UL1, DU1, ST1 >, SU1 > &new_quantity, const int index)
 replace an element in the vector at position index

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

void clear (void)
 clear all elements from vector

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

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

template<class NU> Variable< Quantity< DIM, BT,
UL, DU, ST >, NU > 
value (const int index, const NU &unit) const
 return the value located in the VariableVector at index in unit NU

V max (void) const
 return maximum

template<class NU> Variable< Quantity< DIM, BT,
UL, DU, ST >, NU > 
max (const NU &unit) const
 return maximum in unit NU

V min (void) const
 return minimum

template<class NU> Variable< Quantity< DIM, BT,
UL, DU, ST >, NU > 
min (const NU &unit) const
 return minimum in unit NU


Static Public Attributes

const std::string ID = "Variable"
 definition of xml VariableVector ID


Protected Attributes

std::vector< ST > values
 the storage vector


Private Types

typedef unit::CheckUnit< unit::Unit<
BT >, SU >::Check 
Check
 check the unit SU


Detailed Description

template<class BT, class DIM, class UL, class DU, class SU, class ST>
class quantity::VariableVector< Quantity< DIM, BT, UL, 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 130 of file QuantityCluster.h.


Member Typedef Documentation

template<class BT, class DIM, class UL, class DU, class SU, class ST>
typedef unit::CheckUnit<unit::Unit<BT>, SU>::Check quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::Check [private]
 

check the unit SU

Definition at line 135 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
typedef Quantity<DIM, BT, UL, DU, ST> quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::PQ
 

the parent quantity type

Definition at line 139 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
typedef SU quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::Unit
 

the storage unit

Definition at line 145 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
typedef Variable<Quantity<DIM, BT, UL, DU, ST>, SU> quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::V
 

the Variable

Definition at line 142 of file QuantityCluster.h.

Referenced by max(), min(), operator[](), and value().


Member Function Documentation

template<class BT, class DIM, class UL, class DU, class SU, class ST>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::clear void   )  [inline]
 

clear all elements from vector

Definition at line 337 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::erase const int  index  )  [inline]
 

erase the element at position index

range checked; forwards to the std::vector erase function

Definition at line 324 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<template< class, class > class Q1, class BT1, class DIM1, class UL1, class DU1, class SU1, class ST1>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::insert const Q1< Quantity< DIM1, BT1, UL1, 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; uses std::vector function insert.

Definition at line 279 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::load const TiXmlHandle  node  )  [inline]
 

load a QuantityVector from XML

uses TinyXml; an element is extracted from the TiXmlHandle, and checked for (1) non-null element pointer (2) the name of the element (must be a quantity vector) (3) the value of the ID variable (must be Variable) Subsequently, the child nodes of the element are searched for data elements. If found, the data text is converted into the storage unit and appended to the values vector.

Definition at line 207 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<class NU>
Variable<Quantity<DIM, BT, UL, DU, ST>, NU> quantity::VariableVector< Quantity< DIM, BT, UL, 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 386 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
V quantity::VariableVector< Quantity< DIM, BT, UL, 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 369 of file QuantityCluster.h.

References V.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<class NU>
Variable<Quantity<DIM, BT, UL, DU, ST>, NU> quantity::VariableVector< Quantity< DIM, BT, UL, 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 409 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
V quantity::VariableVector< Quantity< DIM, BT, UL, 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 392 of file QuantityCluster.h.

References V.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
bool quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::operator== const VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU > &  vector  )  const [inline]
 

equality

compares the size of the two values vectors and their contents

Definition at line 240 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
V quantity::VariableVector< Quantity< DIM, BT, UL, 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 353 of file QuantityCluster.h.

References V.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<template< class, class > class Q1, class BT1, class DIM1, class UL1, class DU1, class SU1, class ST1>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::push_back const Q1< Quantity< DIM1, BT1, UL1, DU1, ST1 >, SU1 > &  new_quantity  )  [inline]
 

add a new element at the end of 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; uses std::vector push_back function.

Definition at line 262 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<template< class, class > class Q1, class BT1, class DIM1, class UL1, class DU1, class SU1, class ST1>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::replace const Q1< Quantity< DIM1, BT1, UL1, 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; this is a function which is not available in std::vector.

Definition at line 305 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
void quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::save BSUtilities::xmlw::XmlStream &  os  )  const [inline]
 

save a QuantityVector to XML

write the relevant information of the QuantityVector object to a stream in XML format; these are: (1) the type of Quantity (i.e., Variable, etc.) (2) the default name of the Quantity (3) the name of the storage unit (4) the data itself Should we save the storage type?

Definition at line 182 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
int quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::size void   )  const [inline]
 

return the number of elements

The size 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 252 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<class NU>
Variable<Quantity<DIM, BT, UL, DU, ST>, NU> quantity::VariableVector< Quantity< DIM, BT, UL, 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 362 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
V quantity::VariableVector< Quantity< DIM, BT, UL, 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 342 of file QuantityCluster.h.

References V.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
template<class NU>
quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::VariableVector const VariableVector< PQ, NU > &  new_vector  )  [inline]
 

copy constructor from different unit (conversion)

reserves a std::vector<ST> of same size 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 162 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::VariableVector void   )  [inline]
 

default constructor

Definition at line 153 of file QuantityCluster.h.


Member Data Documentation

template<class BT, class DIM, class UL, class DU, class SU, class ST>
const std::string quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::ID = "Variable" [static]
 

definition of xml VariableVector ID

must be defined outside of class.

Definition at line 421 of file QuantityCluster.h.

template<class BT, class DIM, class UL, class DU, class SU, class ST>
std::vector<ST> quantity::VariableVector< Quantity< DIM, BT, UL, DU, ST >, SU >::values [protected]
 

the storage vector

Definition at line 149 of file QuantityCluster.h.


The documentation for this class was generated from the following file:
Generated on Sun Jan 15 14:05:22 2006 for Quantity by doxygen 1.3.6