casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCPosition.h
Go to the documentation of this file.
1 //# MCPosition.h: MPosition conversion routines
2 //# Copyright (C) 1995,1996,1997,1998,1999,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef MEASURES_MCPOSITION_H
30 #define MEASURES_MCPOSITION_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
39 #include <casacore/casa/OS/Mutex.h>
40 
41 namespace casacore { //# NAMESPACE CASACORE - BEGIN
42 
43 //# Forward Declarations
44 class MCPosition;
45 class String;
46 template <class T> class Vector;
47 
48 //# Typedefs
49 
50 // <summary> MPosition conversion routines </summary>
51 
52 // <use visibility=local>
53 
54 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
55 // </reviewed>
56 
57 // <prerequisite>
58 // <li> <linkto class=Measure>Measure</linkto> class
59 // <li> <linkto class=MCBase>MCBase</linkto> base class
60 // <li> <linkto class=MConvertBase>overall conversion</linkto> class
61 // </prerequisite>
62 //
63 // <etymology>
64 // Measure, Convert and Position
65 // </etymology>
66 //
67 // <synopsis>
68 // Contains state machinery and caching for actual conversions
69 // </synopsis>
70 //
71 // <example>
72 // See <linkto class=Measure>Measure</linkto> for conversion example.
73 // </example>
74 //
75 // <motivation>
76 // </motivation>
77 //
78 // <todo asof="1996/02/21">
79 // <li>
80 // </todo>
81 
82 class MCPosition : public MCBase {
83 
84 public:
85 
86  //# Friends
87  // Conversion of data
88  friend class MeasConvert<MPosition>;
89 
90  //# Constructors
91  // Default constructor
92  MCPosition();
93 
94  //# Destructor
95  ~MCPosition();
96 
97  //# Member functions
98  // Show the state of the conversion engine (mainly for debugging purposes)
99  static String showState();
100 
101 private:
102  //# Enumerations
103  // The list of actual routines provided.
104  // <note role=warning> Each <src>AA_BB</src> in the list points to routine
105  // that can be used in the FromTo list in the getConvert routine.
106  // In addition the type to which each is converted should be in the
107  // ToRef array, again in the proper order. </note>
108  enum Routes {
112 
113  //# Typedefs
114 
115  //# Operators
116 
117  //# General Member Functions
118 
119  //# Enumerations
120 
121  //# Cached Data
123 
124  //# State machine data
125  // Transition list
126  static uInt ToRef_p[N_Routes][3];
127  // Transition matrix
129  // Object to ensure safe multi-threaded lazy single initialization
131 
132  //# Constructors
133  // Copy constructor (not implemented)
134  MCPosition(const MCPosition &other);
135  // Assignment (not implemented)
136  MCPosition &operator=(const MCPosition &other);
137 
138  //# Member functions
139 
140  // Create conversion function pointer
141  virtual void getConvert(MConvertBase &mc,
142  const MRBase &inref,
143  const MRBase &outref);
144 
145  // Create help structures for Measure conversion routines
146  virtual void initConvert(uInt which, MConvertBase &mc);
147 
148  // Delete the pointers used in the MeasConvert help structure cache
149  virtual void clearConvert();
150 
151  // Routine to do actual conversion
152  virtual void doConvert(MeasValue &in,
153  MRBase &inref,
154  MRBase &outref,
155  const MConvertBase &mc);
156  // Conversion routine to cater for inheritance question
157  void doConvert(MVPosition &in,
158  MRBase &inref,
159  MRBase &outref,
160  const MConvertBase &mc);
161 
162 private:
163  // Fill the global state. Called using theirInitOnce.
164  static void doFillState();
165 };
166 
167 
168 } //# NAMESPACE CASACORE - END
169 
170 #endif
Wrapper around std::call_once.
Definition: Mutex.h:214
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routine to do actual conversion.
A Measure: position on Earth.
Definition: MPosition.h:79
Conversion of Measures.
Definition: MDirection.h:43
Routes
Each derived class should have a list of routines to be called:
Definition: MCBase.h:134
std::vector< double > Vector
Definition: ds9context.h:24
Base for Reference frame for physical measures.
Definition: MRBase.h:103
Base for specific measure conversions.
Definition: MCBase.h:119
MCPosition & operator=(const MCPosition &other)
Assignment (not implemented)
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCPosition.h:126
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
static CallOnce0 theirInitOnce
Object to ensure safe multi-threaded lazy single initialization.
Definition: MCPosition.h:130
static uInt FromTo_p[MPosition::N_Types][MPosition::N_Types]
Transition matrix.
Definition: MCPosition.h:128
Vector< Double > * DVEC1
Definition: MCPosition.h:122
Base class for values in a Measure.
Definition: MeasValue.h:107
MCPosition()
Default constructor.
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
A 3D vector in space.
Definition: MVPosition.h:113
MPosition conversion routines.
Definition: MCPosition.h:82
static void doFillState()
Fill the global state.
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
unsigned int uInt
Definition: aipstype.h:51
Conversion of Measures Base.
Definition: MConvertBase.h:147
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42