C Standard Library Extensions  6.2.0
qfits_table.h
1 /* $Id: qfits_table.h,v 1.1.1.1 2008-11-03 13:40:49 agabasch Exp $
2  *
3  * This file is part of the ESO QFITS Library
4  * Copyright (C) 2001-2004 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: agabasch $
23  * $Date: 2008-11-03 13:40:49 $
24  * $Revision: 1.1.1.1 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef QFITS_TABLE_H
29 #define QFITS_TABLE_H
30 
31 /*-----------------------------------------------------------------------------
32  Includes
33  -----------------------------------------------------------------------------*/
34 
35 #include <stdio.h>
36 #include <string.h>
37 #include <stdlib.h>
38 #include <unistd.h>
39 
40 #include "qfits_header.h"
41 
42 /*-----------------------------------------------------------------------------
43  Defines
44  -----------------------------------------------------------------------------*/
45 
46 /* The following defines the maximum acceptable size for a FITS value */
47 #define FITSVALSZ 60
48 
49 #define QFITS_INVALIDTABLE 0
50 #define QFITS_BINTABLE 1
51 #define QFITS_ASCIITABLE 2
52 
53 /*-----------------------------------------------------------------------------
54  New types
55  -----------------------------------------------------------------------------*/
56 
57 /*----------------------------------------------------------------------------*/
61 /*----------------------------------------------------------------------------*/
62 typedef enum _TFITS_DATA_TYPE_ {
63  TFITS_ASCII_TYPE_A,
64  TFITS_ASCII_TYPE_D,
65  TFITS_ASCII_TYPE_E,
66  TFITS_ASCII_TYPE_F,
67  TFITS_ASCII_TYPE_I,
68  TFITS_BIN_TYPE_A,
69  TFITS_BIN_TYPE_B,
70  TFITS_BIN_TYPE_C,
71  TFITS_BIN_TYPE_D,
72  TFITS_BIN_TYPE_E,
73  TFITS_BIN_TYPE_I,
74  TFITS_BIN_TYPE_J,
75  TFITS_BIN_TYPE_L,
76  TFITS_BIN_TYPE_M,
77  TFITS_BIN_TYPE_P,
78  TFITS_BIN_TYPE_X,
79  TFITS_BIN_TYPE_UNKNOWN
80 } tfits_type ;
81 
82 /*----------------------------------------------------------------------------*/
93 /*----------------------------------------------------------------------------*/
94 typedef struct qfits_col
95 {
104  int atom_nb ;
105 
111 
131  int atom_size ;
132 
138  tfits_type atom_type ;
139 
141  char tlabel[FITSVALSZ] ;
142 
144  char tunit[FITSVALSZ] ;
145 
147  char nullval[FITSVALSZ] ;
148 
150  char tdisp[FITSVALSZ] ;
151 
159  float zero ;
160  int scale_present ;
161  float scale ;
162 
164  int off_beg ;
165 
167  int readable ;
168 } qfits_col ;
169 
170 
171 /*----------------------------------------------------------------------------*/
201 /*----------------------------------------------------------------------------*/
202 typedef struct qfits_table
203 {
207  char filename[512] ;
212  int tab_t ;
214  int tab_w ;
216  int nc ;
218  int nr ;
221 } qfits_table ;
222 
223 /*-----------------------------------------------------------------------------
224  Function prototypes
225  -----------------------------------------------------------------------------*/
226 
227 int qfits_is_table(const char * filename, int xtnum) ;
230 qfits_table * qfits_table_new(const char *, int, int, int, int) ;
231 int qfits_col_fill(qfits_col *, int, int, int, tfits_type, const char *,
232  const char *, const char *, const char *, int, float, int, float, int) ;
233 qfits_table * qfits_table_open(const char *, int) ;
235 unsigned char * qfits_query_column(const qfits_table *, int, const int *) ;
236 unsigned char * qfits_query_column_seq(const qfits_table *, int, int, int) ;
237 void * qfits_query_column_data(const qfits_table *, int, const int *,
238  const void *) ;
239 void * qfits_query_column_seq_data(const qfits_table *, int, int, int,
240  const void *) ;
241 int * qfits_query_column_nulls(const qfits_table *, int, const int *, int *,
242  int *);
243 int qfits_save_table_hdrdump(const void **, const qfits_table *,
244  const qfits_header *) ;
245 int qfits_table_append_xtension(FILE *, const qfits_table *, const void **) ;
246 int qfits_table_append_xtension_hdr(FILE *, const qfits_table *, const void **,
247  const qfits_header *) ;
248 char * qfits_table_field_to_string(const qfits_table *, int, int, int) ;
249 
250 #endif