1 #if !defined( TRANMAP_INCLUDED )  /* Include this file only once */
2 #define TRANMAP_INCLUDED
3 /*
4 *+
5 *  Name:
6 *     tranmap.h
7 
8 *  Type:
9 *     C include file.
10 
11 *  Purpose:
12 *     Define the interface to the TranMap class.
13 
14 *  Invocation:
15 *     #include "tranmap.h"
16 
17 *  Description:
18 *     This include file defines the interface to the TranMap class and
19 *     provides the type definitions, function prototypes and macros,
20 *     etc. needed to use this class.
21 
22 *  Inheritance:
23 *     The TranMap class inherits from the Mapping class.
24 
25 *  Attributes Over-Ridden:
26 *     None.
27 
28 *  New Attributes Defined:
29 *     None.
30 
31 *  Methods Over-Ridden:
32 *     Public:
33 *        None.
34 *
35 *     Protected:
36 *        astMapMerge
37 *           Merge a TranMap within a sequence of Mappings.
38 *        astTransform
39 *           Transform a set of points.
40 
41 *  New Methods Defined:
42 *     Public:
43 *        None.
44 *
45 *     Protected:
46 *        None.
47 
48 *  Other Class Functions:
49 *     Public:
50 *        astIsATranMap
51 *           Test class membership.
52 *        astTranMap
53 *           Create a TranMap.
54 *
55 *     Protected:
56 *        astCheckTranMap
57 *           Validate class membership.
58 *        astInitTranMap
59 *           Initialise a TranMap.
60 *        astInitTranMapVtab
61 *           Initialise the virtual function table for the TranMap class.
62 *        astLoadTranMap
63 *           Load a TranMap.
64 
65 *  Macros:
66 *     None.
67 
68 *  Type Definitions:
69 *     Public:
70 *        AstTranMap
71 *           TranMap object type.
72 *
73 *     Protected:
74 *        AstTranMapVtab
75 *           TranMap virtual function table type.
76 
77 *  Feature Test Macros:
78 *     astCLASS
79 *        If the astCLASS macro is undefined, only public symbols are
80 *        made available, otherwise protected symbols (for use in other
81 *        class implementations) are defined. This macro also affects
82 *        the reporting of error context information, which is only
83 *        provided for external calls to the AST library.
84 
85 *  Copyright:
86 *     Copyright (C) 1997-2006 Council for the Central Laboratory of the
87 *     Research Councils
88 
89 *  Licence:
90 *     This program is free software: you can redistribute it and/or
91 *     modify it under the terms of the GNU Lesser General Public
92 *     License as published by the Free Software Foundation, either
93 *     version 3 of the License, or (at your option) any later
94 *     version.
95 *
96 *     This program is distributed in the hope that it will be useful,
97 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
98 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99 *     GNU Lesser General Public License for more details.
100 *
101 *     You should have received a copy of the GNU Lesser General
102 *     License along with this program.  If not, see
103 *     <http://www.gnu.org/licenses/>.
104 
105 *  Authors:
106 *     DSB: David S. Berry (Starlink)
107 
108 *  History:
109 *     10-FEB-2004 (DSB):
110 *        Original version.
111 *-
112 */
113 
114 /* Include files. */
115 /* ============== */
116 /* Interface definitions. */
117 /* ---------------------- */
118 #include "mapping.h"             /* Coordinate Mappings (parent class) */
119 
120 #if defined(astCLASS)            /* Protected */
121 #include "pointset.h"            /* Sets of points/coordinates */
122 #include "channel.h"             /* I/O channels */
123 #endif
124 
125 /* C header files. */
126 /* --------------- */
127 #if defined(astCLASS)            /* Protected */
128 #include <stddef.h>
129 #endif
130 
131 /* Macros */
132 /* ====== */
133 
134 /* Define a dummy __attribute__ macro for use on non-GNU compilers. */
135 #ifndef __GNUC__
136 #  define  __attribute__(x)  /*NOTHING*/
137 #endif
138 
139 /* Type Definitions. */
140 /* ================= */
141 /* TranMap structure. */
142 /* ----------------- */
143 /* This structure contains all information that is unique to each
144    object in the class (e.g. its instance variables). */
145 typedef struct AstTranMap {
146 
147 /* Attributes inherited from the parent class. */
148    AstMapping mapping;           /* Parent class structure */
149 
150 /* Attributes specific to objects in this class. */
151    AstMapping *map1;             /* Pointer to first Mapping */
152    AstMapping *map2;             /* Pointer to second Mapping */
153    int invert1;                  /* Inversion flag for first Mapping */
154    int invert2;                  /* Inversion flag for second Mapping */
155 } AstTranMap;
156 
157 /* Virtual function table. */
158 /* ----------------------- */
159 /* This table contains all information that is the same for all
160    objects in the class (e.g. pointers to its virtual functions). */
161 #if defined(astCLASS)            /* Protected */
162 typedef struct AstTranMapVtab {
163 
164 /* Properties (e.g. methods) inherited from the parent class. */
165    AstMappingVtab mapping_vtab;  /* Parent class virtual function table */
166 
167 /* A Unique identifier to determine class membership. */
168    AstClassIdentifier id;
169 
170 /* Properties (e.g. methods) specific to this class. */
171 /* None. */
172 } AstTranMapVtab;
173 
174 #if defined(THREAD_SAFE)
175 
176 /* Define a structure holding all data items that are global within the
177    object.c file. */
178 
179 typedef struct AstTranMapGlobals {
180    AstTranMapVtab Class_Vtab;
181    int Class_Init;
182 } AstTranMapGlobals;
183 
184 
185 /* Thread-safe initialiser for all global data used by this module. */
186 void astInitTranMapGlobals_( AstTranMapGlobals * );
187 
188 #endif
189 
190 
191 #endif
192 
193 /* Function prototypes. */
194 /* ==================== */
195 /* Prototypes for standard class functions. */
196 /* ---------------------------------------- */
197 astPROTO_CHECK(TranMap)           /* Check class membership */
198 astPROTO_ISA(TranMap)             /* Test class membership */
199 
200 /* Constructor. */
201 #if defined(astCLASS)            /* Protected. */
202 AstTranMap *astTranMap_( void *, void *, const char *, int *, ...);
203 #else
204 AstTranMap *astTranMapId_( void *, void *, const char *, ... )__attribute__((format(printf,3,4)));
205 #endif
206 
207 #if defined(astCLASS)            /* Protected */
208 
209 /* Initialiser. */
210 AstTranMap *astInitTranMap_( void *, size_t, int, AstTranMapVtab *,
211                            const char *, AstMapping *, AstMapping *, int * );
212 
213 /* Vtab initialiser. */
214 void astInitTranMapVtab_( AstTranMapVtab *, const char *, int * );
215 
216 /* Loader. */
217 AstTranMap *astLoadTranMap_( void *, size_t, AstTranMapVtab *,
218                            const char *, AstChannel *, int * );
219 #endif
220 
221 /* Prototypes for member functions. */
222 /* -------------------------------- */
223 /* None. */
224 
225 /* Function interfaces. */
226 /* ==================== */
227 /* These macros are wrap-ups for the functions defined by this class
228    to make them easier to invoke (e.g. to avoid type mis-matches when
229    passing pointers to objects from derived classes). */
230 
231 /* Interfaces to standard class functions. */
232 /* --------------------------------------- */
233 /* Some of these functions provide validation, so we cannot use them
234    to validate their own arguments. We must use a cast when passing
235    object pointers (so that they can accept objects from derived
236    classes). */
237 
238 /* Check class membership. */
239 #define astCheckTranMap(this) astINVOKE_CHECK(TranMap,this,0)
240 #define astVerifyTranMap(this) astINVOKE_CHECK(TranMap,this,1)
241 
242 /* Test class membership. */
243 #define astIsATranMap(this) astINVOKE_ISA(TranMap,this)
244 
245 /* Constructor. */
246 #if defined(astCLASS)            /* Protected. */
247 #define astTranMap astINVOKE(F,astTranMap_)
248 #else
249 #define astTranMap astINVOKE(F,astTranMapId_)
250 #endif
251 
252 #if defined(astCLASS)            /* Protected */
253 
254 /* Initialiser. */
255 #define astInitTranMap(mem,size,init,vtab,name,map1,map2) \
256 astINVOKE(O,astInitTranMap_(mem,size,init,vtab,name,astCheckMapping(map1),astCheckMapping(map2),STATUS_PTR))
257 
258 /* Vtab Initialiser. */
259 #define astInitTranMapVtab(vtab,name) astINVOKE(V,astInitTranMapVtab_(vtab,name,STATUS_PTR))
260 /* Loader. */
261 #define astLoadTranMap(mem,size,vtab,name,channel) \
262 astINVOKE(O,astLoadTranMap_(mem,size,vtab,name,astCheckChannel(channel),STATUS_PTR))
263 #endif
264 
265 /* Interfaces to public member functions. */
266 /* -------------------------------------- */
267 /* Here we make use of astCheckTranMap to validate TranMap pointers
268    before use.  This provides a contextual error report if a pointer
269    to the wrong sort of Object is supplied. */
270 /* None. */
271 #endif
272 
273 
274 
275 
276 
277