casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::MeasConvert< M > Class Template Reference

Conversion of Measures. More...

#include <MBaseline.h>

Inheritance diagram for casacore::MeasConvert< M >:
casacore::MConvertBase

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 44 of file MBaseline.h.

Constructor & Destructor Documentation

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.

template<class M>
casacore::MeasConvert< M >::MeasConvert ( const MeasConvert< M > &  other)

Copy constructor.

template<class M>
casacore::MeasConvert< M >::MeasConvert ( const M &  ep)

Construct a conversion for the specified Measure and reference.

template<class M>
casacore::MeasConvert< M >::MeasConvert ( const M &  ep,
const typename M::Ref &  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const Measure ep,
const typename M::Ref &  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const M &  ep,
typename M::Types  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const Measure ep,
typename M::Types  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const typename M::Ref &  mrin,
const typename M::Ref &  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const typename M::Ref &  mrin,
typename M::Types  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( typename M::Types  mrin,
const typename M::Ref &  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( typename M::Types  mrin,
typename M::Types  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const Unit inunit,
const typename M::Ref &  mrin,
const typename M::Ref &  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const Unit inunit,
const typename M::Ref &  mrin,
typename M::Types  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const Unit inunit,
typename M::Types  mrin,
const typename M::Ref &  mr 
)
template<class M>
casacore::MeasConvert< M >::MeasConvert ( const Unit inunit,
typename M::Types  mrin,
typename M::Types  mr 
)
template<class M>
casacore::MeasConvert< M >::~MeasConvert ( )

Member Function Documentation

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.

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.

template<class M>
void casacore::MeasConvert< M >::clear ( )
private

Clear self.

template<class M>
const M::MVType& casacore::MeasConvert< M >::convert ( )
private

Convert a value.

template<class M>
const M::MVType& casacore::MeasConvert< M >::convert ( const typename M::MVType &  val)
private
template<class M>
void casacore::MeasConvert< M >::copy ( const MeasConvert< M > &  other)
private

Copy a MeasConvert.

template<class M>
void casacore::MeasConvert< M >::create ( )
private

Create the conversion routine chain.

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

Get method.

Implements casacore::MConvertBase.

template<class M>
void casacore::MeasConvert< M >::init ( )
private

Initialise pointers.

template<class M>
Bool casacore::MeasConvert< M >::isNOP ( )
inline

Is the conversion engine empty?

Definition at line 230 of file MeasConvert.h.

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

Get number of methods.

Implements casacore::MConvertBase.

template<class M>
const M& casacore::MeasConvert< M >::operator() ( )

The actual conversion operations.

Convert model Measure to output frame

template<class M>
const M& casacore::MeasConvert< M >::operator() ( Double  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const Vector< Double > &  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const Quantum< Double > &  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const Quantum< Vector< Double > > &  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const typename M::MVType &  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const MeasVal *  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const M &  val)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const M &  val,
const typename M::Ref &  mr 
)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const M &  val,
typename M::Types  mr 
)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( const typename M::Ref &  mr)
template<class M>
const M& casacore::MeasConvert< M >::operator() ( typename M::Types  mr)
template<class M>
MeasConvert<M>& casacore::MeasConvert< M >::operator= ( const MeasConvert< M > &  other)

Copy assignment.

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

Print conversion engine.

Implements casacore::MConvertBase.

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

Set a new model and reference.

template<class M>
void casacore::MeasConvert< M >::set ( const M &  val,
typename M::Types  mr 
)
template<class M>
virtual void casacore::MeasConvert< M >::set ( const MeasValue val)
virtual

Set a new model value only.

Implements casacore::MConvertBase.

template<class M>
virtual void casacore::MeasConvert< M >::set ( const Unit inunit)
virtual

Set a new model unit only.

Implements casacore::MConvertBase.

template<class M>
virtual void casacore::MeasConvert< M >::setModel ( const Measure val)
virtual

Set a new model for the conversion.

Implements casacore::MConvertBase.

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

Set a new output reference.

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

Member Data Documentation

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< MEpoch >::isNOP().

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.

template<class M>
MCBase* casacore::MeasConvert< M >::cvdat
private

Local conversion data.

Definition at line 251 of file MeasConvert.h.

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.

template<class M>
Int casacore::MeasConvert< M >::lres
private

Cyclic buffer for return values.

Current pointer

Definition at line 255 of file MeasConvert.h.

template<class M>
Measure* casacore::MeasConvert< M >::model
private

The model template Measure.

Definition at line 237 of file MeasConvert.h.

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

The input offset.

Definition at line 243 of file MeasConvert.h.

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

The output offset.

Definition at line 245 of file MeasConvert.h.

template<class M>
M::Ref casacore::MeasConvert< M >::outref
private

The output reference.

Definition at line 241 of file MeasConvert.h.

template<class M>
M* casacore::MeasConvert< M >::result[4]
private

Definition at line 256 of file MeasConvert.h.

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: