1 #if !defined( SPECFLUXFRAME_INCLUDED ) /* Include this file only once */ 2 #define SPECFLUXFRAME_INCLUDED 3 /* 4 *+ 5 * Name: 6 * specfluxframe.h 7 8 * Type: 9 * C include file. 10 11 * Purpose: 12 * Define the interface to the SpecFluxFrame class. 13 14 * Invocation: 15 * #include "specfluxframe.h" 16 17 * Description: 18 * This include file defines the interface to the SpecFluxFrame class 19 * and provides the type definitions, function prototypes and 20 * macros, etc. needed to use this class. 21 22 * Inheritance: 23 * The SpecFluxFrame class inherits from the Frame class. 24 25 * Copyright: 26 * Copyright (C) 1997-2006 Council for the Central Laboratory of the 27 * Research Councils 28 29 * Licence: 30 * This program is free software: you can redistribute it and/or 31 * modify it under the terms of the GNU Lesser General Public 32 * License as published by the Free Software Foundation, either 33 * version 3 of the License, or (at your option) any later 34 * version. 35 * 36 * This program is distributed in the hope that it will be useful, 37 * but WITHOUT ANY WARRANTY; without even the implied warranty of 38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 39 * GNU Lesser General Public License for more details. 40 * 41 * You should have received a copy of the GNU Lesser General 42 * License along with this program. If not, see 43 * <http://www.gnu.org/licenses/>. 44 45 * Authors: 46 * DSB: David S. Berry (Starlink) 47 48 * History: 49 * 8-DEC-2004 (DSB): 50 * Original version. 51 *- 52 */ 53 54 /* Include files. */ 55 /* ============== */ 56 /* Interface definitions. */ 57 /* ---------------------- */ 58 #include "object.h" /* Base Object class */ 59 #include "cmpframe.h" /* Parent Frame class */ 60 61 #if defined(astCLASS) /* Protected */ 62 #include "channel.h" /* I/O channels */ 63 #endif 64 65 /* C header files. */ 66 /* --------------- */ 67 #if defined(astCLASS) /* Protected */ 68 #include <stddef.h> 69 #endif 70 71 /* Macros. */ 72 /* ------- */ 73 #if defined(astCLASS) || defined(astFORTRAN77) 74 #define STATUS_PTR status 75 #else 76 #define STATUS_PTR astGetStatusPtr 77 #endif 78 79 /* Define a dummy __attribute__ macro for use on non-GNU compilers. */ 80 #ifndef __GNUC__ 81 # define __attribute__(x) /*NOTHING*/ 82 #endif 83 84 /* Type Definitions. */ 85 /* ================= */ 86 /* SpecFluxFrame structure. */ 87 /* ------------------ */ 88 /* This structure contains all information that is unique to each 89 object in the class (e.g. its instance variables). */ 90 typedef struct AstSpecFluxFrame { 91 92 /* Attributes inherited from the parent class. */ 93 AstCmpFrame cmpframe; /* Parent class structure */ 94 95 } AstSpecFluxFrame; 96 97 /* Virtual function table. */ 98 /* ----------------------- */ 99 /* This table contains all information that is the same for all 100 objects in the class (e.g. pointers to its virtual functions). */ 101 #if defined(astCLASS) /* Protected */ 102 typedef struct AstSpecFluxFrameVtab { 103 104 /* Properties (e.g. methods) inherited from the parent class. */ 105 AstCmpFrameVtab frame_vtab; /* Parent class virtual function table */ 106 107 /* A Unique identifier to determine class membership. */ 108 AstClassIdentifier id; 109 110 /* Properties (e.g. methods) specific to this class. */ 111 112 } AstSpecFluxFrameVtab; 113 114 #if defined(THREAD_SAFE) 115 116 /* Define a structure holding all data items that are global within this 117 class. */ 118 typedef struct AstSpecFluxFrameGlobals { 119 AstSpecFluxFrameVtab Class_Vtab; 120 int Class_Init; 121 char GetTitle_Buff[ 201 ]; 122 } AstSpecFluxFrameGlobals; 123 124 #endif 125 #endif 126 127 /* Function prototypes. */ 128 /* ==================== */ 129 /* Prototypes for standard class functions. */ 130 /* ---------------------------------------- */ 131 astPROTO_CHECK(SpecFluxFrame) /* Check class membership */ 132 astPROTO_ISA(SpecFluxFrame) /* Test class membership */ 133 134 /* Constructor. */ 135 #if defined(astCLASS) /* Protected. */ 136 AstSpecFluxFrame *astSpecFluxFrame_( void *, void *, const char *, int *, ...); 137 #else 138 AstSpecFluxFrame *astSpecFluxFrameId_( void *, void *, const char *, ... )__attribute__((format(printf,3,4))); 139 #endif 140 141 #if defined(astCLASS) /* Protected */ 142 143 /* Initialiser. */ 144 AstSpecFluxFrame *astInitSpecFluxFrame_( void *, size_t, int, AstSpecFluxFrameVtab *, 145 const char *, AstSpecFrame *, AstFluxFrame *, int * ); 146 147 /* Vtab initialiser. */ 148 void astInitSpecFluxFrameVtab_( AstSpecFluxFrameVtab *, const char *, int * ); 149 150 /* Loader. */ 151 AstSpecFluxFrame *astLoadSpecFluxFrame_( void *, size_t, AstSpecFluxFrameVtab *, 152 const char *, AstChannel *, int * ); 153 154 /* Thread-safe initialiser for all global data used by this module. */ 155 #if defined(THREAD_SAFE) 156 void astInitSpecFluxFrameGlobals_( AstSpecFluxFrameGlobals * ); 157 #endif 158 159 #endif 160 161 /* Prototypes for member functions. */ 162 /* -------------------------------- */ 163 164 /* Function interfaces. */ 165 /* ==================== */ 166 /* These macros are wrap-ups for the functions defined by this class 167 to make them easier to invoke (e.g. to avoid type mis-matches when 168 passing pointers to objects from derived classes). */ 169 170 /* Interfaces to standard class functions. */ 171 /* --------------------------------------- */ 172 /* Some of these functions provide validation, so we cannot use them 173 to validate their own arguments. We must use a cast when passing 174 object pointers (so that they can accept objects from derived 175 classes). */ 176 177 /* Check class membership. */ 178 #define astCheckSpecFluxFrame(this) astINVOKE_CHECK(SpecFluxFrame,this,0) 179 #define astVerifySpecFluxFrame(this) astINVOKE_CHECK(SpecFluxFrame,this,1) 180 181 /* Test class membership. */ 182 #define astIsASpecFluxFrame(this) astINVOKE_ISA(SpecFluxFrame,this) 183 184 /* Constructor. */ 185 #if defined(astCLASS) /* Protected. */ 186 #define astSpecFluxFrame astINVOKE(F,astSpecFluxFrame_) 187 #else 188 #define astSpecFluxFrame astINVOKE(F,astSpecFluxFrameId_) 189 #endif 190 191 #if defined(astCLASS) /* Protected */ 192 193 /* Initialiser. */ 194 #define astInitSpecFluxFrame(mem,size,init,vtab,name,frame1,frame2) \ 195 astINVOKE(O,astInitSpecFluxFrame_(mem,size,init,vtab,name,astCheckSpecFrame(frame1),astCheckFluxFrame(frame2),STATUS_PTR)) 196 197 /* Vtab Initialiser. */ 198 #define astInitSpecFluxFrameVtab(vtab,name) astINVOKE(V,astInitSpecFluxFrameVtab_(vtab,name,STATUS_PTR)) 199 /* Loader. */ 200 #define astLoadSpecFluxFrame(mem,size,vtab,name,channel) \ 201 astINVOKE(O,astLoadSpecFluxFrame_(mem,size,vtab,name,astCheckChannel(channel),STATUS_PTR)) 202 #endif 203 204 /* Interfaces to public member functions. */ 205 /* -------------------------------------- */ 206 /* Here we make use of astCheckSpecFluxFrame to validate SpecFluxFrame pointers 207 before use. This provides a contextual error report if a pointer 208 to the wrong sort of Object is supplied. */ 209 210 #endif 211 212 213 214 215 216