Loading...
Searching...
No Matches
casacore::MCBase Class Referenceabstract
measures package (libcasa_measures) » Measures_module » Measures_module_internal_classes

More...

`#include <MCBase.h>`

## Public Types

enum | Routes { N_Routes }
| Each derived class should have a list of routines to be called: More...

## Public Member Functions

virtual | ~MCBase ()
virtual void | getConvert (MConvertBase &mc, const MRBase &inref, const MRBase &outref)=0
| All these functions are called by Measure::Convert classes only.
virtual void | initConvert (uInt which, MConvertBase &mc)=0
| Create help structures for Measure conversion routines.
virtual void | clearConvert ()=0
| Delete the pointers used in the MeasConvert help structure cache.
virtual void | doConvert (MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)=0
| Routine to convert a Measure from one reference frame to another.

## Static Protected Member Functions

static void | makeState (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.
static String | showState (uInt *state, const uInt ntyp, const uInt nrout, const uInt list[][3])
| Return a fromatted String with matrix information (based on < 100 types).

## Static Private Member Functions

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])
| Routine to find the shortest route between two points.

## Detailed Description

Base for specific measure conversions

### Intended use:

Internal

### Review Status

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

### Prerequisite

- Measure class
- MConvertBase : conversion engine

### 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 <casacore/measures/Measures.h>
#include <casacore/measures/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;
casacore::MEpoch
Definition MEpoch.h:101
casacore::MEpoch::TAI
@ TAI
Definition MEpoch.h:126
casacore::MEpoch::UTC
@ UTC
Definition MEpoch.h:125
casacore::MEpoch::Ref
MeasRef< MEpoch > Ref
Measure reference (i.e.
Definition MEpoch.h:153
casacore::MEpoch::Convert
MeasConvert< MEpoch > Convert
Measure Convert (i.e.
Definition MEpoch.h:155
casacore::MVEpoch
Definition MVEpoch.h:87
casacore::Quantity
Quantum< Double > Quantity
Definition Quantum.h:39

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(state[0], ntyp, nrout, routes);
made = True;
casacore::MCBase::makeState
static void makeState(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.
casacore::C
Definition Constants.h:339
casacore::False
const Bool False
Definition aipstype.h:42
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::True
const Bool True
Definition aipstype.h:41

### Motivation

To have specific conversion bases

### To Do

- Nothing I know

Definition at line 116 of file MCBase.h.

## Member Enumeration Documentation

## Routes

enum casacore::MCBase::Routes

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

Enumerator
N_Routes |

Definition at line 131 of file MCBase.h.

## Constructor & Destructor Documentation

## ~MCBase()

virtual casacore::MCBase::~MCBase | ( |  | ) |

virtual

## Member Function Documentation

## clearConvert()

virtual void casacore::MCBase::clearConvert | ( |  | ) |

pure virtual

Delete the pointers used in the MeasConvert help structure cache.

Implemented in casacore::MCBaseline, casacore::MCDirection, casacore::MCDoppler, casacore::MCEarthMagnetic, casacore::MCEpoch, casacore::MCFrequency, casacore::MCPosition, casacore::MCRadialVelocity, and casacore::MCuvw.

## doConvert()

virtual void casacore::MCBase::doConvert | ( | MeasValue & | in,
|  | MRBase & | inref,
|  | MRBase & | outref,
|  | const MConvertBase & | mc )

pure virtual

Routine to convert a Measure from one reference frame to another.

Implemented in casacore::MCBaseline, casacore::MCDirection, casacore::MCDoppler, casacore::MCEarthMagnetic, casacore::MCEpoch, casacore::MCFrequency, casacore::MCPosition, casacore::MCRadialVelocity, and casacore::MCuvw.

## findState()

Bool casacore::MCBase::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] )

static private

Routine to find the shortest route between two points.

## getConvert()

virtual void casacore::MCBase::getConvert | ( | MConvertBase & | mc,
|  | const MRBase & | inref,
|  | const MRBase & | outref )

pure virtual

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

Create conversion state machine list

Implemented in casacore::MCBaseline, casacore::MCDirection, casacore::MCDoppler, casacore::MCEarthMagnetic, casacore::MCEpoch, casacore::MCFrequency, casacore::MCPosition, casacore::MCRadialVelocity, and casacore::MCuvw.

## initConvert()

virtual void casacore::MCBase::initConvert | ( | uInt | which,
|  | MConvertBase & | mc )

pure virtual

Create help structures for Measure conversion routines.

Implemented in casacore::MCBaseline, casacore::MCDirection, casacore::MCDoppler, casacore::MCEarthMagnetic, casacore::MCEpoch, casacore::MCFrequency, casacore::MCPosition, casacore::MCRadialVelocity, and casacore::MCuvw.

## makeState()

void casacore::MCBase::makeState | ( | uInt * | state,
|  | const uInt | ntyp,
|  | const uInt | nrout,
|  | const uInt | list[][3] )

static protected

The following routines create a state transition matrix from a list of all defined transitions.

It uses the following information:

- nrout: the number of transitions; numbered 0,...
- ntyp: the number of states
- list: a [nrout][3] list of input and output transition type of transition and a penalty hop number (<100)
- state: a [ntyp][ntyp] transition matrix with diagonal elements set to nrout.

Routine to make the transition table if necessary

## showState()

String casacore::MCBase::showState | ( | uInt * | state,
|  | const uInt | ntyp,
|  | const uInt | nrout,
|  | const uInt | list[][3] )

static protected

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

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

- measures/Measures/MCBase.h