Loading...
Searching...
No Matches
casacore::MeasConvert< M > Class Template Reference
measures package (libcasa_measures) » Measures_module

More...

`#include <MeasConvert.h>`

## Public Member Functions

| MeasConvert ()
| Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Measure::TYPE where no offsets or frames are needed in the reference; Construct an empty MeasConvert.
| MeasConvert (const MeasConvert< M > &other)
| Copy constructor.
MeasConvert< M > & | operator= (const MeasConvert< M > &other)
| Copy assignment.
| MeasConvert (const M &ep)
| Construct a conversion for the specified Measure and reference.
| MeasConvert (const M &ep, const typename M::Ref &mr)
| MeasConvert (const Measure &ep, const typename M::Ref &mr)
| MeasConvert (const M &ep, typename M::Types mr)
| MeasConvert (const Measure &ep, typename M::Types mr)
| MeasConvert (const typename M::Ref &mrin, const typename M::Ref &mr)
| MeasConvert (const typename M::Ref &mrin, typename M::Types mr)
| MeasConvert (typename M::Types mrin, const typename M::Ref &mr)
| MeasConvert (typename M::Types mrin, typename M::Types mr)
| MeasConvert (const Unit &inunit, const typename M::Ref &mrin, const typename M::Ref &mr)
| MeasConvert (const Unit &inunit, const typename M::Ref &mrin, typename M::Types mr)
| MeasConvert (const Unit &inunit, typename M::Types mrin, const typename M::Ref &mr)
| MeasConvert (const Unit &inunit, typename M::Types mrin, typename M::Types mr)
| ~MeasConvert ()
const M & | operator() ()
| The actual conversion operations.
const M & | operator() (Double val)
const M & | operator() (const Vector< Double > &val)
const M & | operator() (const Quantum< Double > &val)
const M & | operator() (const Quantum< Vector< Double > > &val)
const M & | operator() (const typename M::MVType &val)
const M & | operator() (const MeasVal *val)
const M & | operator() (const M &val)
const M & | operator() (const M &val, const typename M::Ref &mr)
const M & | operator() (const M &val, typename M::Types mr)
const M & | operator() (const typename M::Ref &mr)
const M & | operator() (typename M::Types mr)
virtual void | setModel (const Measure &val)
| Set a new model for the conversion.
void | setOut (const typename M::Ref &mr)
| Set a new output reference.
void | setOut (typename M::Types mr)
void | set (const M &val, const typename M::Ref &mr)
| Set a new model and reference.
void | set (const M &val, typename M::Types mr)
virtual void | set (const MeasValue &val)
| Set a new model value only.
virtual void | set (const Unit &inunit)
| Set a new model unit only.
virtual void | addMethod (uInt method)
| Add a method (Note: uInt should be an enum from the appropiate Measure).
virtual void | addFrameType (uInt tp)
| Add the frame type (Note: tp should be an MeasFrame::FrameType).
virtual Int | nMethod () const
| Get number of methods.
virtual uInt | getMethod (uInt which) const
| Get method.
Bool | isNOP ()
| Is the conversion engine empty?
virtual void | print (ostream &os) const
| Print conversion engine.
Public Member Functions inherited from casacore::MConvertBase
virtual | ~MConvertBase ()

## Private Member Functions

void | init ()
| Initialise pointers.
void | copy (const MeasConvert< M > &other)
| Copy a MeasConvert.
void | clear ()
| Clear self.
void | create ()
| Create the conversion routine chain.
const M::MVType & | convert ()
| Convert a value.
const M::MVType & | convert (const typename M::MVType &val)

## Private Attributes

std::unique_ptr< Measure > | model
| The model template Measure.
Unit | unit
| The model unit to be used in conversions.
M::Ref | outref
| The output reference.
std::unique_ptr< typename M::MVType > | offin
| The input offset.
std::unique_ptr< typename M::MVType > | offout
| The output offset.
std::vector< uInt > | crout
| Vector of conversion routines (length variable).
uInt | crtype
| Coded (with MeasFrame::FrameTypes) frames used in conversion.
std::unique_ptr< MCBase > | cvdat
| Local conversion data.
Int | lres
| Cyclic buffer for return values.
std::unique_ptr< M > | result [4]
std::unique_ptr< typename M::MVType > | locres
| Local variables that can be used in conversion.

## Detailed Description

template<class M>
class casacore::MeasConvert< M >

Conversion of Measures

### Intended use:

Public interface

### Review Status

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

### Prerequisite

- Measure class
- MeasRef base class
- MConvertBase class
- Quantum class

### Etymology

### Synopsis

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

- MEpoch::Convert(MEpoch, MEpoch::Ref), where the MEpoch is a template for subsequent conversions, i.e. it will remember the value (with its reference) and the MeasRef output reference.
- 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 argument indicates no conversion will be attempted
. 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.

An isNOP() function is available to test if the created conversion engine is empty.

Actual conversions are done with the () operator, which produces a new MEpoch (or other appropiate 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 possible, even simple Measures will have their own internal class format, e.g. MVDouble. The possible arguments to the () conversion operator are (again Epoch is used for the generic Measure):

- (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 MeasConvert
- (Quantity): will use the conversion chain deduced from the MEpoch model in the definition of MeasConvert, and will convert the Quantity
- (Quantum<Vector<Double> >) as previous
- (Double): will use the units (if present) as specified in the MeasConvert 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. (see MCBase class for how this is done in practice).
If the standard conversion is not sufficient, additional methods can be added at the end of the list with the addMethod() member function (for real pros).

### 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 143 of file MeasConvert.h.

## Constructor & Destructor Documentation

## MeasConvert() [1/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( |  | ) |

Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Measure::TYPE where no offsets or frames are needed in the reference;
Construct an empty MeasConvert.

It is not usable, unless a setModel, and probably a setOut has been done.

## MeasConvert() [2/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const MeasConvert< M > & | other | ) |

Copy constructor.

## MeasConvert() [3/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const M & | ep | ) |

Construct a conversion for the specified Measure and reference.

## MeasConvert() [4/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const M & | ep,
|  | const typename M::Ref & | mr )

## MeasConvert() [5/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const Measure & | ep,
|  | const typename M::Ref & | mr )

## MeasConvert() [6/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const M & | ep,
|  | typename M::Types | mr )

## MeasConvert() [7/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const Measure & | ep,
|  | typename M::Types | mr )

## MeasConvert() [8/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const typename M::Ref & | mrin,
|  | const typename M::Ref & | mr )

## MeasConvert() [9/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const typename M::Ref & | mrin,
|  | typename M::Types | mr )

## MeasConvert() [10/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | typename M::Types | mrin,
|  | const typename M::Ref & | mr )

## MeasConvert() [11/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | typename M::Types | mrin,
|  | typename M::Types | mr )

## MeasConvert() [12/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const Unit & | inunit,
|  | const typename M::Ref & | mrin,
|  | const typename M::Ref & | mr )

## MeasConvert() [13/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const Unit & | inunit,
|  | const typename M::Ref & | mrin,
|  | typename M::Types | mr )

## MeasConvert() [14/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const Unit & | inunit,
|  | typename M::Types | mrin,
|  | const typename M::Ref & | mr )

## MeasConvert() [15/15]

template<class M>

casacore::MeasConvert< M >::MeasConvert | ( | const Unit & | inunit,
|  | typename M::Types | mrin,
|  | typename M::Types | mr )

## ~MeasConvert()

template<class M>

casacore::MeasConvert< M >::~MeasConvert | ( |  | ) |

## Member Function Documentation

## addFrameType()

template<class M>

virtual void casacore::MeasConvert< M >::addFrameType | ( | uInt | tp | ) |

virtual

Add the frame type (Note: tp should be an MeasFrame::FrameType).

Implements casacore::MConvertBase.

## addMethod()

template<class M>

virtual void casacore::MeasConvert< M >::addMethod | ( | uInt | method | ) |

virtual

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

Implements casacore::MConvertBase.

## clear()

template<class M>

void casacore::MeasConvert< M >::clear | ( |  | ) |

private

Clear self.

## convert() [1/2]

template<class M>

const M::MVType & casacore::MeasConvert< M >::convert | ( |  | ) |

private

Convert a value.

## convert() [2/2]

template<class M>

const M::MVType & casacore::MeasConvert< M >::convert | ( | const typename M::MVType & | val | ) |

private

## copy()

template<class M>

void casacore::MeasConvert< M >::copy | ( | const MeasConvert< M > & | other | ) |

private

Copy a MeasConvert.

## create()

template<class M>

void casacore::MeasConvert< M >::create | ( |  | ) |

private

Create the conversion routine chain.

## getMethod()

template<class M>

virtual uInt casacore::MeasConvert< M >::getMethod | ( | uInt | which | ) | const

virtual

Get method.

Implements casacore::MConvertBase.

## init()

template<class M>

void casacore::MeasConvert< M >::init | ( |  | ) |

private

Initialise pointers.

## isNOP()

template<class M>

Bool casacore::MeasConvert< M >::isNOP | ( |  | ) |

inline

Is the conversion engine empty?

Definition at line 230 of file MeasConvert.h.

## nMethod()

template<class M>

virtual Int casacore::MeasConvert< M >::nMethod | ( |  | ) | const

virtual

Get number of methods.

Implements casacore::MConvertBase.

## operator()() [1/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( |  | ) |

The actual conversion operations.

Convert model Measure to output frame

## operator()() [2/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const M & | val | ) |

## operator()() [3/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const M & | val,
|  | const typename M::Ref & | mr )

## operator()() [4/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const M & | val,
|  | typename M::Types | mr )

## operator()() [5/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const MeasVal * | val | ) |

## operator()() [6/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const Quantum< Double > & | val | ) |

## operator()() [7/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const Quantum< Vector< Double > > & | val | ) |

## operator()() [8/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const typename M::MVType & | val | ) |

## operator()() [9/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const typename M::Ref & | mr | ) |

## operator()() [10/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | const Vector< Double > & | val | ) |

## operator()() [11/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | Double | val | ) |

## operator()() [12/12]

template<class M>

const M & casacore::MeasConvert< M >::operator() | ( | typename M::Types | mr | ) |

## operator=()

template<class M>

MeasConvert< M > & casacore::MeasConvert< M >::operator= | ( | const MeasConvert< M > & | other | ) |

Copy assignment.

## print()

template<class M>

virtual void casacore::MeasConvert< M >::print | ( | ostream & | os | ) | const

virtual

Print conversion engine.

Implements casacore::MConvertBase.

## set() [1/4]

template<class M>

void casacore::MeasConvert< M >::set | ( | const M & | val,
|  | const typename M::Ref & | mr )

Set a new model and reference.

## set() [2/4]

template<class M>

void casacore::MeasConvert< M >::set | ( | const M & | val,
|  | typename M::Types | mr )

## set() [3/4]

template<class M>

virtual void casacore::MeasConvert< M >::set | ( | const MeasValue & | val | ) |

virtual

Set a new model value only.

Implements casacore::MConvertBase.

## set() [4/4]

template<class M>

virtual void casacore::MeasConvert< M >::set | ( | const Unit & | inunit | ) |

virtual

Set a new model unit only.

Implements casacore::MConvertBase.

## setModel()

template<class M>

virtual void casacore::MeasConvert< M >::setModel | ( | const Measure & | val | ) |

virtual

Set a new model for the conversion.

Implements casacore::MConvertBase.

## setOut() [1/2]

template<class M>

void casacore::MeasConvert< M >::setOut | ( | const typename M::Ref & | mr | ) |

Set a new output reference.

## setOut() [2/2]

template<class M>

void casacore::MeasConvert< M >::setOut | ( | typename M::Types | mr | ) |

## Member Data Documentation

## crout

template<class M>

std::vector<uInt> casacore::MeasConvert< M >::crout

private

Vector of conversion routines (length variable).

Definition at line 247 of file MeasConvert.h.

## crtype

template<class M>

uInt casacore::MeasConvert< M >::crtype

private

Coded (with MeasFrame::FrameTypes) frames used in conversion.

Definition at line 249 of file MeasConvert.h.

## cvdat

template<class M>

std::unique_ptr<MCBase> casacore::MeasConvert< M >::cvdat

private

Local conversion data.

Definition at line 251 of file MeasConvert.h.

## locres

template<class M>

std::unique_ptr<typename M::MVType> casacore::MeasConvert< M >::locres

private

Local variables that can be used in conversion.

Definition at line 260 of file MeasConvert.h.

## lres

template<class M>

Int casacore::MeasConvert< M >::lres

private

Cyclic buffer for return values.

Current pointer

Definition at line 255 of file MeasConvert.h.

## model

template<class M>

std::unique_ptr<Measure> casacore::MeasConvert< M >::model

private

The model template Measure.

Definition at line 237 of file MeasConvert.h.

## offin

template<class M>

std::unique_ptr<typename M::MVType> casacore::MeasConvert< M >::offin

private

The input offset.

Definition at line 243 of file MeasConvert.h.

## offout

template<class M>

std::unique_ptr<typename M::MVType> casacore::MeasConvert< M >::offout

private

The output offset.

Definition at line 245 of file MeasConvert.h.

## outref

template<class M>

M::Ref casacore::MeasConvert< M >::outref

private

The output reference.

Definition at line 241 of file MeasConvert.h.

## result

template<class M>

std::unique_ptr<M> casacore::MeasConvert< M >::result[4]

private

Definition at line 256 of file MeasConvert.h.

## unit

template<class M>

Unit casacore::MeasConvert< M >::unit

private

The model unit to be used in conversions.

Definition at line 239 of file MeasConvert.h.

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

- measures/Measures/MBaseline.h
- measures/Measures/MeasConvert.h