casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::MeasConvert< M > Class Template Reference

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. More...
 
 MeasConvert (const MeasConvert< M > &other)
 Copy constructor. More...
 
MeasConvert< M > & operator= (const MeasConvert< M > &other)
 Copy assignment. More...
 
 MeasConvert (const M &ep)
 Construct a conversion for the specified Measure and reference. More...
 
 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. More...
 
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. More...
 
void setOut (const typename M::Ref &mr)
 Set a new output reference. More...
 
void setOut (typename M::Types mr)
 
void set (const M &val, const typename M::Ref &mr)
 Set a new model and reference. More...
 
void set (const M &val, typename M::Types mr)
 
virtual void set (const MeasValue &val)
 Set a new model value only. More...
 
virtual void set (const Unit &inunit)
 Set a new model unit only. More...
 
virtual void addMethod (uInt method)
 Add a method (Note: uInt should be an enum from the appropiate Measure) More...
 
virtual void addFrameType (uInt tp)
 Add the frame type (Note: tp should be an MeasFrame::FrameType) More...
 
virtual Int nMethod () const
 Get number of methods. More...
 
virtual uInt getMethod (uInt which) const
 Get method. More...
 
Bool isNOP ()
 Is the conversion engine empty? More...
 
virtual void print (ostream &os) const
 Print conversion engine. More...
 
- Public Member Functions inherited from casacore::MConvertBase
virtual ~MConvertBase ()
 

Private Member Functions

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

Private Attributes

Measuremodel
 The model template Measure. More...
 
Unit unit
 The model unit to be used in conversions. More...
 
M::Ref outref
 The output reference. More...
 
M::MVType * offin
 The input offset. More...
 
M::MVType * offout
 The output offset. More...
 
Block< uIntcrout
 Vector of conversion routines (length variable) More...
 
uInt crtype
 Coded (with MeasFrame::FrameTypes) frames used in conversion. More...
 
MCBasecvdat
 Local conversion data. More...
 
Int lres
 Cyclic buffer for return values. More...
 
M * result [4]
 
M::MVType * locres
 Local variables that can be used in conversion. More...
 

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

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:

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):

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.

References casacore::MeasConvert< M >::crout, and casacore::Block< T >::nelements().

◆ 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 >
Block<uInt> casacore::MeasConvert< M >::crout
private

Vector of conversion routines (length variable)

Definition at line 247 of file MeasConvert.h.

Referenced by casacore::MeasConvert< M >::isNOP().

◆ 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 >
MCBase* casacore::MeasConvert< M >::cvdat
private

Local conversion data.

Definition at line 251 of file MeasConvert.h.

◆ locres

template<class M >
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 >
Measure* casacore::MeasConvert< M >::model
private

The model template Measure.

Definition at line 237 of file MeasConvert.h.

◆ offin

template<class M >
M::MVType* casacore::MeasConvert< M >::offin
private

The input offset.

Definition at line 243 of file MeasConvert.h.

◆ offout

template<class M >
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 >
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: