casacore
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
casacore::UnitDim Class Reference

More...

#include <UnitDim.h>

Public Types

enum  Dim {
  Dm ,
  Dkg ,
  Ds ,
  DA ,
  DK ,
  Dcd ,
  Dmol ,
  Drad ,
  Dsr ,
  Dnon ,
  Dnumber
}
 Enumeration of the order and number of the defining SI units. More...
 

Public Member Functions

 ~UnitDim ()
 Destructor. More...
 

Protected Member Functions

void init ()
 
void init (Int pos)
 

Private Member Functions

 UnitDim ()
 Construct a unit with zero dimension in all SI units. More...
 
 UnitDim (const UnitDim &other)
 Copy constructor. More...
 
 UnitDim (Int pos)
 Construct a unit dimension with a one in the indicated position (as Dim enumerator) and zeroes in all other units. More...
 
UnitDimoperator= (const UnitDim &other)
 Assignment (copy semantics) More...
 
UnitDimoperator*= (const UnitDim &other)
 Operators to combine unit dimensions
More...
 
UnitDim operator* (const UnitDim &other) const
 
UnitDimoperator/= (const UnitDim &other)
 Division subtracts the unit dimensions of all SI units. More...
 
UnitDim operator/ (const UnitDim &other) const
 
Bool operator== (const UnitDim &other) const
 Compare dimension of units
More...
 
Bool operator!= (const UnitDim &other) const
 Compare for unequal dimensions. More...
 
UnitDim pow (Int p)
 Raise all SI defining units to an integer power. More...
 

Static Private Member Functions

static const StringdimName (uInt which)
 Get the tag for specified dimension. More...
 
static const StringdimFull (uInt which)
 Get the full name for the specified dimension. More...
 

Private Attributes

Long unitLong [UNITDIM_DLNUMBER]
 1-byte vector to contain the dimensions of the defining SI units (using same storage as Long vector for speed reasons) More...
 
signed char * unitDim
 

Friends

class UnitVal
 
class UnitMap
 
ostream & operator<< (ostream &os, const UnitDim &du)
 Output the SI dimensions (e.g. More...
 

Detailed Description

describes a unit in basic SI unit dimensions

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tUnit

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

Definition at line 87 of file UnitDim.h.

Member Enumeration Documentation

◆ Dim

Enumeration of the order and number of the defining SI units.

If order or contents changed, change also in dimName() and dimFull().

Enumerator
Dm 
Dkg 
Ds 
DA 
DK 
Dcd 
Dmol 
Drad 
Dsr 
Dnon 
Dnumber 

Definition at line 99 of file UnitDim.h.

Constructor & Destructor Documentation

◆ ~UnitDim()

casacore::UnitDim::~UnitDim ( )

Destructor.

◆ UnitDim() [1/3]

casacore::UnitDim::UnitDim ( )
inlineprivate

Construct a unit with zero dimension in all SI units.

Definition at line 113 of file UnitDim.h.

References init().

◆ UnitDim() [2/3]

casacore::UnitDim::UnitDim ( const UnitDim other)
private

Copy constructor.

◆ UnitDim() [3/3]

casacore::UnitDim::UnitDim ( Int  pos)
inlineprivate

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

Definition at line 120 of file UnitDim.h.

References init().

Member Function Documentation

◆ dimFull()

static const String& casacore::UnitDim::dimFull ( uInt  which)
staticprivate

Get the full name for the specified dimension.

◆ dimName()

static const String& casacore::UnitDim::dimName ( uInt  which)
staticprivate

Get the tag for specified dimension.

◆ init() [1/2]

void casacore::UnitDim::init ( )
protected

Referenced by UnitDim().

◆ init() [2/2]

void casacore::UnitDim::init ( Int  pos)
protected

◆ operator!=()

Bool casacore::UnitDim::operator!= ( const UnitDim other) const
private

Compare for unequal dimensions.

◆ operator*()

UnitDim casacore::UnitDim::operator* ( const UnitDim other) const
private

◆ operator*=()

UnitDim& casacore::UnitDim::operator*= ( const UnitDim other)
private

Operators to combine unit dimensions

Multiplication adds the unit dimensions of all SI units

◆ operator/()

UnitDim casacore::UnitDim::operator/ ( const UnitDim other) const
private

◆ operator/=()

UnitDim& casacore::UnitDim::operator/= ( const UnitDim other)
private

Division subtracts the unit dimensions of all SI units.

◆ operator=()

UnitDim& casacore::UnitDim::operator= ( const UnitDim other)
private

Assignment (copy semantics)

◆ operator==()

Bool casacore::UnitDim::operator== ( const UnitDim other) const
private

Compare dimension of units

Compare for equal dimensions

◆ pow()

UnitDim casacore::UnitDim::pow ( Int  p)
private

Raise all SI defining units to an integer power.

Friends And Related Function Documentation

◆ operator<<

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

Output the SI dimensions (e.g.

'km/s/g' as 'm kg-1 s-1')

◆ UnitMap

friend class UnitMap
friend

Definition at line 91 of file UnitDim.h.

◆ UnitVal

friend class UnitVal
friend

Definition at line 90 of file UnitDim.h.

Member Data Documentation

◆ unitDim

signed char* casacore::UnitDim::unitDim
private

Definition at line 157 of file UnitDim.h.

◆ unitLong

Long casacore::UnitDim::unitLong[UNITDIM_DLNUMBER]
private

1-byte vector to contain the dimensions of the defining SI units (using same storage as Long vector for speed reasons)

Definition at line 156 of file UnitDim.h.


The documentation for this class was generated from the following file: