#include <Unit.h>
Inheritance diagram for CompositeUnit:
Public Member Functions | |
CompositeUnit (string cat_, string name_, string title_="", string base_expression_="", bool is_local=true, bool is_builtin=false, bool is_active=true) | |
CompositeUnit (const CompositeUnit *unit) | |
virtual ExpressionItem * | copy () const |
virtual void | set (const ExpressionItem *item) |
virtual void | add (Unit *u, int exp=1, Prefix *prefix=NULL) |
virtual Unit * | get (size_t index, int *exp=NULL, Prefix **prefix=NULL) const |
virtual void | setExponent (size_t index, int exp) |
virtual void | setPrefix (size_t index, Prefix *prefix) |
virtual size_t | countUnits () const |
virtual size_t | find (Unit *u) const |
virtual void | del (size_t index) |
virtual string | print (bool plural_, bool short_, bool use_unicode=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const |
virtual int | subtype () const |
virtual bool | containsRelativeTo (Unit *u) const |
virtual MathStructure | generateMathStructure (bool make_division=false) const |
virtual void | setBaseExpression (string base_expression_) |
virtual void | clear () |
Protected Attributes | |
string | sshort |
vector< AliasUnit_Composite * > | units |
Composite units are defined by a unit expression with multiple units. Composite units often have an alias unit associated with them, as they do not have a reference name on their own. For example, a joule is defined as an alias defined in relation to a composite unit defined as "Newton * meter".
The names of composite units is only used to reference the unit in definitions of other units. They can not be used in expressions.
Composite units is definited as a composition of units. The units, with prefixes and exponents, can either be added one by one with add() or parsed from an expression (ex. "cm^3/g) with setBaseExpression().
|
Adds a sub/base unit with specified exponent and an optional prefix.
|
|
Removes all sub/base units. |
|
If this unit contains a sub/base unit with a relation to the specified unit. |
|
Returns the number of sub/base units |
|
Creates a MathStructure with the sub/base units of the unit. |
|
Retrieves information about a sub/base unit
|
|
Prints out the sub/base units with prefixes and exponents. This is the representation of the unit in expressions. Reimplemented from Unit. |
|
Returns the subtype of the unit, corresponding to which subsubclass the object belongs to.
Reimplemented from Unit. |