1 #if !defined( SPECFRAME_INCLUDED ) /* Include this file only once */
2 #define SPECFRAME_INCLUDED
3 /*
4 *+
5 *  Name:
6 *     specframe.h
7 
8 *  Type:
9 *     C include file.
10 
11 *  Purpose:
12 *     Define the interface to the SpecFrame class.
13 
14 *  Invocation:
15 *     #include "specframe.h"
16 
17 *  Description:
18 *     This include file defines the interface to the SpecFrame class
19 *     and provides the type definitions, function prototypes and
20 *     macros, etc. needed to use this class.
21 
22 *  Copyright:
23 *     Copyright (C) 1997-2006 Council for the Central Laboratory of the
24 *     Research Councils
25 
26 *  Licence:
27 *     This program is free software: you can redistribute it and/or
28 *     modify it under the terms of the GNU Lesser General Public
29 *     License as published by the Free Software Foundation, either
30 *     version 3 of the License, or (at your option) any later
31 *     version.
32 *
33 *     This program is distributed in the hope that it will be useful,
34 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
35 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36 *     GNU Lesser General Public License for more details.
37 *
38 *     You should have received a copy of the GNU Lesser General
39 *     License along with this program.  If not, see
40 *     <http://www.gnu.org/licenses/>.
41 
42 *  Authors:
43 *     DSB: David S. Berry (Starlink)
44 
45 *  History:
46 *     12-NOV-2002 (DSB):
47 *        Original version.
48 *     18-OCT-2006 (DSB):
49 *        Added SpecOrigin.
50 *-
51 */
52 
53 /* Include files. */
54 /* ============== */
55 /* Interface definitions. */
56 /* ---------------------- */
57 #include "object.h"              /* Base Object class */
58 #include "frame.h"               /* Parent Frame class */
59 #include "skyframe.h"            /* Celestial coordinate systems */
60 
61 /* Macros. */
62 /* ======= */
63 #if defined(astCLASS) || defined(astFORTRAN77)
64 #define STATUS_PTR status
65 #else
66 #define STATUS_PTR astGetStatusPtr
67 #endif
68 
69 /* Define a dummy __attribute__ macro for use on non-GNU compilers. */
70 #ifndef __GNUC__
71 #  define  __attribute__(x)  /*NOTHING*/
72 #endif
73 
74 
75 #if defined(astCLASS)            /* Protected */
76 
77 /* Values used to represent different System attribute values. */
78 #define AST__FREQ          1
79 #define AST__ENERGY        2
80 #define AST__WAVENUM       3
81 #define AST__WAVELEN       4
82 #define AST__AIRWAVE       5
83 #define AST__VRADIO        6
84 #define AST__VOPTICAL      7
85 #define AST__REDSHIFT      8
86 #define AST__BETA          9
87 #define AST__VREL          10
88 
89 /* Values used to represent different StdOfRest attribute values. */
90 #define AST__BADSOR        0
91 #define AST__TPSOR         1
92 #define AST__GESOR         2
93 #define AST__BYSOR         3
94 #define AST__HLSOR         4
95 #define AST__LDSOR         5
96 #define AST__LKSOR         6
97 #define AST__LGSOR         7
98 #define AST__GLSOR         8
99 #define AST__SCSOR         9
100 #endif
101 
102 /* Type Definitions. */
103 /* ================= */
104 
105 /* Integer type used to store the spectral StdOfRest attribute. */
106 typedef int AstStdOfRestType;
107 
108 /* SpecFrame structure. */
109 /* ------------------- */
110 /* This structure contains all information that is unique to each object in
111    the class (e.g. its instance variables). */
112 typedef struct AstSpecFrame {
113 
114 /* Attributes inherited from the parent class. */
115    AstFrame frame;               /* Parent class structure */
116 
117 /* Attributes specific to objects in this class. */
118    AstStdOfRestType alignstdofrest;/* Code identifying alignment StdOfRest */
119    AstStdOfRestType stdofrest;   /* Standard of rest */
120    double refdec;                /* Dec (FK5 J2000) of source */
121    double refra;                 /* RA (FK5 J2000) of source */
122    double restfreq;              /* Rest frequency (Hz)*/
123    double sourcevel;             /* Source velocity (heliocentric, m/s) */
124    AstStdOfRestType sourcevrf;   /* Code identifying source vel. StdOfRest */
125    AstSystemType sourcesys;      /* Code identifying source vel. system */
126    int nuunits;                  /* Size of usedunits array */
127    char **usedunits;             /* Last used units for each system */
128    double specorigin;            /* Origin for sectral values */
129    int alignspecoffset;          /* Align SpecFrame in offset coords? */
130 } AstSpecFrame;
131 
132 /* Virtual function table. */
133 /* ----------------------- */
134 /* This table contains all information that is the same for all objects in the
135    class (e.g. pointers to its virtual functions). */
136 #if defined(astCLASS)            /* Protected */
137 typedef struct AstSpecFrameVtab {
138 
139 /* Properties (e.g. methods) inherited from the parent class. */
140    AstFrameVtab frame_vtab;      /* Parent class virtual function table */
141 
142 /* A Unique identifier to determine class membership. */
143    AstClassIdentifier id;
144 
145 /* Properties (e.g. methods) specific to this class. */
146    void (* GetRefPos)( AstSpecFrame *, AstSkyFrame *, double *, double *, int * );
147    void (* SetRefPos)( AstSpecFrame *, AstSkyFrame *, double, double, int * );
148 
149    AstStdOfRestType (* GetStdOfRest)( AstSpecFrame *, int * );
150    int (* TestStdOfRest)( AstSpecFrame *, int * );
151    void (* ClearStdOfRest)( AstSpecFrame *, int * );
152    void (* SetStdOfRest)( AstSpecFrame *, AstStdOfRestType, int * );
153 
154    AstStdOfRestType (* GetAlignStdOfRest)( AstSpecFrame *, int * );
155    int (* TestAlignStdOfRest)( AstSpecFrame *, int * );
156    void (* ClearAlignStdOfRest)( AstSpecFrame *, int * );
157    void (* SetAlignStdOfRest)( AstSpecFrame *, AstStdOfRestType, int * );
158 
159    AstStdOfRestType (* GetSourceVRF)( AstSpecFrame *, int * );
160    int (* TestSourceVRF)( AstSpecFrame *, int * );
161    void (* ClearSourceVRF)( AstSpecFrame *, int * );
162    void (* SetSourceVRF)( AstSpecFrame *, AstStdOfRestType, int * );
163 
164    AstSystemType (* GetSourceSys)( AstSpecFrame *, int * );
165    int (* TestSourceSys)( AstSpecFrame *, int * );
166    void (* ClearSourceSys)( AstSpecFrame *, int * );
167    void (* SetSourceSys)( AstSpecFrame *, AstSystemType, int * );
168 
169    double (* GetRestFreq)( AstSpecFrame *, int * );
170    int (* TestRestFreq)( AstSpecFrame *, int * );
171    void (* ClearRestFreq)( AstSpecFrame *, int * );
172    void (* SetRestFreq)( AstSpecFrame *, double, int * );
173 
174    double (* GetRefRA)( AstSpecFrame *, int * );
175    int (* TestRefRA)( AstSpecFrame *, int * );
176    void (* ClearRefRA)( AstSpecFrame *, int * );
177    void (* SetRefRA)( AstSpecFrame *, double, int * );
178 
179    double (* GetRefDec)( AstSpecFrame *, int * );
180    int (* TestRefDec)( AstSpecFrame *, int * );
181    void (* ClearRefDec)( AstSpecFrame *, int * );
182    void (* SetRefDec)( AstSpecFrame *, double, int * );
183 
184    double (* GetSourceVel)( AstSpecFrame *, int * );
185    int (* TestSourceVel)( AstSpecFrame *, int * );
186    void (* ClearSourceVel)( AstSpecFrame *, int * );
187    void (* SetSourceVel)( AstSpecFrame *, double, int * );
188 
189    double (* GetSpecOrigin)( AstSpecFrame *, int * );
190    int (* TestSpecOrigin)( AstSpecFrame *, int * );
191    void (* ClearSpecOrigin)( AstSpecFrame *, int * );
192    void (* SetSpecOrigin)( AstSpecFrame *, double, int * );
193 
194    int (* GetAlignSpecOffset)( AstSpecFrame *, int * );
195    int (* TestAlignSpecOffset)( AstSpecFrame *, int * );
196    void (* ClearAlignSpecOffset)( AstSpecFrame *, int * );
197    void (* SetAlignSpecOffset)( AstSpecFrame *, int, int * );
198 
199 
200 } AstSpecFrameVtab;
201 
202 
203 #if defined(THREAD_SAFE)
204 
205 /* Define a structure holding all data items that are global within this
206    class. */
207 typedef struct AstSpecFrameGlobals {
208    AstSpecFrameVtab Class_Vtab;
209    int Class_Init;
210    char GetAttrib_Buff[ 51 ];
211    char GetLabel_Buff[ 201 ];
212    char GetSymbol_Buff[ 21 ];
213    char GetTitle_Buff[ 201 ];
214 } AstSpecFrameGlobals;
215 
216 #endif
217 
218 #endif
219 
220 /* Function prototypes. */
221 /* ==================== */
222 /* Prototypes for standard class functions. */
223 /* ---------------------------------------- */
224 astPROTO_CHECK(SpecFrame)         /* Check class membership */
225 astPROTO_ISA(SpecFrame)           /* Test class membership */
226 
227 /* Constructor. */
228 #if defined(astCLASS)            /* Protected */
229 AstSpecFrame *astSpecFrame_( const char *, int *, ...);
230 #else
231 AstSpecFrame *astSpecFrameId_( const char *, ... )__attribute__((format(printf,1,2)));
232 #endif
233 
234 #if defined(astCLASS)            /* Protected */
235 
236 /* Initialiser. */
237 AstSpecFrame *astInitSpecFrame_( void *, size_t, int,
238                                          AstSpecFrameVtab *,
239                                          const char *, int * );
240 
241 /* Vtab initialiser. */
242 void astInitSpecFrameVtab_( AstSpecFrameVtab *, const char *, int * );
243 
244 /* Loader. */
245 AstSpecFrame *astLoadSpecFrame_( void *, size_t,
246                                          AstSpecFrameVtab *,
247                                          const char *, AstChannel *channel, int * );
248 
249 /* Thread-safe initialiser for all global data used by this module. */
250 #if defined(THREAD_SAFE)
251 void astInitSpecFrameGlobals_( AstSpecFrameGlobals * );
252 #endif
253 
254 #endif
255 
256 /* Prototypes for member functions. */
257 /* -------------------------------- */
258 void astGetRefPos_( AstSpecFrame *, AstSkyFrame *, double *, double *, int * );
259 void astSetRefPos_( AstSpecFrame *, AstSkyFrame *, double, double, int * );
260 
261 #if defined(astCLASS)            /* Protected */
262 
263 AstStdOfRestType astGetStdOfRest_( AstSpecFrame *, int * );
264 int astTestStdOfRest_( AstSpecFrame *, int * );
265 void astClearStdOfRest_( AstSpecFrame *, int * );
266 void astSetStdOfRest_( AstSpecFrame *, AstStdOfRestType, int * );
267 
268 AstStdOfRestType astGetAlignStdOfRest_( AstSpecFrame *, int * );
269 int astTestAlignStdOfRest_( AstSpecFrame *, int * );
270 void astClearAlignStdOfRest_( AstSpecFrame *, int * );
271 void astSetAlignStdOfRest_( AstSpecFrame *, AstStdOfRestType, int * );
272 
273 AstStdOfRestType astGetSourceVRF_( AstSpecFrame *, int * );
274 int astTestSourceVRF_( AstSpecFrame *, int * );
275 void astClearSourceVRF_( AstSpecFrame *, int * );
276 void astSetSourceVRF_( AstSpecFrame *, AstStdOfRestType, int * );
277 
278 AstSystemType astGetSourceSys_( AstSpecFrame *, int * );
279 int astTestSourceSys_( AstSpecFrame *, int * );
280 void astClearSourceSys_( AstSpecFrame *, int * );
281 void astSetSourceSys_( AstSpecFrame *, AstSystemType, int * );
282 
283 double astGetRestFreq_( AstSpecFrame *, int * );
284 int astTestRestFreq_( AstSpecFrame *, int * );
285 void astClearRestFreq_( AstSpecFrame *, int * );
286 void astSetRestFreq_( AstSpecFrame *, double, int * );
287 
288 double astGetRefRA_( AstSpecFrame *, int * );
289 int astTestRefRA_( AstSpecFrame *, int * );
290 void astClearRefRA_( AstSpecFrame *, int * );
291 void astSetRefRA_( AstSpecFrame *, double, int * );
292 
293 double astGetRefDec_( AstSpecFrame *, int * );
294 int astTestRefDec_( AstSpecFrame *, int * );
295 void astClearRefDec_( AstSpecFrame *, int * );
296 void astSetRefDec_( AstSpecFrame *, double, int * );
297 
298 double astGetSourceVel_( AstSpecFrame *, int * );
299 int astTestSourceVel_( AstSpecFrame *, int * );
300 void astClearSourceVel_( AstSpecFrame *, int * );
301 void astSetSourceVel_( AstSpecFrame *, double, int * );
302 
303 double astGetSpecOrigin_( AstSpecFrame *, int * );
304 int astTestSpecOrigin_( AstSpecFrame *, int * );
305 void astClearSpecOrigin_( AstSpecFrame *, int * );
306 void astSetSpecOrigin_( AstSpecFrame *, double, int * );
307 
308 int astGetAlignSpecOffset_( AstSpecFrame *, int * );
309 int astTestAlignSpecOffset_( AstSpecFrame *, int * );
310 void astClearAlignSpecOffset_( AstSpecFrame *, int * );
311 void astSetAlignSpecOffset_( AstSpecFrame *, int, int * );
312 
313 #endif
314 
315 /* Function interfaces. */
316 /* ==================== */
317 /* These macros are wrap-ups for the functions defined by this class
318    to make them easier to invoke (e.g. to avoid type mis-matches when
319    passing pointers to objects from derived classes). */
320 
321 /* Interfaces to standard class functions. */
322 /* --------------------------------------- */
323 /* Some of these functions provide validation, so we cannot use them
324    to validate their own arguments. We must use a cast when passing
325    object pointers (so that they can accept objects from derived
326    classes). */
327 
328 /* Check class membership. */
329 #define astCheckSpecFrame(this) astINVOKE_CHECK(SpecFrame,this,0)
330 #define astVerifySpecFrame(this) astINVOKE_CHECK(SpecFrame,this,1)
331 
332 /* Test class membership. */
333 #define astIsASpecFrame(this) astINVOKE_ISA(SpecFrame,this)
334 
335 /* Constructor. */
336 #if defined(astCLASS)            /* Protected */
337 #define astSpecFrame astINVOKE(F,astSpecFrame_)
338 #else
339 #define astSpecFrame astINVOKE(F,astSpecFrameId_)
340 #endif
341 
342 #if defined(astCLASS)            /* Protected */
343 
344 /* Initialiser. */
345 #define astInitSpecFrame(mem,size,init,vtab,name) \
346 astINVOKE(O,astInitSpecFrame_(mem,size,init,vtab,name,STATUS_PTR))
347 
348 /* Vtab Initialiser. */
349 #define astInitSpecFrameVtab(vtab,name) astINVOKE(V,astInitSpecFrameVtab_(vtab,name,STATUS_PTR))
350 /* Loader. */
351 #define astLoadSpecFrame(mem,size,vtab,name,channel) \
352 astINVOKE(O,astLoadSpecFrame_(mem,size,vtab,name,astCheckChannel(channel),STATUS_PTR))
353 
354 #endif
355 
356 /* Interfaces to public member functions. */
357 /* -------------------------------------- */
358 
359 /* None. */
360 
361 /* Interfaces to protected member functions. */
362 /* ----------------------------------------- */
363 /* Here we make use of astCheckSpecFrame to validate SpecFrame pointers
364    before use. This provides a contextual error report if a pointer to
365    the wrong sort of object is supplied. */
366 
367 #define astGetRefPos(this,frm,lon,lat) astINVOKE(V,astGetRefPos_(astCheckSpecFrame(this),(frm==NULL?NULL:astCheckSkyFrame(frm)),lon,lat,STATUS_PTR))
368 #define astSetRefPos(this,frm,lon,lat) astINVOKE(V,astSetRefPos_(astCheckSpecFrame(this),(frm==NULL?NULL:astCheckSkyFrame(frm)),lon,lat,STATUS_PTR))
369 
370 #if defined(astCLASS)            /* Protected */
371 
372 #define astGetStdOfRest(this) astINVOKE(V,astGetStdOfRest_(astCheckSpecFrame(this),STATUS_PTR))
373 #define astTestStdOfRest(this) astINVOKE(V,astTestStdOfRest_(astCheckSpecFrame(this),STATUS_PTR))
374 #define astClearStdOfRest(this) astINVOKE(V,astClearStdOfRest_(astCheckSpecFrame(this),STATUS_PTR))
375 #define astSetStdOfRest(this,value) astINVOKE(V,astSetStdOfRest_(astCheckSpecFrame(this),value,STATUS_PTR))
376 
377 #define astGetAlignStdOfRest(this) astINVOKE(V,astGetAlignStdOfRest_(astCheckSpecFrame(this),STATUS_PTR))
378 #define astTestAlignStdOfRest(this) astINVOKE(V,astTestAlignStdOfRest_(astCheckSpecFrame(this),STATUS_PTR))
379 #define astClearAlignStdOfRest(this) astINVOKE(V,astClearAlignStdOfRest_(astCheckSpecFrame(this),STATUS_PTR))
380 #define astSetAlignStdOfRest(this,value) astINVOKE(V,astSetAlignStdOfRest_(astCheckSpecFrame(this),value,STATUS_PTR))
381 
382 #define astGetSourceVRF(this) astINVOKE(V,astGetSourceVRF_(astCheckSpecFrame(this),STATUS_PTR))
383 #define astTestSourceVRF(this) astINVOKE(V,astTestSourceVRF_(astCheckSpecFrame(this),STATUS_PTR))
384 #define astClearSourceVRF(this) astINVOKE(V,astClearSourceVRF_(astCheckSpecFrame(this),STATUS_PTR))
385 #define astSetSourceVRF(this,value) astINVOKE(V,astSetSourceVRF_(astCheckSpecFrame(this),value,STATUS_PTR))
386 
387 #define astGetSourceSys(this) astINVOKE(V,astGetSourceSys_(astCheckSpecFrame(this),STATUS_PTR))
388 #define astTestSourceSys(this) astINVOKE(V,astTestSourceSys_(astCheckSpecFrame(this),STATUS_PTR))
389 #define astClearSourceSys(this) astINVOKE(V,astClearSourceSys_(astCheckSpecFrame(this),STATUS_PTR))
390 #define astSetSourceSys(this,value) astINVOKE(V,astSetSourceSys_(astCheckSpecFrame(this),value,STATUS_PTR))
391 
392 #define astGetRestFreq(this) astINVOKE(V,astGetRestFreq_(astCheckSpecFrame(this),STATUS_PTR))
393 #define astTestRestFreq(this) astINVOKE(V,astTestRestFreq_(astCheckSpecFrame(this),STATUS_PTR))
394 #define astClearRestFreq(this) astINVOKE(V,astClearRestFreq_(astCheckSpecFrame(this),STATUS_PTR))
395 #define astSetRestFreq(this,value) astINVOKE(V,astSetRestFreq_(astCheckSpecFrame(this),value,STATUS_PTR))
396 
397 #define astGetRefRA(this) astINVOKE(V,astGetRefRA_(astCheckSpecFrame(this),STATUS_PTR))
398 #define astTestRefRA(this) astINVOKE(V,astTestRefRA_(astCheckSpecFrame(this),STATUS_PTR))
399 #define astClearRefRA(this) astINVOKE(V,astClearRefRA_(astCheckSpecFrame(this),STATUS_PTR))
400 #define astSetRefRA(this,value) astINVOKE(V,astSetRefRA_(astCheckSpecFrame(this),value,STATUS_PTR))
401 
402 #define astGetRefDec(this) astINVOKE(V,astGetRefDec_(astCheckSpecFrame(this),STATUS_PTR))
403 #define astTestRefDec(this) astINVOKE(V,astTestRefDec_(astCheckSpecFrame(this),STATUS_PTR))
404 #define astClearRefDec(this) astINVOKE(V,astClearRefDec_(astCheckSpecFrame(this),STATUS_PTR))
405 #define astSetRefDec(this,value) astINVOKE(V,astSetRefDec_(astCheckSpecFrame(this),value,STATUS_PTR))
406 
407 #define astGetSourceVel(this) astINVOKE(V,astGetSourceVel_(astCheckSpecFrame(this),STATUS_PTR))
408 #define astTestSourceVel(this) astINVOKE(V,astTestSourceVel_(astCheckSpecFrame(this),STATUS_PTR))
409 #define astClearSourceVel(this) astINVOKE(V,astClearSourceVel_(astCheckSpecFrame(this),STATUS_PTR))
410 #define astSetSourceVel(this,value) astINVOKE(V,astSetSourceVel_(astCheckSpecFrame(this),value,STATUS_PTR))
411 
412 #define astGetSpecOrigin(this) astINVOKE(V,astGetSpecOrigin_(astCheckSpecFrame(this),STATUS_PTR))
413 #define astTestSpecOrigin(this) astINVOKE(V,astTestSpecOrigin_(astCheckSpecFrame(this),STATUS_PTR))
414 #define astClearSpecOrigin(this) astINVOKE(V,astClearSpecOrigin_(astCheckSpecFrame(this),STATUS_PTR))
415 #define astSetSpecOrigin(this,value) astINVOKE(V,astSetSpecOrigin_(astCheckSpecFrame(this),value,STATUS_PTR))
416 
417 #define astClearAlignSpecOffset(this) astINVOKE(V,astClearAlignSpecOffset_(astCheckSpecFrame(this),STATUS_PTR))
418 #define astGetAlignSpecOffset(this) astINVOKE(V,astGetAlignSpecOffset_(astCheckSpecFrame(this),STATUS_PTR))
419 #define astSetAlignSpecOffset(this,value) astINVOKE(V,astSetAlignSpecOffset_(astCheckSpecFrame(this),value,STATUS_PTR))
420 #define astTestAlignSpecOffset(this) astINVOKE(V,astTestAlignSpecOffset_(astCheckSpecFrame(this),STATUS_PTR))
421 
422 
423 
424 #endif
425 #endif
426 
427 
428 
429 
430 
431