uves_propertylist.h

00001 /* $Id: uves_propertylist.h,v 1.11 2010/09/24 09:32:07 amodigli Exp $
00002  *
00003  * This file is part of the ESO Common Pipeline Library
00004  * Copyright (C) 2001-2005 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: amodigli $
00023  * $Date: 2010/09/24 09:32:07 $
00024  * $Revision: 1.11 $
00025  * $Name: uves-4_9_1 $
00026  */
00027 
00028 #ifndef UVES_PROPERTYLIST_H
00029 #define UVES_PROPERTYLIST_H
00030 
00031 /* Define appropriately to switch on/off cpl_propertylists */
00032 #undef USE_CPL
00033 //#define USE_CPL
00034 
00035 #ifdef USE_CPL
00036 /* Workaround code ahead. No, it is not nice. */
00037 #include <cpl.h>
00038 #include <fitsio.h>
00039 #include <longnam.h>
00040 
00041 #define uves_propertylist cpl_propertylist
00042 
00043 #define uves_vector_save(a, b, c, d, e) \
00044  cpl_vector_save(a, b, c, d, e)
00045 #define uves_image_save(a, b, c, d, e) \
00046  cpl_image_save(a, b, c, d, e)
00047 #define uves_imagelist_save(a, b, c, d, e) \
00048  cpl_imagelist_save(a, b, c, d, e)
00049 #define uves_table_save(a, b, c, d, e) \
00050  cpl_table_save(a, b, c, d, e)
00051 #define uves_dfs_setup_product_header(a, b, c, d, e, f, g) \
00052  cpl_dfs_setup_product_header(a, b, c, d, e, f, g)
00053 //#define uves_table_sort(a, b)
00054 // cpl_table_sort(a, b)
00055 #define uves_propertylist_new() \
00056  cpl_propertylist_new()
00057 #define uves_propertylist_duplicate(a) \
00058  cpl_propertylist_duplicate(a)
00059 #define uves_propertylist_delete(a) \
00060  cpl_propertylist_delete(a)
00061 #define uves_propertylist_get_size(a) \
00062  cpl_propertylist_get_size(a)
00063 #define uves_propertylist_is_empty(a) \
00064  cpl_propertylist_is_empty(a)
00065 #define uves_propertylist_get_type(a, b) \
00066  cpl_propertylist_get_type(a, b)
00067 #define uves_propertylist_contains(a, b) \
00068  cpl_propertylist_contains(a, b)
00069 #define my_uves_propertylist_contains(a, b) \
00070  cpl_propertylist_contains(a, b)
00071 
00072 #define uves_propertylist_set_comment(a, b, c) \
00073  cpl_propertylist_set_comment(a, b, c)
00074 #define uves_propertylist_set_char(a, b, c) \
00075  cpl_propertylist_set_char(a, b, c)
00076 #define uves_propertylist_set_bool(a, b, c) \
00077  cpl_propertylist_set_bool(a, b, c)
00078 #define uves_propertylist_set_int(a, b, c) \
00079  cpl_propertylist_set_int(a, b, c)
00080 #define uves_propertylist_set_long(a, b, c) \
00081  cpl_propertylist_set_long(a, b, c)
00082 #define uves_propertylist_set_float(a, b, c) \
00083  cpl_propertylist_set_float(a, b, c)
00084 #define uves_propertylist_set_double(a, b, c) \
00085  cpl_propertylist_set_double(a, b, c)
00086 #define uves_propertylist_set_string(a, b, c) \
00087  cpl_propertylist_set_string(a, b, c)
00088 #define uves_propertylist_get_const(a, b) \
00089  cpl_propertylist_get(a, b)
00090 #define uves_propertylist_get(a, b) \
00091  cpl_propertylist_get(a, b)
00092 #define uves_propertylist_get_comment(a, b) \
00093  cpl_propertylist_get_comment(a, b)
00094 #define uves_propertylist_get_char(a, b) \
00095  cpl_propertylist_get_char(a, b)
00096 #define uves_propertylist_get_bool(a, b) \
00097  cpl_propertylist_get_bool(a, b)
00098 #define uves_propertylist_get_int(a, b) \
00099  cpl_propertylist_get_int(a, b)
00100 #define uves_propertylist_get_long(a, b) \
00101  cpl_propertylist_get_long(a, b)
00102 #define uves_propertylist_get_float(a, b) \
00103  cpl_propertylist_get_float(a, b)
00104 #define uves_propertylist_get_double(a, b) \
00105  cpl_propertylist_get_double(a, b)
00106 #define uves_propertylist_get_string(a, b) \
00107  cpl_propertylist_get_string(a, b)
00108 #define uves_propertylist_insert_char(a, b, c, d) \
00109  cpl_propertylist_insert_char(a, b, c, d)
00110 #define uves_propertylist_insert_bool(a, b, c, d) \
00111  cpl_propertylist_insert_bool(a, b, c, d)
00112 #define uves_propertylist_insert_int(a, b, c, d) \
00113  cpl_propertylist_insert_int(a, b, c, d)
00114 #define uves_propertylist_insert_long(a, b, c, d) \
00115  cpl_propertylist_insert_long(a, b, c, d)
00116 #define uves_propertylist_insert_float(a, b, c, d) \
00117  cpl_propertylist_insert_float(a, b, c, d)
00118 #define uves_propertylist_insert_double(a, b, c, d) \
00119  cpl_propertylist_insert_double(a, b, c, d)
00120 #define uves_propertylist_insert_string(a, b, c, d) \
00121  cpl_propertylist_insert_string(a, b, c, d)
00122 #define uves_propertylist_insert_after_char(a, b, c, d) \
00123  cpl_propertylist_insert_after_char(a, b, c, d)
00124 #define uves_propertylist_insert_after_bool(a, b, c, d) \
00125  cpl_propertylist_insert_after_bool(a, b, c, d)
00126 #define uves_propertylist_insert_after_int(a, b, c, d) \
00127  cpl_propertylist_insert_after_int(a, b, c, d)
00128 #define uves_propertylist_insert_after_long(a, b, c, d) \
00129  cpl_propertylist_insert_after_long(a, b, c, d)
00130 #define uves_propertylist_insert_after_float(a, b, c, d) \
00131  cpl_propertylist_insert_after_float(a, b, c, d)
00132 #define uves_propertylist_insert_after_double(a, b, c, d) \
00133  cpl_propertylist_insert_after_double(a, b, c, d)
00134 #define uves_propertylist_insert_after_string(a, b, c, d) \
00135  cpl_propertylist_insert_after_string(a, b, c, d)
00136 #define uves_propertylist_prepend_char(a, b, c) \
00137  cpl_propertylist_prepend_char(a, b, c)
00138 #define uves_propertylist_prepend_bool(a, b, c) \
00139  cpl_propertylist_prepend_bool(a, b, c)
00140 #define uves_propertylist_prepend_int(a, b, c) \
00141  cpl_propertylist_prepend_int(a, b, c)
00142 #define uves_propertylist_prepend_long(a, b, c) \
00143  cpl_propertylist_prepend_long(a, b, c)
00144 #define uves_propertylist_prepend_float(a, b, c) \
00145  cpl_propertylist_prepend_float(a, b, c)
00146 #define uves_propertylist_prepend_double(a, b, c) \
00147  cpl_propertylist_prepend_double(a, b, c)
00148 #define uves_propertylist_prepend_string(a, b, c) \
00149  cpl_propertylist_prepend_string(a, b, c)
00150 #define uves_propertylist_append_char(a, b, c) \
00151  cpl_propertylist_append_char(a, b, c)
00152 #define uves_propertylist_append_bool(a, b, c) \
00153  cpl_propertylist_append_bool(a, b, c)
00154 #define uves_propertylist_append_int(a, b, c) \
00155  cpl_propertylist_append_int(a, b, c)
00156 #define uves_propertylist_append_long(a, b, c) \
00157  cpl_propertylist_append_long(a, b, c)
00158 #define uves_propertylist_append_float(a, b, c) \
00159  cpl_propertylist_append_float(a, b, c)
00160 #define uves_propertylist_append_double(a, b, c) \
00161  cpl_propertylist_append_double(a, b, c)
00162 #define uves_propertylist_append_string(a, b, c) \
00163  cpl_propertylist_append_string(a, b, c)
00164 #define uves_propertylist_append(a, b) \
00165  cpl_propertylist_append(a, b)
00166 #define uves_propertylist_erase(a, b) \
00167  cpl_propertylist_erase(a, b)
00168 #define uves_propertylist_erase_regexp(a, b, c) \
00169  cpl_propertylist_erase_regexp(a, b, c)
00170 #define uves_propertylist_empty(a) \
00171  cpl_propertylist_empty(a)
00172 #define uves_propertylist_update_char(a, b, c) \
00173  cpl_propertylist_update_char(a, b, c)
00174 #define uves_propertylist_update_bool(a, b, c) \
00175  cpl_propertylist_update_bool(a, b, c)
00176 #define uves_propertylist_update_int(a, b, c) \
00177  cpl_propertylist_update_int(a, b, c)
00178 #define uves_propertylist_update_long(a, b, c) \
00179  cpl_propertylist_update_long(a, b, c)
00180 #define uves_propertylist_update_float(a, b, c) \
00181  cpl_propertylist_update_float(a, b, c)
00182 #define uves_propertylist_update_double(a, b, c) \
00183  cpl_propertylist_update_double(a, b, c)
00184 #define uves_propertylist_update_string(a, b, c) \
00185  cpl_propertylist_update_string(a, b, c)
00186 #define uves_propertylist_copy_property(a, b, c) \
00187  cpl_propertylist_copy_property(a, b, c)
00188 #define uves_propertylist_copy_property_regexp(a, b, c, d) \
00189  cpl_propertylist_copy_property_regexp(a, b, c, d) 
00190 #define uves_propertylist_load(a, b) \
00191  cpl_propertylist_load(a, b)  
00192 #define uves_propertylist_load_regexp(a, b, c, d) \
00193  cpl_propertylist_load_regexp(a, b, c, d) 
00194 #define uves_propertylist_to_fits(a) \
00195  cpl_propertylist_to_fits(a) 
00196 #define uves_propertylist_from_fits(a) \
00197      cpl_propertylist_from_fits(a) 
00198 
00199 #else /* if USE_CPL */
00200 
00201 #include <cpl.h>
00202 #include <qfits.h>
00203 
00211 typedef struct _uves_propertylist_ uves_propertylist;
00212 
00213 
00214 /*
00215  * Wrappers for functions which have cpl_propertylists in their interface 
00216  */
00217 cpl_error_code uves_vector_save(const cpl_vector *v, const char *f, cpl_type_bpp bpp,
00218                                 const uves_propertylist *header, unsigned mode);
00219 cpl_error_code uves_image_save(const cpl_image *image, const char *f, cpl_type_bpp bpp,
00220                                const uves_propertylist *header, unsigned mode);
00221 cpl_error_code uves_imagelist_save(const cpl_imagelist *imagelist, const char *f, cpl_type_bpp bpp,
00222                    const uves_propertylist *header, unsigned mode);
00223 cpl_error_code uves_table_save(const cpl_table *table, const uves_propertylist *header,
00224                    const uves_propertylist *ext_header, const char *filename,
00225                    unsigned mode);
00226 cpl_error_code uves_dfs_setup_product_header(uves_propertylist *header,
00227                                              const cpl_frame *frame,
00228                                              const cpl_frameset *set,
00229                                              const cpl_parameterlist *par,
00230                                              const char *c1,
00231                                              const char *c2,
00232                                              const char *c3);
00233 cpl_error_code uves_table_sort(cpl_table *, const uves_propertylist *);
00234 
00235 /*
00236  * Create, copy and destroy operations.
00237  */
00238 
00239 uves_propertylist *
00240 uves_propertylist_new(void);
00241 
00242 uves_propertylist *
00243 uves_propertylist_duplicate(const uves_propertylist *other);
00244 
00245 void
00246 uves_propertylist_delete(const uves_propertylist *self);
00247 
00248 
00249 /*
00250  * Non modifying operations
00251  */
00252 
00253 long
00254 uves_propertylist_get_size(const uves_propertylist *self);
00255 
00256 int
00257 uves_propertylist_is_empty(const uves_propertylist *self);
00258 
00259 cpl_type
00260 uves_propertylist_get_type(const uves_propertylist *self, const char *name);
00261 
00262 int
00263 uves_propertylist_contains(const uves_propertylist *self, const char *name);
00264 
00265 int
00266 my_uves_propertylist_contains(const cpl_propertylist *self, const char *name);
00267 
00268 
00269 /*
00270  * Assignment operations
00271  */
00272 
00273 cpl_error_code
00274 uves_propertylist_set_comment(uves_propertylist *self, const char *name,
00275                              const char *comment);
00276 cpl_error_code
00277 uves_propertylist_set_char(uves_propertylist *self, const char *name,
00278                           char value);
00279 cpl_error_code
00280 uves_propertylist_set_bool(uves_propertylist *self, const char *name ,
00281                           int value);
00282 cpl_error_code
00283 uves_propertylist_set_int(uves_propertylist *self, const char *name,
00284                          int value);
00285 cpl_error_code
00286 uves_propertylist_set_long(uves_propertylist *self, const char *name,
00287                           long value);
00288 cpl_error_code
00289 uves_propertylist_set_float(uves_propertylist *self, const char *name,
00290                            float value);
00291 cpl_error_code
00292 uves_propertylist_set_double(uves_propertylist *self, const char *name,
00293                             double value);
00294 cpl_error_code
00295 uves_propertylist_set_string(uves_propertylist *self, const char *name,
00296                             const char *value);
00297 
00298 /*
00299  * Element access
00300  */
00301 
00302 const cpl_property *
00303 uves_propertylist_get_const(const uves_propertylist *self, long position);
00304 
00305 cpl_property *
00306 uves_propertylist_get(uves_propertylist *self, long position);
00307 
00308 const char *
00309 uves_propertylist_get_comment(const uves_propertylist *self, const char *name);
00310 
00311 char
00312 uves_propertylist_get_char(const uves_propertylist *self, const char *name);
00313 
00314 int
00315 uves_propertylist_get_bool(const uves_propertylist *self, const char *name);
00316 
00317 int
00318 uves_propertylist_get_int(const uves_propertylist *self, const char *name);
00319 
00320 long
00321 uves_propertylist_get_long(const uves_propertylist *self, const char *name);
00322 
00323 float
00324 uves_propertylist_get_float(const uves_propertylist *self, const char *name);
00325 
00326 double
00327 uves_propertylist_get_double(const uves_propertylist *self, const char *name);
00328 
00329 const char *
00330 uves_propertylist_get_string(const uves_propertylist *self, const char *name);
00331 
00332 
00333 /*
00334  * Inserting and removing elements
00335  */
00336 
00337 cpl_error_code
00338 uves_propertylist_insert_char(uves_propertylist *self, const char *here,
00339                              const char *name, char value);
00340 
00341 cpl_error_code
00342 uves_propertylist_insert_bool(uves_propertylist *self, const char *here,
00343                              const char *name, int value);
00344 
00345 cpl_error_code
00346 uves_propertylist_insert_int(uves_propertylist *self, const char *here,
00347                             const char *name, int value);
00348 
00349 cpl_error_code
00350 uves_propertylist_insert_long(uves_propertylist *self, const char *here,
00351                              const char *name, long value);
00352 
00353 cpl_error_code
00354 uves_propertylist_insert_float(uves_propertylist *self, const char *here,
00355                               const char *name, float value);
00356 
00357 cpl_error_code
00358 uves_propertylist_insert_double(uves_propertylist *self, const char *here,
00359                                const char *name, double value);
00360 
00361 cpl_error_code
00362 uves_propertylist_insert_string(uves_propertylist *self, const char *here,
00363                                const char *name, const char *value);
00364 
00365 
00366 cpl_error_code
00367 uves_propertylist_insert_after_char(uves_propertylist *self, const char *after,
00368                                    const char *name, char value);
00369 
00370 cpl_error_code
00371 uves_propertylist_insert_after_bool(uves_propertylist *self, const char *after,
00372                                    const char *name, int value);
00373 
00374 cpl_error_code
00375 uves_propertylist_insert_after_int(uves_propertylist *self, const char *after,
00376                                   const char *name, int value);
00377 
00378 cpl_error_code
00379 uves_propertylist_insert_after_long(uves_propertylist *self, const char *after,
00380                                    const char *name, long value);
00381 
00382 cpl_error_code
00383 uves_propertylist_insert_after_float(uves_propertylist *self, const char *after,
00384                                     const char *name, float value);
00385 
00386 cpl_error_code
00387 uves_propertylist_insert_after_double(uves_propertylist *self, const char *after,
00388                                      const char *name, double value);
00389 
00390 cpl_error_code
00391 uves_propertylist_insert_after_string(uves_propertylist *self, const char *after,
00392                                      const char *name, const char *value);
00393 
00394 
00395 cpl_error_code
00396 uves_propertylist_prepend_char(uves_propertylist *self, const char *name,
00397                               char value);
00398 
00399 cpl_error_code
00400 uves_propertylist_prepend_bool(uves_propertylist *self, const char *name,
00401                               int value);
00402 cpl_error_code
00403 uves_propertylist_prepend_int(uves_propertylist *self, const char *name,
00404                              int value);
00405 
00406 cpl_error_code
00407 uves_propertylist_prepend_long(uves_propertylist *self, const char *name,
00408                               long value);
00409 
00410 cpl_error_code
00411 uves_propertylist_prepend_float(uves_propertylist *self, const char *name,
00412                                float value);
00413 
00414 cpl_error_code
00415 uves_propertylist_prepend_double(uves_propertylist *self, const char *name,
00416                                 double value);
00417 
00418 cpl_error_code
00419 uves_propertylist_prepend_string(uves_propertylist *self, const char *name,
00420                                 const char *value);
00421 
00422 
00423 
00424 cpl_error_code
00425 uves_propertylist_append_c_char(uves_propertylist *self, const char *name,
00426                              char value, const char *comment);
00427 
00428 cpl_error_code
00429 uves_propertylist_append_c_bool(uves_propertylist *self, const char *name,
00430                              int value, const char *comment);
00431 
00432 cpl_error_code
00433 uves_propertylist_append_c_int(uves_propertylist *self, const char *name,
00434                             int value, const char *comment);
00435 
00436 cpl_error_code
00437 uves_propertylist_append_c_long(uves_propertylist *self, const char *name,
00438                              long value, const char *comment);
00439 
00440 cpl_error_code
00441 uves_propertylist_append_c_float(uves_propertylist *self, const char *name,
00442                               float value, const char *comment);
00443 
00444 cpl_error_code
00445 uves_propertylist_append_c_double(uves_propertylist *self, const char *name,
00446                                double value, const char *comment);
00447 
00448 cpl_error_code
00449 uves_propertylist_append_c_string(uves_propertylist *self, const char *name,
00450                                const char *value, const char *comment);
00451 
00452 
00453 
00454 
00455 cpl_error_code
00456 uves_propertylist_append_char(uves_propertylist *self, const char *name,
00457                              char value);
00458 
00459 cpl_error_code
00460 uves_propertylist_append_bool(uves_propertylist *self, const char *name,
00461                              int value);
00462 
00463 cpl_error_code
00464 uves_propertylist_append_int(uves_propertylist *self, const char *name,
00465                             int value);
00466 
00467 cpl_error_code
00468 uves_propertylist_append_long(uves_propertylist *self, const char *name,
00469                              long value);
00470 
00471 cpl_error_code
00472 uves_propertylist_append_float(uves_propertylist *self, const char *name,
00473                               float value);
00474 
00475 cpl_error_code
00476 uves_propertylist_append_double(uves_propertylist *self, const char *name,
00477                                double value);
00478 
00479 cpl_error_code
00480 uves_propertylist_append_string(uves_propertylist *self, const char *name,
00481                                const char *value);
00482 
00483 
00484 cpl_error_code
00485 uves_propertylist_append(uves_propertylist *self,
00486                         const uves_propertylist *other);
00487 
00488 int
00489 uves_propertylist_erase(uves_propertylist *self, const char *name);
00490 
00491 int
00492 uves_propertylist_erase_regexp(uves_propertylist *self, const char *regexp,
00493                               int invert);
00494 
00495 void
00496 uves_propertylist_empty(uves_propertylist *self);
00497 
00498 
00499 /*
00500  * Convenience functions
00501  */
00502 int
00503 uves_propertylist_has(const uves_propertylist *self, const char *name);
00504 
00505 cpl_error_code
00506 uves_propertylist_update_char(uves_propertylist *self, const char *name,
00507                              char value);
00508 cpl_error_code
00509 uves_propertylist_update_bool(uves_propertylist *self, const char *name,
00510                              int value);
00511 cpl_error_code
00512 uves_propertylist_update_int(uves_propertylist *self, const char *name,
00513                             int value);
00514 cpl_error_code
00515 uves_propertylist_update_long(uves_propertylist *self, const char *name,
00516                              long value);
00517 cpl_error_code
00518 uves_propertylist_update_float(uves_propertylist *self, const char *name,
00519                               float value);
00520 cpl_error_code
00521 uves_propertylist_update_double(uves_propertylist *self, const char *name,
00522                                double value);
00523 cpl_error_code
00524 uves_propertylist_update_string(uves_propertylist *self, const char *name,
00525                                const char *value);
00526 
00527 cpl_error_code
00528 uves_propertylist_copy_property(uves_propertylist *self,
00529                                const uves_propertylist *other,
00530                                const char *name);
00531 cpl_error_code
00532 uves_propertylist_copy_property_regexp(uves_propertylist *self,
00533                                       const uves_propertylist *other,
00534                                       const char *regexp,
00535                                       int invert);
00536 
00537 /*
00538  * Loading, saving and conversion operations.
00539  */
00540 
00541 uves_propertylist *
00542 uves_propertylist_load(const char *name, int position);
00543 
00544 uves_propertylist *
00545 uves_propertylist_load_regexp(const char *name, int position,
00546                              const char *regexp, int invert);
00547 
00548 
00549 
00550 /* Internal functions */
00551 qfits_header *
00552 uves_propertylist_to_fits(const uves_propertylist *self);
00553 
00554 uves_propertylist *
00555 uves_propertylist_from_fits(const qfits_header *header);
00556 
00557 cpl_propertylist *
00558 my_uves_propertylist_from_fits(const cpl_propertylist *header);
00559 
00560 /*
00561 cpl_propertylist *
00562 my_cpl_propertylist_from_fitsfile(fitsfile *file);
00563 */
00564 
00565 
00566 /*
00567 cxint
00568 _my_uves_propertylist_from_fitsfile(cpl_propertylist *self, fitsfile *file,
00569                    cx_compare_func filter, cxptr data);
00570 
00571 
00572 static cxint
00573 _my_uves_propertylist_to_fitsfile(fitsfile *file, const cpl_propertylist *self,
00574                   cx_compare_func filter, cxptr data);
00575 cpl_propertylist *
00576 my_uves_propertylist_from_fitsfile(fitsfile *file);
00577 */
00578 
00579 #endif /* USE_CPL */
00580 
00581 #endif /* UVES_PROPERTYLIST_H */

Generated on 8 Mar 2011 for UVES Pipeline Reference Manual by  doxygen 1.6.1