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
char tunit[FITSVALSZ]
Definition: qfits_table.h:144
int qfits_is_table(const char *filename, int xtnum)
Identify a file as containing a FITS table in extension.
Definition: qfits_table.c:99
int qfits_table_append_xtension(FILE *, const qfits_table *, const void **)
Appends a std extension header + data to a FITS table file.
Definition: qfits_table.c:1539
int qfits_table_append_xtension_hdr(FILE *, const qfits_table *, const void **, const qfits_header *)
Appends a specified extension header + data to a FITS table file.
Definition: qfits_table.c:1578
int qfits_save_table_hdrdump(const void **, const qfits_table *, const qfits_header *)
Save a table to a FITS file with a given FITS header.
Definition: qfits_table.c:1470
char * qfits_table_field_to_string(const qfits_table *, int, int, int)
given a col and a row, find out the string to write for display
Definition: qfits_table.c:1609
int atom_dec_nb
Definition: qfits_table.h:110
unsigned char * qfits_query_column_seq(const qfits_table *, int, int, int)
Extract consequtive values from a column in a FITS table.
Definition: qfits_table.c:797
int * qfits_query_column_nulls(const qfits_table *, int, const int *, int *, int *)
Detect NULL values in a column.
Definition: qfits_table.c:1310
char tlabel[FITSVALSZ]
Definition: qfits_table.h:141
void * qfits_query_column_data(const qfits_table *, int, const int *, const void *)
Extract binary data from a column in a FITS table.
Definition: qfits_table.c:898
qfits_table * qfits_table_open(const char *, int)
Read a FITS extension.
Definition: qfits_table.c:409
char nullval[FITSVALSZ]
Definition: qfits_table.h:147
int tab_t
Definition: qfits_table.h:212
qfits_table * qfits_table_new(const char *, int, int, int, int)
Table object constructor.
Definition: qfits_table.c:300
int qfits_col_fill(qfits_col *, int, int, int, tfits_type, const char *, const char *, const char *, const char *, int, float, int, float, int)
Fill a column object with some provided informations.
Definition: qfits_table.c:343
int atom_nb
Definition: qfits_table.h:104
qfits_header * qfits_table_prim_header_default(void)
Generate a default primary header to store tables.
Definition: qfits_table.c:123
char filename[512]
Definition: qfits_table.h:207
int off_beg
Definition: qfits_table.h:164
int nc
Definition: qfits_table.h:216
tfits_type atom_type
Definition: qfits_table.h:138
qfits_col * col
Definition: qfits_table.h:220
Column object.
Definition: qfits_table.h:94
int atom_size
Definition: qfits_table.h:131
qfits_header * qfits_table_ext_header_default(const qfits_table *)
Generate a default extension header to store tables.
Definition: qfits_table.c:144
FITS header object.
Definition: qfits_header.h:54
int zero_present
Definition: qfits_table.h:158
unsigned char * qfits_query_column(const qfits_table *, int, const int *)
Extract data from a column in a FITS table.
Definition: qfits_table.c:688
int nr
Definition: qfits_table.h:218
int tab_w
Definition: qfits_table.h:214
int readable
Definition: qfits_table.h:167
Table object.
Definition: qfits_table.h:202
void * qfits_query_column_seq_data(const qfits_table *, int, int, int, const void *)
Extract binary data from a column in a FITS table.
Definition: qfits_table.c:1103
char tdisp[FITSVALSZ]
Definition: qfits_table.h:150
void qfits_table_close(qfits_table *)
Free a FITS table and associated pointers.
Definition: qfits_table.c:655