Collaboration diagram for Quantity:
Public Methods | |
Quantity () | |
Quantity ( const Quantity& qty ) | |
Quantity ( const char* dimNum ) | |
Quantity ( double v, UnitExpr* e ) | |
~Quantity () | |
double | val () const |
void | val ( double num ) |
double | scale () const |
DimensionGroup* | group () const |
const vector<DimensionPower>& | dimension () const |
vector<DimensionPower>& | dimension () |
void | print () |
xmlNodePtr | mathML () const |
bool | operator== ( const Quantity& o ) const |
Protected Methods | |
void | eval ( UnitExpr* e, vector<UnitPower>& upwr, vector<DimensionPower>& dpwr, double& s ) |
void | p_eval ( UnitExpr* e, int x, vector<UnitPower>& upwr, vector<DimensionPower>& dpwr, double& s ) |
Protected Attributes | |
double | m_val |
vector<UnitPower> | m_units |
vector<DimensionPower> | m_dimn |
DimensionGroup* | m_dgrp |
double | m_scale |
Friends | |
class | QUnitParser |
int | convert ( Quantity* to, const Quantity* from ) |
This class represents a number and the units associated with that number. Objects of this type can be created explicitly or by calling a parser that takes a string, produces a UnitExpr tree, and then constructs a Quantity by traversing the tree.
|
Default constructor for a quantity. You must have called @UnitInit() for this constructor to work, as Unit::dimensionless() will return NULL otherwise. |
|
Copy constructor. |
|
Construct a Quantity from a string in the format "num [ unit_expr ]". An example would be "6 kJ/s". You must have called Unit::initialize() for this constructor to work, as no units will be defined otherwise. |
|
Construct a quantity from a number and a tree of operations on units |
|
Destroy a quantity |
|
Return a copy of the (Dimension, exponent) tuples associated with this Quantity |
|
Return the (Dimension, exponent) tuples associated with this Quantity |
|
Call this to "flatten" a UnitExpr. "Flattening" a UnitExpr tree involves carrying out all of the operations to produce vectors of DimensionPowers and UnitPowers and a scale factor. |
|
Return the DimensionGroup this quantity is a part of, or NULL. |
|
Return reference to an XML tree representing this quantity in MathML. You are responsible for destroying the tree when you're done with it. |
|
Test equality. Checks that both the numerical value and the units are exactly the same. So, even though 9.81 kg m/s^2 is the same as 32.2 lbf, they would not be considered equivalent. |
|
This is a recursive routine used by Quantity::eval.
|
|
Print a quantity to stdout (for debugging purposes) |
|
Return the scale that will convert val() into Citrus' default units |
|
Set the number associated with the Quantity |
|
Return the number associated with the Quantity |
|
Convert a number from one set of units into another. The value for <to> will be overwritten by dtNaN if <to> and <from> do not belong to the same unit groups and do not have the same dimensionality.
|
|
The dimension group to which the expression belongs, if any. |
|
The dimension of the value (a vector of DimensionPowers) |
|
The scale factor to convert m_val to native units. |
|
The units of the value (a vector of UnitPowers) |
|
The value |
![]() |
C++ Reference Manual | 20010520 |