1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>libqalculate-0.9.7: AliasUnit Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="classes.html"><span>Alphabetical List</span></a></li>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>AliasUnit Class Reference</h1><!-- doxytag: class="AliasUnit" --><!-- doxytag: inherits="Unit" -->An unit with relation to another unit.
<a href="#_details">More...</a>
<p>
<code>#include <Unit.h></code>
<p>
<div class="dynheader">
Inheritance diagram for AliasUnit:</div>
<div class="dynsection">
<p><center><img src="classAliasUnit.png" usemap="#AliasUnit_map" border="0" alt=""></center>
<map name="AliasUnit_map">
<area href="classUnit.html" alt="Unit" shape="rect" coords="0,56,126,80">
<area href="classExpressionItem.html" alt="ExpressionItem" shape="rect" coords="0,0,126,24">
<area href="classAliasUnit__Composite.html" alt="AliasUnit_Composite" shape="rect" coords="0,168,126,192">
</map>
</div>
<p>
<a href="classAliasUnit-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="dc05ddf56b844fb2ab3cfbf887867122"></a><!-- doxytag: member="AliasUnit::AliasUnit" ref="dc05ddf56b844fb2ab3cfbf887867122" args="(string cat_, string name_, string plural_, string singular_, string title_, Unit *alias, string relation="1", int exp=1, string inverse="", bool is_local=true, bool is_builtin=false, bool is_active=true)" -->
</td><td class="memItemRight" valign="bottom"><b>AliasUnit</b> (string cat_, string name_, string plural_, string singular_, string title_, <a class="el" href="classUnit.html">Unit</a> *alias, string relation="1", int exp=1, string inverse="", bool is_local=true, bool is_builtin=false, bool is_active=true)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="01ce75893d0066c6c4affafb26e4aa87"></a><!-- doxytag: member="AliasUnit::AliasUnit" ref="01ce75893d0066c6c4affafb26e4aa87" args="(const AliasUnit *unit)" -->
</td><td class="memItemRight" valign="bottom"><b>AliasUnit</b> (const <a class="el" href="classAliasUnit.html">AliasUnit</a> *unit)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="813d47c0ed7d009a4da4672573032a9e"></a><!-- doxytag: member="AliasUnit::copy" ref="813d47c0ed7d009a4da4672573032a9e" args="() const " -->
virtual <a class="el" href="classExpressionItem.html">ExpressionItem</a> * </td><td class="memItemRight" valign="bottom"><b>copy</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f95369b8069cbd7b8eab0b605bc38d64"></a><!-- doxytag: member="AliasUnit::set" ref="f95369b8069cbd7b8eab0b605bc38d64" args="(const ExpressionItem *item)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>set</b> (const <a class="el" href="classExpressionItem.html">ExpressionItem</a> *item)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0b09c587549658659b75ccbafa5f63e2"></a><!-- doxytag: member="AliasUnit::baseUnit" ref="0b09c587549658659b75ccbafa5f63e2" args="() const " -->
virtual <a class="el" href="classUnit.html">Unit</a> * </td><td class="memItemRight" valign="bottom"><b>baseUnit</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="25119f993f867ed3d93017a050893547"></a><!-- doxytag: member="AliasUnit::firstBaseUnit" ref="25119f993f867ed3d93017a050893547" args="() const " -->
virtual <a class="el" href="classUnit.html">Unit</a> * </td><td class="memItemRight" valign="bottom"><b>firstBaseUnit</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4c4ccf956c9be96b56b2f4e682dffeae"></a><!-- doxytag: member="AliasUnit::setBaseUnit" ref="4c4ccf956c9be96b56b2f4e682dffeae" args="(Unit *alias)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>setBaseUnit</b> (<a class="el" href="classUnit.html">Unit</a> *alias)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6227559a0c8280e2185e6a02b08d4ce1"></a><!-- doxytag: member="AliasUnit::expression" ref="6227559a0c8280e2185e6a02b08d4ce1" args="() const " -->
virtual string </td><td class="memItemRight" valign="bottom"><b>expression</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4c0a68a8b20b19d203f4b1fbdc77197d"></a><!-- doxytag: member="AliasUnit::inverseExpression" ref="4c0a68a8b20b19d203f4b1fbdc77197d" args="() const " -->
virtual string </td><td class="memItemRight" valign="bottom"><b>inverseExpression</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAliasUnit.html#ccf39fd99fee334e40ff5247ad4db8d7">setExpression</a> (string relation)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAliasUnit.html#9faac6c0a50301cd8b10b41a276d5013">setInverseExpression</a> (string inverse)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="def74088c51b94801214957fa93b60fe"></a><!-- doxytag: member="AliasUnit::convertToFirstBaseUnit" ref="def74088c51b94801214957fa93b60fe" args="(MathStructure &mvalue, MathStructure &mexp) const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> & </td><td class="memItemRight" valign="bottom"><b>convertToFirstBaseUnit</b> (<a class="el" href="classMathStructure.html">MathStructure</a> &mvalue, <a class="el" href="classMathStructure.html">MathStructure</a> &mexp) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7fe5aefc78ce8c564342049b891ff974"></a><!-- doxytag: member="AliasUnit::convertFromFirstBaseUnit" ref="7fe5aefc78ce8c564342049b891ff974" args="(MathStructure &mvalue, MathStructure &mexp) const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> & </td><td class="memItemRight" valign="bottom"><b>convertFromFirstBaseUnit</b> (<a class="el" href="classMathStructure.html">MathStructure</a> &mvalue, <a class="el" href="classMathStructure.html">MathStructure</a> &mexp) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="56d262acacc76358dfb09129c85c20af"></a><!-- doxytag: member="AliasUnit::convertToBaseUnit" ref="56d262acacc76358dfb09129c85c20af" args="(MathStructure &mvalue, MathStructure &mexp) const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> & </td><td class="memItemRight" valign="bottom"><b>convertToBaseUnit</b> (<a class="el" href="classMathStructure.html">MathStructure</a> &mvalue, <a class="el" href="classMathStructure.html">MathStructure</a> &mexp) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="841282a233d1b337aa9724725fa19818"></a><!-- doxytag: member="AliasUnit::convertFromBaseUnit" ref="841282a233d1b337aa9724725fa19818" args="(MathStructure &mvalue, MathStructure &mexp) const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> & </td><td class="memItemRight" valign="bottom"><b>convertFromBaseUnit</b> (<a class="el" href="classMathStructure.html">MathStructure</a> &mvalue, <a class="el" href="classMathStructure.html">MathStructure</a> &mexp) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c30d1ebbc4b83fbd48696a7c963b47d6"></a><!-- doxytag: member="AliasUnit::convertToBaseUnit" ref="c30d1ebbc4b83fbd48696a7c963b47d6" args="(MathStructure &mvalue) const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> & </td><td class="memItemRight" valign="bottom"><b>convertToBaseUnit</b> (<a class="el" href="classMathStructure.html">MathStructure</a> &mvalue) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a06d3fd714a008e7e8bf021b30e4b450"></a><!-- doxytag: member="AliasUnit::convertFromBaseUnit" ref="a06d3fd714a008e7e8bf021b30e4b450" args="(MathStructure &mvalue) const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> & </td><td class="memItemRight" valign="bottom"><b>convertFromBaseUnit</b> (<a class="el" href="classMathStructure.html">MathStructure</a> &mvalue) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="383ffed201f637d87f0112cc41e4a569"></a><!-- doxytag: member="AliasUnit::convertToBaseUnit" ref="383ffed201f637d87f0112cc41e4a569" args="() const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> </td><td class="memItemRight" valign="bottom"><b>convertToBaseUnit</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d429c293d99f844942bae4fba72438e1"></a><!-- doxytag: member="AliasUnit::convertFromBaseUnit" ref="d429c293d99f844942bae4fba72438e1" args="() const " -->
virtual <a class="el" href="classMathStructure.html">MathStructure</a> </td><td class="memItemRight" valign="bottom"><b>convertFromBaseUnit</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="11e1370607c011d04606e94b788bedc9"></a><!-- doxytag: member="AliasUnit::baseExponent" ref="11e1370607c011d04606e94b788bedc9" args="(int exp=1) const " -->
virtual int </td><td class="memItemRight" valign="bottom"><b>baseExponent</b> (int exp=1) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b968111a6b0b58d527f8d0a632dd19a0"></a><!-- doxytag: member="AliasUnit::setExponent" ref="b968111a6b0b58d527f8d0a632dd19a0" args="(int exp)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>setExponent</b> (int exp)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="96f8f784fd291ee1bd9b7e8e81f8e328"></a><!-- doxytag: member="AliasUnit::firstBaseExponent" ref="96f8f784fd291ee1bd9b7e8e81f8e328" args="() const " -->
virtual int </td><td class="memItemRight" valign="bottom"><b>firstBaseExponent</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classAliasUnit.html#05402283a80a32786c2ef9d999ef4285">subtype</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAliasUnit.html#2ff243e55c77a947eade51ee93fc5c79">isChildOf</a> (<a class="el" href="classUnit.html">Unit</a> *u) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAliasUnit.html#075edcb570d3cc980283213e7d423834">isParentOf</a> (<a class="el" href="classUnit.html">Unit</a> *u) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="519dd0c7629f5ebf21c8ce31513341f6"></a><!-- doxytag: member="AliasUnit::hasComplexExpression" ref="519dd0c7629f5ebf21c8ce31513341f6" args="() const " -->
virtual bool </td><td class="memItemRight" valign="bottom"><b>hasComplexExpression</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="827a20ac5a1ef2501c863a2e048b476d"></a><!-- doxytag: member="AliasUnit::hasComplexRelationTo" ref="827a20ac5a1ef2501c863a2e048b476d" args="(Unit *u) const " -->
virtual bool </td><td class="memItemRight" valign="bottom"><b>hasComplexRelationTo</b> (<a class="el" href="classUnit.html">Unit</a> *u) const </td></tr>
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7380edd3115ea22daa318e76e8b91a96"></a><!-- doxytag: member="AliasUnit::svalue" ref="7380edd3115ea22daa318e76e8b91a96" args="" -->
string </td><td class="memItemRight" valign="bottom"><b>svalue</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fafcc4c148afe1254c7e8393c77f69ca"></a><!-- doxytag: member="AliasUnit::sinverse" ref="fafcc4c148afe1254c7e8393c77f69ca" args="" -->
string </td><td class="memItemRight" valign="bottom"><b>sinverse</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="cf8f75297aad4b7d831a7b24903f32a1"></a><!-- doxytag: member="AliasUnit::i_exp" ref="cf8f75297aad4b7d831a7b24903f32a1" args="" -->
int </td><td class="memItemRight" valign="bottom"><b>i_exp</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c5dec15cffa4a02b4c5c5c84fecd3fa5"></a><!-- doxytag: member="AliasUnit::o_unit" ref="c5dec15cffa4a02b4c5c5c84fecd3fa5" args="" -->
<a class="el" href="classUnit.html">Unit</a> * </td><td class="memItemRight" valign="bottom"><b>o_unit</b></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
An unit with relation to another unit.
<p>
Alias units is defined in relation to another unit. For example, hour are defined as an alias unit that equals 60 minutes which in turn is defined in relation to seconds.<p>
Alias units have an associated base unit, exponent and relation expression. For more complex relations an inverse relation can also be specified for conversion back from the base unit. The base unit must not necessarily be of the base unit class and it is recommended that an alias unit is defined in relation to the closest unit (ex. 1ft = 3 hands, 1 hand = 4 in, and 1 in = 0.0254 m).<p>
The relation is usually just a number that tells how large quantity of the base unit is needed to get the alias unit (alias unit = base unit * relation). More complex units can specify the relation as a full-blown expression where '' is replaced by the quantity of the base unit and '' is the exponent. For example, Degrees Celsius has the relation "\x + 273.15" and the inverse relation "\x - 273.15" to the base unit Kelvin. For simple relations, the reversion is automatic and ought not be defined separately.<p>
The precision property inherited from <a class="el" href="classExpressionItem.html" title="Abstract base class for functions, variables and units.">ExpressionItem</a> defines the precision of the relation.<p>
The exponent defines the exponential relation to the base unit, so that the alias unit equals the base unit raised to the exponent. For simple unit relations this gives: alias unit = relation * base unit^exponent.<p>
Alias units normally have three different names defined for use in expressions - abbreviation (ex. "m"), singular ("meter") and plural ("meters"). <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="ccf39fd99fee334e40ff5247ad4db8d7"></a><!-- doxytag: member="AliasUnit::setExpression" ref="ccf39fd99fee334e40ff5247ad4db8d7" args="(string relation)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void AliasUnit::setExpression </td>
<td>(</td>
<td class="paramtype">string </td>
<td class="paramname"> <em>relation</em> </td>
<td> ) </td>
<td width="100%"><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the relation expression.
</div>
</div><p>
<a class="anchor" name="9faac6c0a50301cd8b10b41a276d5013"></a><!-- doxytag: member="AliasUnit::setInverseExpression" ref="9faac6c0a50301cd8b10b41a276d5013" args="(string inverse)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void AliasUnit::setInverseExpression </td>
<td>(</td>
<td class="paramtype">string </td>
<td class="paramname"> <em>inverse</em> </td>
<td> ) </td>
<td width="100%"><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the inverse relation expression.
</div>
</div><p>
<a class="anchor" name="05402283a80a32786c2ef9d999ef4285"></a><!-- doxytag: member="AliasUnit::subtype" ref="05402283a80a32786c2ef9d999ef4285" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual int AliasUnit::subtype </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the subtype of the unit, corresponding to which subsubclass the object belongs to.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="Unit_8h.html#187e4d06747a26a2325145b16ff73915" title="Type of unit.">UnitSubtype</a>. </dd></dl>
<p>Reimplemented from <a class="el" href="classUnit.html#d9f4f05c29ed947195274abc7d9a39a3">Unit</a>.</p>
</div>
</div><p>
<a class="anchor" name="2ff243e55c77a947eade51ee93fc5c79"></a><!-- doxytag: member="AliasUnit::isChildOf" ref="2ff243e55c77a947eade51ee93fc5c79" args="(Unit *u) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual bool AliasUnit::isChildOf </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classUnit.html">Unit</a> * </td>
<td class="paramname"> <em>u</em> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
If specified unit is a base unit for this unit, directly or with other units in between. Equivalent to u->isParentOf(this).
<p>Reimplemented from <a class="el" href="classUnit.html#d1cd1f10c7fbee65e05513115144de00">Unit</a>.</p>
</div>
</div><p>
<a class="anchor" name="075edcb570d3cc980283213e7d423834"></a><!-- doxytag: member="AliasUnit::isParentOf" ref="075edcb570d3cc980283213e7d423834" args="(Unit *u) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual bool AliasUnit::isParentOf </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classUnit.html">Unit</a> * </td>
<td class="paramname"> <em>u</em> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
If this unit is a base unit for specified unit, directly or with other units in between. Equivalent to u->isChildOf(this).
<p>Reimplemented from <a class="el" href="classUnit.html#6598f3532f5b7d046faae41ff6506698">Unit</a>.</p>
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>libqalculate/<a class="el" href="Unit_8h.html">Unit.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jan 5 08:26:29 2010 for libqalculate-0.9.7 by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>
|