uves_propertylist.h

00001 /* $Id: uves_propertylist.h,v 1.7 2007/10/01 17:06:51 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: 2007/10/01 17:06:51 $
00024  * $Revision: 1.7 $
00025  * $Name: uves-3_9_0 $
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 
00038 #include <cpl.h>
00039 #define uves_propertylist cpl_propertylist
00040 
00041 #define uves_vector_save(a, b, c, d, e) \
00042  cpl_vector_save(a, b, c, d, e)
00043 #define uves_image_save(a, b, c, d, e) \
00044  cpl_image_save(a, b, c, d, e)
00045 #define uves_imagelist_save(a, b, c, d, e) \
00046  cpl_imagelist_save(a, b, c, d, e)
00047 #define uves_table_save(a, b, c, d, e) \
00048  cpl_table_save(a, b, c, d, e)
00049 #define uves_dfs_setup_product_header(a, b, c, d, e, f, g) \
00050  cpl_dfs_setup_product_header(a, b, c, d, e, f, g)
00051 //#define uves_table_sort(a, b)
00052 // cpl_table_sort(a, b)
00053 #define uves_propertylist_new() \
00054  cpl_propertylist_new()
00055 #define uves_propertylist_duplicate(a) \
00056  cpl_propertylist_duplicate(a)
00057 #define uves_propertylist_delete(a) \
00058  cpl_propertylist_delete(a)
00059 #define uves_propertylist_get_size(a) \
00060  cpl_propertylist_get_size(a)
00061 #define uves_propertylist_is_empty(a) \
00062  cpl_propertylist_is_empty(a)
00063 #define uves_propertylist_get_type(a, b) \
00064  cpl_propertylist_get_type(a, b)
00065 #define uves_propertylist_contains(a, b) \
00066  cpl_propertylist_contains(a, b)
00067 #define uves_propertylist_set_comment(a, b, c) \
00068  cpl_propertylist_set_comment(a, b, c)
00069 #define uves_propertylist_set_char(a, b, c) \
00070  cpl_propertylist_set_char(a, b, c)
00071 #define uves_propertylist_set_bool(a, b, c) \
00072  cpl_propertylist_set_bool(a, b, c)
00073 #define uves_propertylist_set_int(a, b, c) \
00074  cpl_propertylist_set_int(a, b, c)
00075 #define uves_propertylist_set_long(a, b, c) \
00076  cpl_propertylist_set_long(a, b, c)
00077 #define uves_propertylist_set_float(a, b, c) \
00078  cpl_propertylist_set_float(a, b, c)
00079 #define uves_propertylist_set_double(a, b, c) \
00080  cpl_propertylist_set_double(a, b, c)
00081 #define uves_propertylist_set_string(a, b, c) \
00082  cpl_propertylist_set_string(a, b, c)
00083 #define uves_propertylist_get_const(a, b) \
00084  cpl_propertylist_get(a, b)
00085 #define uves_propertylist_get(a, b) \
00086  cpl_propertylist_get(a, b)
00087 #define uves_propertylist_get_comment(a, b) \
00088  cpl_propertylist_get_comment(a, b)
00089 #define uves_propertylist_get_char(a, b) \
00090  cpl_propertylist_get_char(a, b)
00091 #define uves_propertylist_get_bool(a, b) \
00092  cpl_propertylist_get_bool(a, b)
00093 #define uves_propertylist_get_int(a, b) \
00094  cpl_propertylist_get_int(a, b)
00095 #define uves_propertylist_get_long(a, b) \
00096  cpl_propertylist_get_long(a, b)
00097 #define uves_propertylist_get_float(a, b) \
00098  cpl_propertylist_get_float(a, b)
00099 #define uves_propertylist_get_double(a, b) \
00100  cpl_propertylist_get_double(a, b)
00101 #define uves_propertylist_get_string(a, b) \
00102  cpl_propertylist_get_string(a, b)
00103 #define uves_propertylist_insert_char(a, b, c, d) \
00104  cpl_propertylist_insert_char(a, b, c, d)
00105 #define uves_propertylist_insert_bool(a, b, c, d) \
00106  cpl_propertylist_insert_bool(a, b, c, d)
00107 #define uves_propertylist_insert_int(a, b, c, d) \
00108  cpl_propertylist_insert_int(a, b, c, d)
00109 #define uves_propertylist_insert_long(a, b, c, d) \
00110  cpl_propertylist_insert_long(a, b, c, d)
00111 #define uves_propertylist_insert_float(a, b, c, d) \
00112  cpl_propertylist_insert_float(a, b, c, d)
00113 #define uves_propertylist_insert_double(a, b, c, d) \
00114  cpl_propertylist_insert_double(a, b, c, d)
00115 #define uves_propertylist_insert_string(a, b, c, d) \
00116  cpl_propertylist_insert_string(a, b, c, d)
00117 #define uves_propertylist_insert_after_char(a, b, c, d) \
00118  cpl_propertylist_insert_after_char(a, b, c, d)
00119 #define uves_propertylist_insert_after_bool(a, b, c, d) \
00120  cpl_propertylist_insert_after_bool(a, b, c, d)
00121 #define uves_propertylist_insert_after_int(a, b, c, d) \
00122  cpl_propertylist_insert_after_int(a, b, c, d)
00123 #define uves_propertylist_insert_after_long(a, b, c, d) \
00124  cpl_propertylist_insert_after_long(a, b, c, d)
00125 #define uves_propertylist_insert_after_float(a, b, c, d) \
00126  cpl_propertylist_insert_after_float(a, b, c, d)
00127 #define uves_propertylist_insert_after_double(a, b, c, d) \
00128  cpl_propertylist_insert_after_double(a, b, c, d)
00129 #define uves_propertylist_insert_after_string(a, b, c, d) \
00130  cpl_propertylist_insert_after_string(a, b, c, d)
00131 #define uves_propertylist_prepend_char(a, b, c) \
00132  cpl_propertylist_prepend_char(a, b, c)
00133 #define uves_propertylist_prepend_bool(a, b, c) \
00134  cpl_propertylist_prepend_bool(a, b, c)
00135 #define uves_propertylist_prepend_int(a, b, c) \
00136  cpl_propertylist_prepend_int(a, b, c)
00137 #define uves_propertylist_prepend_long(a, b, c) \
00138  cpl_propertylist_prepend_long(a, b, c)
00139 #define uves_propertylist_prepend_float(a, b, c) \
00140  cpl_propertylist_prepend_float(a, b, c)
00141 #define uves_propertylist_prepend_double(a, b, c) \
00142  cpl_propertylist_prepend_double(a, b, c)
00143 #define uves_propertylist_prepend_string(a, b, c) \
00144  cpl_propertylist_prepend_string(a, b, c)
00145 #define uves_propertylist_append_char(a, b, c) \
00146  cpl_propertylist_append_char(a, b, c)
00147 #define uves_propertylist_append_bool(a, b, c) \
00148  cpl_propertylist_append_bool(a, b, c)
00149 #define uves_propertylist_append_int(a, b, c) \
00150  cpl_propertylist_append_int(a, b, c)
00151 #define uves_propertylist_append_long(a, b, c) \
00152  cpl_propertylist_append_long(a, b, c)
00153 #define uves_propertylist_append_float(a, b, c) \
00154  cpl_propertylist_append_float(a, b, c)
00155 #define uves_propertylist_append_double(a, b, c) \
00156  cpl_propertylist_append_double(a, b, c)
00157 #define uves_propertylist_append_string(a, b, c) \
00158  cpl_propertylist_append_string(a, b, c)
00159 #define uves_propertylist_append(a, b) \
00160  cpl_propertylist_append(a, b)
00161 #define uves_propertylist_erase(a, b) \
00162  cpl_propertylist_erase(a, b)
00163 #define uves_propertylist_erase_regexp(a, b, c) \
00164  cpl_propertylist_erase_regexp(a, b, c)
00165 #define uves_propertylist_empty(a) \
00166  cpl_propertylist_empty(a)
00167 #define uves_propertylist_update_char(a, b, c) \
00168  cpl_propertylist_update_char(a, b, c)
00169 #define uves_propertylist_update_bool(a, b, c) \
00170  cpl_propertylist_update_bool(a, b, c)
00171 #define uves_propertylist_update_int(a, b, c) \
00172  cpl_propertylist_update_int(a, b, c)
00173 #define uves_propertylist_update_long(a, b, c) \
00174  cpl_propertylist_update_long(a, b, c)
00175 #define uves_propertylist_update_float(a, b, c) \
00176  cpl_propertylist_update_float(a, b, c)
00177 #define uves_propertylist_update_double(a, b, c) \
00178  cpl_propertylist_update_double(a, b, c)
00179 #define uves_propertylist_update_string(a, b, c) \
00180  cpl_propertylist_update_string(a, b, c)
00181 #define uves_propertylist_copy_property(a, b, c) \
00182  cpl_propertylist_copy_property(a, b, c)
00183 #define uves_propertylist_copy_property_regexp(a, b, c, d) \
00184  cpl_propertylist_copy_property_regexp(a, b, c, d) 
00185 #define uves_propertylist_load(a, b) \
00186  cpl_propertylist_load(a, b)  
00187 #define uves_propertylist_load_regexp(a, b, c, d) \
00188  cpl_propertylist_load_regexp(a, b, c, d) 
00189 #define uves_propertylist_to_fits(a) \
00190  cpl_propertylist_to_fits(a) 
00191 #define uves_propertylist_from_fits(a) \
00192      cpl_propertylist_from_fits(a) 
00193 
00194 #else /* if USE_CPL */
00195 
00196 #include <cpl.h>
00197 #include <qfits.h>
00198 
00206 typedef struct _uves_propertylist_ uves_propertylist;
00207 
00208 
00209 /*
00210  * Wrappers for functions which have cpl_propertylists in their interface 
00211  */
00212 cpl_error_code uves_vector_save(const cpl_vector *v, const char *f, cpl_type_bpp bpp,
00213                                 const uves_propertylist *header, unsigned mode);
00214 cpl_error_code uves_image_save(const cpl_image *image, const char *f, cpl_type_bpp bpp,
00215                                const uves_propertylist *header, unsigned mode);
00216 cpl_error_code uves_imagelist_save(const cpl_imagelist *imagelist, const char *f, cpl_type_bpp bpp,
00217                    const uves_propertylist *header, unsigned mode);
00218 cpl_error_code uves_table_save(const cpl_table *table, const uves_propertylist *header,
00219                    const uves_propertylist *ext_header, const char *filename,
00220                    unsigned mode);
00221 cpl_error_code uves_dfs_setup_product_header(uves_propertylist *header,
00222                                              const cpl_frame *frame,
00223                                              const cpl_frameset *set,
00224                                              const cpl_parameterlist *par,
00225                                              const char *c1,
00226                                              const char *c2,
00227                                              const char *c3);
00228 cpl_error_code uves_table_sort(cpl_table *, const uves_propertylist *);
00229 
00230 /*
00231  * Create, copy and destroy operations.
00232  */
00233 
00234 uves_propertylist *
00235 uves_propertylist_new(void);
00236 
00237 uves_propertylist *
00238 uves_propertylist_duplicate(const uves_propertylist *other);
00239 
00240 void
00241 uves_propertylist_delete(const uves_propertylist *self);
00242 
00243 
00244 /*
00245  * Non modifying operations
00246  */
00247 
00248 long
00249 uves_propertylist_get_size(const uves_propertylist *self);
00250 
00251 int
00252 uves_propertylist_is_empty(const uves_propertylist *self);
00253 
00254 cpl_type
00255 uves_propertylist_get_type(const uves_propertylist *self, const char *name);
00256 
00257 int
00258 uves_propertylist_contains(const uves_propertylist *self, const char *name);
00259 
00260 
00261 /*
00262  * Assignment operations
00263  */
00264 
00265 cpl_error_code
00266 uves_propertylist_set_comment(uves_propertylist *self, const char *name,
00267                              const char *comment);
00268 cpl_error_code
00269 uves_propertylist_set_char(uves_propertylist *self, const char *name,
00270                           char value);
00271 cpl_error_code
00272 uves_propertylist_set_bool(uves_propertylist *self, const char *name ,
00273                           int value);
00274 cpl_error_code
00275 uves_propertylist_set_int(uves_propertylist *self, const char *name,
00276                          int value);
00277 cpl_error_code
00278 uves_propertylist_set_long(uves_propertylist *self, const char *name,
00279                           long value);
00280 cpl_error_code
00281 uves_propertylist_set_float(uves_propertylist *self, const char *name,
00282                            float value);
00283 cpl_error_code
00284 uves_propertylist_set_double(uves_propertylist *self, const char *name,
00285                             double value);
00286 cpl_error_code
00287 uves_propertylist_set_string(uves_propertylist *self, const char *name,
00288                             const char *value);
00289 
00290 /*
00291  * Element access
00292  */
00293 
00294 const cpl_property *
00295 uves_propertylist_get_const(const uves_propertylist *self, long position);
00296 
00297 cpl_property *
00298 uves_propertylist_get(uves_propertylist *self, long position);
00299 
00300 const char *
00301 uves_propertylist_get_comment(const uves_propertylist *self, const char *name);
00302 
00303 char
00304 uves_propertylist_get_char(const uves_propertylist *self, const char *name);
00305 
00306 int
00307 uves_propertylist_get_bool(const uves_propertylist *self, const char *name);
00308 
00309 int
00310 uves_propertylist_get_int(const uves_propertylist *self, const char *name);
00311 
00312 long
00313 uves_propertylist_get_long(const uves_propertylist *self, const char *name);
00314 
00315 float
00316 uves_propertylist_get_float(const uves_propertylist *self, const char *name);
00317 
00318 double
00319 uves_propertylist_get_double(const uves_propertylist *self, const char *name);
00320 
00321 const char *
00322 uves_propertylist_get_string(const uves_propertylist *self, const char *name);
00323 
00324 
00325 /*
00326  * Inserting and removing elements
00327  */
00328 
00329 cpl_error_code
00330 uves_propertylist_insert_char(uves_propertylist *self, const char *here,
00331                              const char *name, char value);
00332 
00333 cpl_error_code
00334 uves_propertylist_insert_bool(uves_propertylist *self, const char *here,
00335                              const char *name, int value);
00336 
00337 cpl_error_code
00338 uves_propertylist_insert_int(uves_propertylist *self, const char *here,
00339                             const char *name, int value);
00340 
00341 cpl_error_code
00342 uves_propertylist_insert_long(uves_propertylist *self, const char *here,
00343                              const char *name, long value);
00344 
00345 cpl_error_code
00346 uves_propertylist_insert_float(uves_propertylist *self, const char *here,
00347                               const char *name, float value);
00348 
00349 cpl_error_code
00350 uves_propertylist_insert_double(uves_propertylist *self, const char *here,
00351                                const char *name, double value);
00352 
00353 cpl_error_code
00354 uves_propertylist_insert_string(uves_propertylist *self, const char *here,
00355                                const char *name, const char *value);
00356 
00357 
00358 cpl_error_code
00359 uves_propertylist_insert_after_char(uves_propertylist *self, const char *after,
00360                                    const char *name, char value);
00361 
00362 cpl_error_code
00363 uves_propertylist_insert_after_bool(uves_propertylist *self, const char *after,
00364                                    const char *name, int value);
00365 
00366 cpl_error_code
00367 uves_propertylist_insert_after_int(uves_propertylist *self, const char *after,
00368                                   const char *name, int value);
00369 
00370 cpl_error_code
00371 uves_propertylist_insert_after_long(uves_propertylist *self, const char *after,
00372                                    const char *name, long value);
00373 
00374 cpl_error_code
00375 uves_propertylist_insert_after_float(uves_propertylist *self, const char *after,
00376                                     const char *name, float value);
00377 
00378 cpl_error_code
00379 uves_propertylist_insert_after_double(uves_propertylist *self, const char *after,
00380                                      const char *name, double value);
00381 
00382 cpl_error_code
00383 uves_propertylist_insert_after_string(uves_propertylist *self, const char *after,
00384                                      const char *name, const char *value);
00385 
00386 
00387 cpl_error_code
00388 uves_propertylist_prepend_char(uves_propertylist *self, const char *name,
00389                               char value);
00390 
00391 cpl_error_code
00392 uves_propertylist_prepend_bool(uves_propertylist *self, const char *name,
00393                               int value);
00394 cpl_error_code
00395 uves_propertylist_prepend_int(uves_propertylist *self, const char *name,
00396                              int value);
00397 
00398 cpl_error_code
00399 uves_propertylist_prepend_long(uves_propertylist *self, const char *name,
00400                               long value);
00401 
00402 cpl_error_code
00403 uves_propertylist_prepend_float(uves_propertylist *self, const char *name,
00404                                float value);
00405 
00406 cpl_error_code
00407 uves_propertylist_prepend_double(uves_propertylist *self, const char *name,
00408                                 double value);
00409 
00410 cpl_error_code
00411 uves_propertylist_prepend_string(uves_propertylist *self, const char *name,
00412                                 const char *value);
00413 
00414 
00415 
00416 cpl_error_code
00417 uves_propertylist_append_c_char(uves_propertylist *self, const char *name,
00418                              char value, const char *comment);
00419 
00420 cpl_error_code
00421 uves_propertylist_append_c_bool(uves_propertylist *self, const char *name,
00422                              int value, const char *comment);
00423 
00424 cpl_error_code
00425 uves_propertylist_append_c_int(uves_propertylist *self, const char *name,
00426                             int value, const char *comment);
00427 
00428 cpl_error_code
00429 uves_propertylist_append_c_long(uves_propertylist *self, const char *name,
00430                              long value, const char *comment);
00431 
00432 cpl_error_code
00433 uves_propertylist_append_c_float(uves_propertylist *self, const char *name,
00434                               float value, const char *comment);
00435 
00436 cpl_error_code
00437 uves_propertylist_append_c_double(uves_propertylist *self, const char *name,
00438                                double value, const char *comment);
00439 
00440 cpl_error_code
00441 uves_propertylist_append_c_string(uves_propertylist *self, const char *name,
00442                                const char *value, const char *comment);
00443 
00444 
00445 
00446 
00447 cpl_error_code
00448 uves_propertylist_append_char(uves_propertylist *self, const char *name,
00449                              char value);
00450 
00451 cpl_error_code
00452 uves_propertylist_append_bool(uves_propertylist *self, const char *name,
00453                              int value);
00454 
00455 cpl_error_code
00456 uves_propertylist_append_int(uves_propertylist *self, const char *name,
00457                             int value);
00458 
00459 cpl_error_code
00460 uves_propertylist_append_long(uves_propertylist *self, const char *name,
00461                              long value);
00462 
00463 cpl_error_code
00464 uves_propertylist_append_float(uves_propertylist *self, const char *name,
00465                               float value);
00466 
00467 cpl_error_code
00468 uves_propertylist_append_double(uves_propertylist *self, const char *name,
00469                                double value);
00470 
00471 cpl_error_code
00472 uves_propertylist_append_string(uves_propertylist *self, const char *name,
00473                                const char *value);
00474 
00475 
00476 cpl_error_code
00477 uves_propertylist_append(uves_propertylist *self,
00478                         const uves_propertylist *other);
00479 
00480 int
00481 uves_propertylist_erase(uves_propertylist *self, const char *name);
00482 
00483 int
00484 uves_propertylist_erase_regexp(uves_propertylist *self, const char *regexp,
00485                               int invert);
00486 
00487 void
00488 uves_propertylist_empty(uves_propertylist *self);
00489 
00490 
00491 /*
00492  * Convenience functions
00493  */
00494 int
00495 uves_propertylist_has(const uves_propertylist *self, const char *name);
00496 
00497 cpl_error_code
00498 uves_propertylist_update_char(uves_propertylist *self, const char *name,
00499                              char value);
00500 cpl_error_code
00501 uves_propertylist_update_bool(uves_propertylist *self, const char *name,
00502                              int value);
00503 cpl_error_code
00504 uves_propertylist_update_int(uves_propertylist *self, const char *name,
00505                             int value);
00506 cpl_error_code
00507 uves_propertylist_update_long(uves_propertylist *self, const char *name,
00508                              long value);
00509 cpl_error_code
00510 uves_propertylist_update_float(uves_propertylist *self, const char *name,
00511                               float value);
00512 cpl_error_code
00513 uves_propertylist_update_double(uves_propertylist *self, const char *name,
00514                                double value);
00515 cpl_error_code
00516 uves_propertylist_update_string(uves_propertylist *self, const char *name,
00517                                const char *value);
00518 
00519 cpl_error_code
00520 uves_propertylist_copy_property(uves_propertylist *self,
00521                                const uves_propertylist *other,
00522                                const char *name);
00523 cpl_error_code
00524 uves_propertylist_copy_property_regexp(uves_propertylist *self,
00525                                       const uves_propertylist *other,
00526                                       const char *regexp,
00527                                       int invert);
00528 
00529 /*
00530  * Loading, saving and conversion operations.
00531  */
00532 
00533 uves_propertylist *
00534 uves_propertylist_load(const char *name, int position);
00535 
00536 uves_propertylist *
00537 uves_propertylist_load_regexp(const char *name, int position,
00538                              const char *regexp, int invert);
00539 
00540 
00541 
00542 /* Internal functions */
00543 qfits_header *
00544 uves_propertylist_to_fits(const uves_propertylist *self);
00545 
00546 uves_propertylist *
00547 uves_propertylist_from_fits(const qfits_header *header);
00548 
00549 #endif /* USE_CPL */
00550 
00551 #endif /* UVES_PROPERTYLIST_H */

Generated on Fri Apr 18 14:11:43 2008 for UVES Pipeline Reference Manual by  doxygen 1.5.1