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

More...

`#include <MConvertBase.h>`

## Public Member Functions

virtual | ~MConvertBase ()
virtual void | setModel (const Measure &val)=0
| Set a new model for the conversion.
virtual void | set (const MeasValue &val)=0
| Set a new model value only.
virtual void | set (const Unit &inunit)=0
| Set a new model unit only.
virtual void | addMethod (uInt method)=0
| Add a method (Note: uInt should be an enum from the appropiate Measure).
virtual void | addFrameType (uInt tp)=0
| Add a FrameTypes used (as specified in MeasFrame::FrameTypes).
virtual Int | nMethod () const =0
| Get number of methods.
virtual uInt | getMethod (uInt which) const =0
| Get method.
virtual void | print (ostream &os) const =0
| Print a conversion engine.

## Detailed Description

Conversion of Measures Base

### Intended use:

Internal

### Review Status

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

### Prerequisite

- Measure class
- MeasRef class
- Quantum class

### Etymology

### Synopsis

MConvertBase can convert a Measure to the same type of Measure in a different reference frame. The MConvertBase is a templated class, but has typedefs for the allowed conversions, like MEpoch::Convert.
The basic operation is to create a MConvertBase with either of:

- MEpoch::Convert(MEpoch, MEpoch::Ref), where the MEpoch is a template for subsequent conversions, i.e. it will remember the value and the input reference frame. And the MeasRef is the output reference class.
- MEpoch::Convert(MEpoch) with a subsequent setOut(MEpoch::Ref)
- MEpoch::Convert(MEpoch::Ref in, MEpoch::Ref out) is a template for conversions from the input reference to the output reference. The 'template' model used is the default value for the Measure, with no units.
- MEpoch::Convert(Unit, MEpoch::Ref in, MEpoch::Ref out) is a template for conversions from the input reference to the output reference. The 'template' model used is the default value for the Measure, with the default units as specified.
- MEpoch::Convert() with a setModel(MEpoch) and setOut().

An empty MeasRef indicates no conversion
. The constructor, and set functions, analyse the 'template' Measure and the output reference frame, and construct a pointer (in practice a list of pointers to bypass the necessity of creating too many conversion functions) to a conversion routine. Functionals will maybe used in a later version in stead of a vector of function pointers. During the implementation process, I have, for a variety of reasons, changed the list of function pointers to a list of numbers, with the Measure having just a doConvert() function containing an appropiate switch statement.
Actual conversions are done with the () operator, which produces a new MEpoch (or other Measure).
Possible arguments are (MVEpoch is used here generic, and indicates the internal format of a Measure; possibly, to make sure distinction between values with and without units is possible, even simple Measures will have their own internal class format, e.g. MVDouble. This will also aid in the possibility that I am still pursuing to have a fully dynamic conversion possibility. However, to be able to use pointers to functions in any reasonable way for all possible input and output types, a multi-level approach is necessary, with all possible datatypes derived from some MeasValue.):

- (MEpoch, MEpoch::Ref): will create a new conversion method, and use it to produce the result of converting the MEpoch to the specified frame
- (MEpoch): will create a new conversion method from the MEpoch to the MeasRef belonging to the MConvertBase
- (Quantity): will use the conversion chain deduced from the MEpoch model in the definition of MConvertBase, and will convert the Quantity
- (Quantum<Vector<Double> >) as previous
- (Double): will use the units (if present) as specified in the MConvertBase object to construct the internal value to be converted
- (Vector<Double> >): as previous

Float versions will be produced if necessary.
The conversion analyser expects that all Measure classes have a set of routines to do the actual analysing and conversion.
If the standard conversion is not sufficient, additional methods can be added at the end of the list with the addMethod() member function, or at the beginning of the list with insertMethod(). The whole list can be cleared with clearMethod().
To ease the specification of the Method, each Measure has a typedef (e.g. MEpoch_ConvType) specifying the Method type.

### Example

See Measure for an example

### Motivation

Conversion of Measures will in general be done on a series of values. Separating the analysis of the calculations necessary for the conversion from the actual conversion could speed up the process.

Definition at line 144 of file MConvertBase.h.

## Constructor & Destructor Documentation

## ~MConvertBase()

virtual casacore::MConvertBase::~MConvertBase | ( |  | ) |

virtual

## Member Function Documentation

## addFrameType()

virtual void casacore::MConvertBase::addFrameType | ( | uInt | tp | ) |

pure virtual

Add a FrameTypes used (as specified in MeasFrame::FrameTypes).

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## addMethod()

virtual void casacore::MConvertBase::addMethod | ( | uInt | method | ) |

pure virtual

Add a method (Note: uInt should be an enum from the appropiate Measure).

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## getMethod()

virtual uInt casacore::MConvertBase::getMethod | ( | uInt | which | ) | const

pure virtual

Get method.

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## nMethod()

virtual Int casacore::MConvertBase::nMethod | ( |  | ) | const

pure virtual

Get number of methods.

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## print()

virtual void casacore::MConvertBase::print | ( | ostream & | os | ) | const

pure virtual

Print a conversion engine.

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## set() [1/2]

virtual void casacore::MConvertBase::set | ( | const MeasValue & | val | ) |

pure virtual

Set a new model value only.

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## set() [2/2]

virtual void casacore::MConvertBase::set | ( | const Unit & | inunit | ) |

pure virtual

Set a new model unit only.

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

## setModel()

virtual void casacore::MConvertBase::setModel | ( | const Measure & | val | ) |

pure virtual

Set a new model for the conversion.

Implemented in casacore::MeasConvert< M >, casacore::MeasConvert< MBaseline >, casacore::MeasConvert< MDirection >, casacore::MeasConvert< MDoppler >, casacore::MeasConvert< MEarthMagnetic >, casacore::MeasConvert< MEpoch >, casacore::MeasConvert< MFrequency >, casacore::MeasConvert< MPosition >, casacore::MeasConvert< MRadialVelocity >, and casacore::MeasConvert< Muvw >.

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

- measures/Measures/MConvertBase.h