Loading...
Searching...
No Matches
casacore::UnitName Class Reference
casa package (libcasa_casa) » Quanta_module

More...

`#include <UnitName.h>`

## Public Member Functions

| UnitName ()
| Default constructor.
| UnitName (const UnitName &other)
| Copy constructor.
| UnitName (const String &nameTag, const UnitVal &kind, const String &fullName=String())
| Construct from different parts.
| UnitName (const Unit &unit, const String &fullName=String())
| ~UnitName ()
| Destructor.
UnitName & | operator= (const UnitName &other)
| Assigment (copy semantics).
const UnitVal & | getVal () const
| Get definition value of the unit.
const String & | getName () const
| Get the name tag of the defined unit.
const String & | getFullName () const
| Get the full name of the defined unit.

## Private Attributes

UnitVal | basicKind
| Value of defined unit.
String | basicTag
| Name tag of unit.
String | basicName
| Full name and description of unit.

## Friends

ostream & | operator<< (ostream &os, const UnitName &name)
| Output the unit tag, description and its definition.

## Detailed Description

handles physical units

### Intended use:

Public interface

### Review Status

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

### Prerequisite

- Unit

### Etymology

The class name derives from the basic Unit and the Name giving possibilities of this class to a newly defined unit tag.

### 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 class for more details.

The UnitName class defines new basic, tagged units. If, e.g., for one reason or another you want, in addition to the standard defined SI and customary units, to define a unit with a name 'KPH' to stand for the composite SI unit 'km/hr', it can be done by creating a UnitName, and mapping it to the UnitMap lists.
Tip: The UnitMap::putUser can also be used without creating a UnitName first

UnitName myKPH("KPH", UnitVal(3.6,"km/ks")); // note ks = kilosecond
UnitMap::putUser(myKPH);
casacore::UnitMap::putUser
static void putUser(const String &s, const UnitVal &val)
Define a user defined standard unit.
casacore::UnitName::UnitName
UnitName()
Default constructor.
casacore::UnitVal
Definition UnitVal.h:165

### Constructing a tagged unit definition

The following constructors are available:

1. UnitName() create unnamed value 1.
2. UnitName(const UnitName&) copy constructor
3. UnitName("tag", UnitVal, "full name")

An assignment (copy semantics) is available.

### Obtaining information about tagged unit

The following information can be obatined from a UnitName:

1. UnitVal getVal() const will return the unit definition value
2. String getName() const will return the unit name

### Example

To obtain the definition of a Jy, you could:

// Define a UnitVal unit definition
UnitVal mydef;
// And fill it with the appropiate definition
mydef = (UnitMap::getUnit("Jy"))->getVal();
casacore::UnitMap::getUnit
static Bool getUnit(const String &s, UnitName &name, UMaps *maps=0)
Get a standard unit definition (search order: User, Customary, SI).
casacore::UnitName::getVal
const UnitVal & getVal() const
Get definition value of the unit.
Definition UnitName.h:145

Definition at line 115 of file UnitName.h.

## Constructor & Destructor Documentation

## UnitName() [1/4]

casacore::UnitName::UnitName | ( |  | ) |

Default constructor.

Referenced by operator<<, operator=(), and UnitName().

## UnitName() [2/4]

casacore::UnitName::UnitName | ( | const UnitName & | other | ) |

Copy constructor.

References UnitName().

## UnitName() [3/4]

casacore::UnitName::UnitName | ( | const String & | nameTag,
|  | const UnitVal & | kind,
|  | const String & | fullName = String() )

Construct from different parts.

## UnitName() [4/4]

casacore::UnitName::UnitName | ( | const Unit & | unit,
|  | const String & | fullName = String() )

## ~UnitName()

casacore::UnitName::~UnitName | ( |  | ) |

Destructor.

## Member Function Documentation

## getFullName()

const String & casacore::UnitName::getFullName | ( |  | ) | const

inline

Get the full name of the defined unit.

Definition at line 153 of file UnitName.h.

References basicName.

## getName()

const String & casacore::UnitName::getName | ( |  | ) | const

inline

Get the name tag of the defined unit.

Definition at line 149 of file UnitName.h.

References basicTag.

## getVal()

const UnitVal & casacore::UnitName::getVal | ( |  | ) | const

inline

Get definition value of the unit.

Definition at line 145 of file UnitName.h.

References basicKind.

## operator=()

UnitName & casacore::UnitName::operator= | ( | const UnitName & | other | ) |

Assigment (copy semantics).

References UnitName().

## Friends And Related Symbol Documentation

## operator<<

ostream & operator<< | ( | ostream & | os,
|  | const UnitName & | name )

friend

Output the unit tag, description and its definition.

References casacore::name(), and UnitName().

## Member Data Documentation

## basicKind

UnitVal casacore::UnitName::basicKind

private

Value of defined unit.

Definition at line 159 of file UnitName.h.

Referenced by getVal().

## basicName

String casacore::UnitName::basicName

private

Full name and description of unit.

Definition at line 165 of file UnitName.h.

Referenced by getFullName().

## basicTag

String casacore::UnitName::basicTag

private

Name tag of unit.

Definition at line 162 of file UnitName.h.

Referenced by getName().

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

- casa/Quanta/UnitName.h