//# MeasValue.h: Base class for values in a Measure //# Copyright (C) 1996,1997,1998,1999,2000,2001 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# //# $Id$ #ifndef CASA_MEASVALUE_H #define CASA_MEASVALUE_H //# Includes #include #include #include namespace casacore { //# NAMESPACE CASACORE - BEGIN //# Forward Declarations template class Quantum; // // Base class for values in a Measure // // // // // //
  • Measure class // // // // // // // MeasValue forms the abstract base class for the values of quantities within // a reference frame. Examples of derived classes are: //
      //
    • MVEpoch: a moment in time //
    • MVDirection: a direction in space //
    • MVPosition: a position on Earth //
    • MVFrequency //
    • MVRadialVelocity //
    • MVDoppler //
    // MeasValue is the generic name for the more specific instances like, e.g., // MVEpoch, an instant in time.
    // MeasValues can in general be constructed from an appropiate value, or array // of values.
    // The value can be expressed in the internally used units (e.g. // days for time, a 3-vector for direction in space), as an array of internally // used units, or as a Quantum: a value with // appropiate units. Vector > // and Quantum > can // also be used. // // The value of the MeasValue can be obtained by a variety of // get functions, returning in general internal or Quantum // values. Special formatting (like hh:mm:ss.t, dd.mm.ss.t, yy/mm/dd etc) // are catered for in conversion-type classes like // MVTime, MVAngle // // Note that the class is a pure virtual class. No instances can be created, // but it describes the minimum set of functions necessary in derived functions. // In the member description a number of dummy routines are // present. They are the only way I have found to get cxx2html to // get the belonging text properly presented. // //
    // // // See individual MV and Measure classes // // // // To be able to specify a physical entity appropiate for the measured // quantity. // // // // class MeasValue { public: //# Enumerations //# Typedefs //# Friends // Output a MeasValue friend ostream &operator<<(ostream &os, const MeasValue &meas); //# Constructor // Each derived class should have at least the following constructors: // // MV() // some default // MV(Double) // some default or error if vector expected // MV(Vector) // with check for array number of elements // MV(Quantity) // MV(Vector) // MV(Quantum > // // Float (or other standard type) versions could be added if appropiate. // Dummy for cxx2html void dummy_constr() const {;}; //# Destructor // Destructor virtual ~MeasValue(); //# Operators // The following operators should be present at least. // // MV &operator+=(const MV &meas); // MV &operator-=(const MV &meas); // Bool operator==(const MV &meas) const; // Bool operator!=(const MV &meas) const; // Bool near(const MV &meas, Double tol = 1e-13) const; // Bool nearAbs(const MV &meas, Double tol = 1e-13) const; // // Dummy for cxx2html void dummy_operator() const {;}; //# General Member Functions // Print a MeasValue virtual void print(ostream &os) const = 0; // Clone a MeasValue virtual MeasValue *clone() const = 0; // Get the internal value as a Vector. // Note that the vector could // be empty, or not be a true representation (different data sizes e.g.) virtual Vector getVector() const = 0; // Get the internal value as a Vector. Usable in // records. The getXRecordValue() gets additional information for records. // The getTMRecordValue() gets the record values as deemed appropriate for // the TableMeasures. // Note that the Vectors could be empty. // virtual Vector > getRecordValue() const = 0; virtual Vector > getXRecordValue() const; virtual Vector > getTMRecordValue() const; // // Set the internal value from a Vector of values (obtained in principle // with a getVector()). It will be assumed that the Vector is correctly // formatted. If Vector is too long, the remainder will be discarded. // If Vector is too short, action will depend on the individual classes, // but in general act the same way as a constructor with a short Vector. virtual void putVector(const Vector &in) = 0; // Set the internal value if correct values and dimensions virtual Bool putValue(const Vector > &in) = 0; // Some of the Measure values used need the occasional adjustments to proper // values. Examples are MVDirection (direction cosines) which have to be // normalised to a length of 1 and MEpoch (time) which have to have its // precision maintained. For others it is an effctive no-operation. // // Adjust value virtual void adjust(); // Adjust value and return a normalisation value virtual void adjust(Double &val); // Re-adjust, i.e. undo a previous adjust, with value virtual void readjust(Double val); // private: }; //# Global functions // Global functions // // Output declaration ostream &operator<<(ostream &os, const MeasValue &meas); // } //# NAMESPACE CASACORE - END #endif