MCBase.h

Classes

MCBase -- Base for specific measure conversions (full description)

class MCBase

Types

enum Routes

N_Routes

Interface

Public Members
virtual ~MCBase()
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref) = 0
virtual void initConvert(uInt which, MConvertBase &mc) = 0
virtual void clearConvert() = 0
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc) = 0
Protected Members
static void makeState(Bool &made, uInt *state, const uInt ntyp, const uInt nrout, const uInt list[][3])
static String showState(Bool &made, uInt *state, const uInt ntyp, const uInt nrout, const uInt list[][3])
Private Members
static Bool findState(uInt &len, uInt *state, uInt *mcnt, Bool &okall, Bool *visit, const uInt *tcnt, const uInt *tree, const uInt &in, const uInt &out, const uInt ntyp, const uInt nrout, const uInt list[][3])

Description

Review Status

Date Reviewed:
yyyy/mm/dd
Programs:
Tests:

Prerequisite

Etymology

Measure, Conversion and Base

Synopsis

MCBase forms the base for the individual state machines doing actual conversions between frames. (see e.g. MCEpoch)

It also has a static routine to calculate the state transition table based on a list of transitions. The makeState() method find the shortest route (weighted if necessary) for a given list of state transitions.

The user of the Measure classes has no direct interaction with this class.

Example

Convert (with all steps explicit) a UTC to an IAT time.
      #include <aips/Measures.h>
      #include <aips/Measures/MCEpoch.h>
	cout << "TAI for UTC = MJD(50237.29): " <<
		MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
			               MEpoch::Ref(MEpoch::UTC)),
		                MEpoch::Ref(MEpoch::TAI))() <<
		endl;
To get a static state transition matrix:
	static Bool made = False;		// set not yet done
	enum types {				// states
		A=0, B, C, D, E, ntyp };
	enum routes {				// routes
		A_B, B_C, B_D, C_D, C_E,
		D_C, C_B, B_A, D_B, E_C, nrout };
	static uInt list [nrout][3] = {		// description. The third number
		{A, B, 0},			// is a penalty hop to weight
		{B, C, 0},			// against using this route
		{B, D, 0},
		{C, D, 0},
		{C, E, 0},
		{D, C, 0},
		{C, B, 0},
		{B, A, 0},
		{D, B, 0},
		{E, C, 0} };
	static uInt state[ntyp][ntyp];	// the resultant transition matrix
					// diagonal == nrout
	// Make the state machine
	MCBase::makeState(made, state[0], ntyp, nrout, routes);

Motivation

To have specific conversion bases

To Do

Member Description

virtual ~MCBase()

enum Routes

Each derived class should have a list of routines to be called:

virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref) = 0

All these functions are called by Measure::Convert classes only

Create conversion state machine list

virtual void initConvert(uInt which, MConvertBase &mc) = 0

All these functions are called by Measure::Convert classes only

Create help structures for Measure conversion routines

virtual void clearConvert() = 0

All these functions are called by Measure::Convert classes only

Delete the pointers used in the MeasConvert help structure cache

virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc) = 0

All these functions are called by Measure::Convert classes only

Routine to convert a Measure from one reference frame to another

static String showState(Bool &made, uInt *state, const uInt ntyp, const uInt nrout, const uInt list[][3])

The following routines create a state transition matrix from a list of all defined transitions. It uses the following information:

Return a fromatted String with matrix information (based on < 100 types)

static Bool findState(uInt &len, uInt *state, uInt *mcnt, Bool &okall, Bool *visit, const uInt *tcnt, const uInt *tree, const uInt &in, const uInt &out, const uInt ntyp, const uInt nrout, const uInt list[][3])

The following routines create a state transition matrix from a list of all defined transitions. It uses the following information:

Routine to find the shortest route between two points

static void makeState(Bool &made, uInt *state, const uInt ntyp, const uInt nrout, const uInt list[][3])

The following routines create a state transition matrix from a list of all defined transitions. It uses the following information: