QBase.h

Classes

QBase -- Base for Quantities (i.e. dimensioned values) (full description)
Global Functions -- Global functions (full description)

class QBase

Interface

Public Members
QBase()
QBase(const QBase &other)
QBase(const Unit &s)
virtual ~QBase()
QBase &operator=(const QBase &other)
const String &getUnit() const
void setUnit(const Unit &s)
void setUnit(const QBase &other)
Bool isConform(const Unit &s) const
Bool isConform(const QBase &other) const
virtual QBase *clone() const = 0
virtual const Unit &getFullUnit() const = 0
virtual void print(ostream &os) const = 0
virtual uInt type() const = 0

Description

Review Status

Programs:
Tests:

Prerequisite

Etymology

QBase is the base class for Quantum.

Synopsis

Quantities are values with a unit. Their basic specification can be one of two forms:
    Quantity( Double value, String unit);	// or: Unit unit
    Quantum<Type> ( Type value, String unit)	// or: Unit unit
    
See Quantum for details.

Motivation

To provide the possibilty of mixing units from different Quantum<T1>, Quantum<T2>

To Do

Member Description

QBase()

Default constructor, generates ""

QBase(const QBase &other)

Copy constructor

QBase(const Unit &s)

Construct dimensioned QBase (e.g. 'km/Mpc')

Thrown Exceptions

virtual ~QBase()

Destructor

QBase &operator=(const QBase &other)

Assignment (copy)

const String &getUnit() const

Get units of QBase

Return the string representation of the current units attached to QBase

void setUnit(const QBase &other)

Re-specify parts of a QBase

Set new unit, copied from specified QBase, without changing value

void setUnit(const Unit &s)

Re-specify parts of a QBase

Bool isConform(const QBase &other) const

Check for conformal matching units (e.g. dam and Mpc)

Using units specified in QBase

Bool isConform(const Unit &s) const

Check for conformal matching units (e.g. dam and Mpc)

virtual QBase *clone() const = 0

Get a copy of Quantum

virtual const Unit &getFullUnit() const = 0

Get the unit attached to the Quantum (use getUnit() if only interested in the String part of the unit)

virtual void print(ostream &os) const = 0

Print a Quantum

virtual uInt type() const = 0

Get the type (== Register() of derived Quantum (faster than Strings) All should have: static uInt myType();

Global functions (source)

Interface

Protected Members
ostream &operator<<(ostream &os, const QBase &meas)

Description

Member Description

ostream &operator<<(ostream &os, const QBase &meas)

Output declaration