#include <Quantity.h>
Inheritance diagram for Quantities::Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST >:
Public Types | |
typedef Dimensions::Dimension< GT > | D |
make the Dimension available | |
typedef GT | Type |
make the type available | |
typedef ST | SType |
make the storage type available | |
typedef AllUnits< GT, Loki::Typelist< Head, Tail >, ST > | AllUnits |
make all units in UL known | |
typedef DefaultUnit< GT, DU, ST > | DefaultUnit |
make the default unit known | |
Public Member Functions | |
Quantity (void) | |
default constructor | |
virtual | ~Quantity (void) |
destructor | |
std::string | name (void) const |
return the name as a std::string | |
std::string | symbol (void) const |
return the symbol as a std::string | |
void | name (const std::string &name) |
set the name from a std::string | |
void | symbol (const std::string &symbol) |
set the symbol as a std::string | |
virtual ST | standard_value (void) const=0 |
return the value in the standard unit | |
virtual ST | value (void) const=0 |
return the value in the storage unit | |
const bool | isDimensionless (void) const |
return whether the quantity is dimensionless | |
std::ostream & | print (std::ostream &os) const |
print a quantity | |
virtual std::ostream & | print_value (std::ostream &os) const=0 |
print value and unit of the quantity | |
virtual void | operator>> (std::string &str) const=0 |
output of a quantity into a string | |
operator std::string () const | |
conversion into std::string | |
virtual std::ostream & | operator>> (std::ostream &os) const=0 |
Static Public Attributes | |
const bool | IsDimensionless = D::IsDimensionless |
return the dimensionality of the quantity | |
Protected Member Functions | |
Units::Unit< GT, ST > * | findBySymbol (const std::string &unitsymbol) |
find a unit from a string; | |
Protected Attributes | |
std::string | namestring |
a string defining the name of the quantity | |
std::string | symbolstring |
a string defining the symbol of the quantity | |
Private Types | |
typedef Name< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST > > | Name |
the helper class defining the name of the quantity | |
typedef Symbol< Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST > > | Symbol |
the helper class defining the symbol of the quantity | |
Friends | |
ST | exp (const Quantity &quantity) |
exponential | |
ST | log (const Quantity &quantity) |
log | |
ST | log10 (const Quantity &quantity) |
log base 10 | |
ST | sin (const Quantity &quantity) |
sine function | |
ST | cos (const Quantity &quantity) |
cosine function | |
ST | tan (const Quantity &quantity) |
tangent function | |
ST | sinh (const Quantity &quantity) |
hyperbolic sine function | |
ST | cosh (const Quantity &quantity) |
hyperbolic cosine function | |
ST | tanh (const Quantity &quantity) |
hyperbolic tangent function | |
ST | asin (const Quantity &quantity) |
arc sine function | |
ST | acos (const Quantity &quantity) |
arc cosine function | |
ST | atan (const Quantity &quantity) |
arc tangent function | |
ST | atan2 (const Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST > &quantity, const Quantity< GT, Loki::Typelist< Head, Tail >, DU, ST > &quantity2) |
alternative arc tangent function | |
std::ostream & | operator<< (std::ostream &os, const Quantity &quantity) |
output of a quantity in an output stream | |
void | operator<< (std::string &str, const Quantity &quantity) |
output of a quantity into a string (placed before the operator) |
parametrized by the group type GT, a Loki Typelist of units with all elements being subclasses from Unit<GT, ST>; Unit DU is used as the default unit and must also be subclassed from Unit<GT, ST>; the dimension is automatically chosen to be a type Dimension<GT>; in this way, it is ensured that all units and the dimension are consistent with the overall group type GT; Quantity has pure virtual member functions.
Definition at line 667 of file Quantity.h.
|
make all units in UL known uses the AllUnits template, which checks that all elements in the Typelist are subclassed from Unit<T, ST>. Definition at line 725 of file Quantity.h. |
|
make the Dimension available the dimension follows from group type GT Definition at line 682 of file Quantity.h. |
|
make the default unit known uses the DefaultUnit template, which checks that DU is subclassed from Unit<GT, ST>. Definition at line 731 of file Quantity.h. |
|
destructor Since this is a polymorphic class, the destructor should be virtual; it is empty. Definition at line 719 of file Quantity.h. |
|
find a unit from a string; use FindBySymbol; allow protected access by derived classes. Definition at line 703 of file Quantity.h. |
|
return whether the quantity is dimensionless dynamic access Implements Quantities::Quantities. Definition at line 761 of file Quantity.h. |
|
conversion into std::string generates a new string and outputs the this object into this string, which is then returned; uses operator>> for output. Definition at line 1123 of file Quantity.h. |
|
print a quantity outputs the object it is called on thorugh the output stream os; needs not be called from used code, rather, a call to operator<< is more often used; the output depends on the status stored in the PrintStatus singleton: the name and the symbol of the quantity are only printed if the corresponding status flags in PrintStatus are set to true; if the corresponding flag is set to false, the default empty string is used; if either the name of the symbol is to be printed, an equal sign is added to the output stream, otherwise, the equal string is also left empty; the name, symbol and equal sign are placed on the ostream in this order, before the pure virtual member function print_value is called, which does the same for the value and unit of the quantity. Definition at line 1086 of file Quantity.h. |
|
print value and unit of the quantity this pure virtual function must be overridden by classes derived from Quantity. |
|
default constructor sets namestring and symbolstring from the static values in the helper classes Name and Symbol Definition at line 712 of file Quantity.h. |
|
return the value in the standard unit pure virtual, must be overridden in all decendants of Quantity |
|
return the value in the storage unit pure virtual, must be overridden in all decendants of Quantity |
|
arc cosine function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 1011 of file Quantity.h. |
|
arc sine function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 989 of file Quantity.h. |
|
arc tangent function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 1033 of file Quantity.h. |
|
alternative arc tangent function this can be used only for two arguments of the same Quantity type. Definition at line 1055 of file Quantity.h. |
|
cosine function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 879 of file Quantity.h. |
|
hyperbolic cosine function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 945 of file Quantity.h. |
|
exponential only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 784 of file Quantity.h. |
|
log only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 806 of file Quantity.h. |
|
log base 10 only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 828 of file Quantity.h. |
|
output of a quantity in an output stream this friend function chains directly to the print () member function; it is needed, to allow syntax like os << quantity i.e., the quantity is the second parameter of operator<<. Definition at line 1068 of file Quantity.h. |
|
sine function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless template CheckDimensionality produces a compile time error; in case it successfully compiles, its return value is used to select struct sin to be instantiated; its exec () member function contributes the call to the std::sin () function (see Czarnecki/Eisenecker, code selection); the value of quantity is returned in the default unit, subjected to the sine function in namespace std, and then converted to the storage type ST; Definition at line 857 of file Quantity.h. |
|
hyperbolic sine function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 923 of file Quantity.h. |
|
tangent function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 901 of file Quantity.h. |
|
hyperbolic tangent function only valid if Quantity is dimensionless, which is tested through helper struct CheckDimensionality, which returns true if Quantity is dimensionless, if Quantity is NOT dimensionless CheckDimensionality produces a compile time error. Definition at line 967 of file Quantity.h. |
|
return the dimensionality of the quantity static access Definition at line 756 of file Quantity.h. |
|
a string defining the name of the quantity set during construction from Name Definition at line 694 of file Quantity.h. |
|
a string defining the symbol of the quantity set during construction from Symbol Definition at line 698 of file Quantity.h. |