UnitDim.h

Classes

UnitDim -- describes a unit in basic SI unit dimensions (full description)

class UnitDim

Types

enum Dim

Dm = 0
Dkg
Ds
DA
DK
Dcd
Dmol
Drad
Dsr
Dnon
Dnumber

Interface

friend ostream& operator<<(ostream &os, const UnitDim &du)
Public Members
~UnitDim()
Protected Members
void init( )
void init(Int pos)
Private Members
UnitDim()
UnitDim(const UnitDim &other)
UnitDim(Int pos)
UnitDim &operator=(const UnitDim &other)
UnitDim &operator*=(const UnitDim &other)
UnitDim operator*(const UnitDim &other) const
UnitDim &operator/=(const UnitDim &other)
UnitDim operator/(const UnitDim &other) const
Bool operator==(const UnitDim &other) const
Bool operator!=(const UnitDim &other) const
UnitDim pow(Int p)
static const String& dimName(uInt which)
static const String& dimFull(uInt which)

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Tests:

Prerequisite

Etymology

Based on Unit and the Dimension of a unit in SI defining units

Synopsis

Physical units are strings consisting of one or more names of known basic units, separated by '.' or ' ' (for multiplication) or '/' (for division). Each name can optionally be preceded by a standard decimal prefix, and/or followed by an (optionally signed) exponent. Example: km/s/(Mpc.s)2 is identical to km.s-1.Mpc-2.s-2

See the Unit for more details.

The UnitDim class is a private class for use by the Unit classes. It contains the dimensions in the 9 basic defining SI units of a unit.

Example

Motivation

The UnitDim class has been separated to keep the interface between a complex unit description string and the basic SI units clean.

To Do

Member Description

friend ostream& operator<<(ostream &os, const UnitDim &du)

Output the SI dimensions (e.g. 'km/s/g' as 'm kg-1 s-1')

enum Dim

Enumeration of the order and number of the defining SI units. If order or contents changed, change also in dimName() and dimFull().

~UnitDim()

Destructor

void init( )

void init(Int pos)

UnitDim()

Construct a unit with zero dimension in all SI units

UnitDim(const UnitDim &other)

Copy constructor

UnitDim(Int pos)

Construct a unit dimension with a one in the indicated position (as Dim enumerator) and zeroes in all other units

UnitDim &operator=(const UnitDim &other)

Assignment (copy semantics)

UnitDim &operator*=(const UnitDim &other)

Operators to combine unit dimensions

Multiplication adds the unit dimensions of all SI units

UnitDim &operator/=(const UnitDim &other)

Operators to combine unit dimensions

Division subtracts the unit dimensions of all SI units

UnitDim operator*(const UnitDim &other) const
UnitDim operator/(const UnitDim &other) const

Operators to combine unit dimensions

Bool operator!=(const UnitDim &other) const

Compare dimension of units

Compare for unequal dimensions

Bool operator==(const UnitDim &other) const

Compare dimension of units

UnitDim pow(Int p)

Raise all SI defining units to an integer power

static const String& dimName(uInt which)

Get the tag for specified dimension

static const String& dimFull(uInt which)

Get the full name for the specified dimension