casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
casa::MeasConvert< M > Class Template Reference

Conversion of Measures. More...

#include <MeasConvert.h>

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

List of all members.

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.

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

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

Detailed Description

template<class M>
class casa::MeasConvert< M >

Conversion of Measures.

Intended use:

Public interface

 <h3>Review Status</h3><dl><dt>Reviewed By:<dd>UNKNOWN<dt>Date Reviewed:<dd>before2004/08/25<dt>Test programs:<dd>tMeasure</dl> 

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


Constructor & Destructor Documentation

template<class M>
casa::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>
casa::MeasConvert< M >::MeasConvert ( const MeasConvert< M > &  other)

Copy constructor.

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

Construct a conversion for the specified Measure and reference.

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

    


Member Function Documentation

template<class M>
virtual void casa::MeasConvert< M >::addFrameType ( uInt  tp) [virtual]

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

Implements casa::MConvertBase.

template<class M>
virtual void casa::MeasConvert< M >::addMethod ( uInt  method) [virtual]

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

Implements casa::MConvertBase.

template<class M>
void casa::MeasConvert< M >::clear ( ) [private]

Clear self.

template<class M>
const M::MVType& casa::MeasConvert< M >::convert ( ) [private]

Convert a value.

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

Copy a MeasConvert.

template<class M>
void casa::MeasConvert< M >::create ( ) [private]

Create the conversion routine chain.

template<class M>
virtual uInt casa::MeasConvert< M >::getMethod ( uInt  which) const [virtual]

Get method.

Implements casa::MConvertBase.

template<class M>
void casa::MeasConvert< M >::init ( ) [private]

Initialise pointers.

template<class M>
Bool casa::MeasConvert< M >::isNOP ( ) [inline]

Is the conversion engine empty?

Definition at line 232 of file MeasConvert.h.

template<class M>
virtual Int casa::MeasConvert< M >::nMethod ( ) const [virtual]

Get number of methods.

Implements casa::MConvertBase.

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

The actual conversion operations.

Convert model Measure to output frame

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

Copy assignment.

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

Print conversion engine.

Implements casa::MConvertBase.

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

Set a new model and reference.

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

Set a new model value only.

Implements casa::MConvertBase.

template<class M>
virtual void casa::MeasConvert< M >::set ( const Unit inunit) [virtual]

Set a new model unit only.

Implements casa::MConvertBase.

template<class M>
virtual void casa::MeasConvert< M >::setModel ( const Measure val) [virtual]

Set a new model for the conversion.

Implements casa::MConvertBase.

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

Set a new output reference.

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

Member Data Documentation

template<class M>
Block<uInt> casa::MeasConvert< M >::crout [private]

Vector of conversion routines (length variable)

Definition at line 249 of file MeasConvert.h.

Referenced by casa::MeasConvert< MEpoch >::isNOP().

template<class M>
uInt casa::MeasConvert< M >::crtype [private]

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

Definition at line 251 of file MeasConvert.h.

template<class M>
MCBase* casa::MeasConvert< M >::cvdat [private]

Local conversion data.

Definition at line 253 of file MeasConvert.h.

template<class M>
M::MVType* casa::MeasConvert< M >::locres [private]

Local variables that can be used in conversion.

Definition at line 262 of file MeasConvert.h.

template<class M>
Int casa::MeasConvert< M >::lres [private]

Cyclic buffer for return values.

Current pointer

Definition at line 257 of file MeasConvert.h.

template<class M>
Measure* casa::MeasConvert< M >::model [private]

The model template Measure.

Definition at line 239 of file MeasConvert.h.

template<class M>
M::MVType* casa::MeasConvert< M >::offin [private]

The input offset.

Definition at line 245 of file MeasConvert.h.

template<class M>
M::MVType* casa::MeasConvert< M >::offout [private]

The output offset.

Definition at line 247 of file MeasConvert.h.

template<class M>
M::Ref casa::MeasConvert< M >::outref [private]

The output reference.

Definition at line 243 of file MeasConvert.h.

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

Definition at line 258 of file MeasConvert.h.

template<class M>
Unit casa::MeasConvert< M >::unit [private]

The model unit to be used in conversions.

Definition at line 241 of file MeasConvert.h.


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