casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ComponentType.h
Go to the documentation of this file.
00001 //# ComponentType.h: Enumerators common to the Components Module
00002 //# Copyright (C) 1997,1998,1999,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: ComponentType.h 21130 2011-10-18 07:39:05Z gervandiepen $
00028 
00029 #ifndef COMPONENTS_COMPONENTTYPE_H
00030 #define COMPONENTS_COMPONENTTYPE_H
00031 
00032 #include <casa/aips.h>
00033 
00034 //# Forward Declaration
00035 namespace casac {
00036       class componentlist;
00037 }
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 //# Forward Declaration
00042 class String;
00043 class SkyCompRep;
00044 class ComponentShape;
00045 class SpectralModel;
00046 
00047 
00048 // <summary>Enumerators common to the ComponentsModels module</summary>
00049 
00050 // <use visibility=export>
00051 
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tComponentType" demos="">
00053 // </reviewed>
00054 
00055 // <etymology>
00056 // This class contains the type definitions in the ComponentModels module 
00057 // </etymology>
00058 
00059 // <synopsis> 
00060 // This class does nothing.  It is merely a container for the enumerations used
00061 // by the ComponentModels module.  These enumerations define the standard
00062 // component types. It also contains:
00063 // <ul>
00064 // <li> static functions which convert between these enumerators and strings.
00065 // <li> static functions which construct the appropriate derived object given
00066 //      an enumerator. Note that these functions are only accessible by the
00067 //      friend classes <linkto class=SkyCompRep>SkyCompRep</linkto> and
00068 //      <linkto class=ComponentList>ComponentList</linkto> and should be
00069 //      considered an implementation detail.
00070 // </ul>
00071 // The first element in the enumerator must be represented by zero and every
00072 // enumerator must contain as the second last and last elements an UNKNOWN_*
00073 // and NUMBER_* element.  
00074 // </synopsis>
00075 
00076 // <example>
00077 // See the documentation for the ComponentModels classes for examples on the
00078 // use of these enumerator and functions. For example the 
00079 // <linkto class=ComponentShape>ComponentShape</linkto> class.
00080 // </example>
00081 
00082 // <todo asof="1999/11/15">
00083 // <li> Nothing I can think of.
00084 // </todo>
00085 //
00086 
00087 class ComponentType {
00088 public:
00089   // Declare which classes access the private functions which convert
00090   // enumerators to objects. The private construct functions can only be
00091   // accessed by functions in the friend classes specified below.
00092   friend class SkyCompRep;
00093   friend class ::casac::componentlist;
00094 
00095   // The shapes of all the components
00096   enum Shape {
00097     // A simple point component
00098     POINT = 0,
00099     // A elliptical Gaussian component
00100     GAUSSIAN,
00101     // A elliptical disk component
00102     DISK,
00103     // A elliptical disk component with limb-darkening effect
00104     LDISK,
00105     // An unknown Component
00106     UNKNOWN_SHAPE,
00107     // The number of types in this enumerator
00108     NUMBER_SHAPES
00109   };
00110   // The ways the Flux polarisation can be represented
00111   enum Polarisation {
00112     // The four Stokes parameters, ie I,Q,U,V 
00113     STOKES = 0,
00114     // Linear polarisation feeds ie., XX,XY,YX,YY with zero parrallactic angle
00115     LINEAR,
00116     // Circular polarisation feeds ie., RR, RL, LR, LL
00117     CIRCULAR,
00118     // An unknown Component
00119     UNKNOWN_POLARISATION,
00120     // The number of types in this enumerator
00121     NUMBER_POLARISATIONS
00122   };
00123   // The different functional forms for the spectral variation.
00124   enum SpectralShape {
00125     // The flux is constant at different frequencies
00126     CONSTANT_SPECTRUM = 0,
00127     // The flux varies as <src>I = I_0 * (nu / nu_0)^alpha</src>
00128     SPECTRAL_INDEX,
00129     //Tabular values interpolated in between
00130     TABULAR_SPECTRUM,
00131     // an unknown spectral type
00132     UNKNOWN_SPECTRAL_SHAPE,
00133     // The number of spectral types in this enumerator
00134     NUMBER_SPECTRAL_SHAPES
00135   };
00136   // Convert the Shape enumerator to a string
00137   static String name(ComponentType::Shape shapeEnum);
00138   // Convert a given String to a Shape enumerator (min match active)
00139   static ComponentType::Shape shape(const String& shapeName);
00140 
00141   // Convert the Polarisation enumerator to a string
00142   static String name(ComponentType::Polarisation fluxEnum);
00143   // Convert a given String to a Polarisation enumerator
00144   static ComponentType::Polarisation polarisation(const String& 
00145                                                   polarisationName);
00146   // Convert the SpectralShape enumerator to a string
00147   static String name(ComponentType::SpectralShape spectralEnum);
00148   // Convert a given String to a SpectralShape enumerator
00149   static ComponentType::SpectralShape spectralShape(const String&
00150                                                     spectralName);
00151 private:
00152 
00153   // Convert the Shape enumerator to a shape object (upcast to the base
00154   // object). Returns a null pointer if the object could not be
00155   // constructed. This will occur is the enumerator is UNKNOWN_SHAPE or
00156   // NUMBER_SHAPES or there is insufficient memory. The caller of this function
00157   // is responsible for deleting the pointer. 
00158   static ComponentShape* construct(ComponentType::Shape shapeEnum);
00159 
00160   // Convert the SpectralShape enumerator to a spectral model object (upcast to
00161   // the base object). Returns a null pointer if the object could not be
00162   // constructed. This will occur is the enumerator is UNKNOWN_SPECTRAL_SHAPE
00163   // or NUMBER_SPECTRAL_SHAPES or there is insufficient memory. The caller of
00164   // this function is responsible for deleting the pointer. 
00165   static SpectralModel* construct(ComponentType::SpectralShape spectralEnum);
00166 };
00167 
00168 } //# NAMESPACE CASA - END
00169 
00170 #endif