File: uves_propertylist.h

package info (click to toggle)
cpl-plugin-uves 6.1.3+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 23,128 kB
  • sloc: ansic: 171,056; sh: 4,359; python: 3,002; makefile: 1,322
file content (576 lines) | stat: -rw-r--r-- 20,110 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
/* $Id: uves_propertylist.h,v 1.11 2010-09-24 09:32:07 amodigli Exp $
 *
 * This file is part of the ESO Common Pipeline Library
 * Copyright (C) 2001-2005 European Southern Observatory
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * $Author: amodigli $
 * $Date: 2010-09-24 09:32:07 $
 * $Revision: 1.11 $
 * $Name: not supported by cvs2svn $
 */

#ifndef UVES_PROPERTYLIST_H
#define UVES_PROPERTYLIST_H

/* Define appropriately to switch on/off cpl_propertylists */
#undef USE_CPL
//#define USE_CPL

#ifdef USE_CPL
/* Workaround code ahead. No, it is not nice. */
#include <cpl.h>
#include <fitsio.h>
#include <longnam.h>

#define uves_propertylist cpl_propertylist

#define uves_vector_save(a, b, c, d, e) \
 cpl_vector_save(a, b, c, d, e)
#define uves_image_save(a, b, c, d, e) \
 cpl_image_save(a, b, c, d, e)
#define uves_imagelist_save(a, b, c, d, e) \
 cpl_imagelist_save(a, b, c, d, e)
#define uves_table_save(a, b, c, d, e) \
 cpl_table_save(a, b, c, d, e)
#define uves_dfs_setup_product_header(a, b, c, d, e, f, g) \
 cpl_dfs_setup_product_header(a, b, c, d, e, f, g)
//#define uves_table_sort(a, b)
// cpl_table_sort(a, b)
#define uves_propertylist_new() \
 cpl_propertylist_new()
#define uves_propertylist_duplicate(a) \
 cpl_propertylist_duplicate(a)
#define uves_propertylist_delete(a) \
 cpl_propertylist_delete(a)
#define uves_propertylist_get_size(a) \
 cpl_propertylist_get_size(a)
#define uves_propertylist_is_empty(a) \
 cpl_propertylist_is_empty(a)
#define uves_propertylist_get_type(a, b) \
 cpl_propertylist_get_type(a, b)
#define uves_propertylist_contains(a, b) \
 cpl_propertylist_contains(a, b)
#define my_uves_propertylist_contains(a, b) \
 cpl_propertylist_contains(a, b)

#define uves_propertylist_set_comment(a, b, c) \
 cpl_propertylist_set_comment(a, b, c)
#define uves_propertylist_set_char(a, b, c) \
 cpl_propertylist_set_char(a, b, c)
#define uves_propertylist_set_bool(a, b, c) \
 cpl_propertylist_set_bool(a, b, c)
#define uves_propertylist_set_int(a, b, c) \
 cpl_propertylist_set_int(a, b, c)
#define uves_propertylist_set_long(a, b, c) \
 cpl_propertylist_set_long(a, b, c)
#define uves_propertylist_set_float(a, b, c) \
 cpl_propertylist_set_float(a, b, c)
#define uves_propertylist_set_double(a, b, c) \
 cpl_propertylist_set_double(a, b, c)
#define uves_propertylist_set_string(a, b, c) \
 cpl_propertylist_set_string(a, b, c)
#define uves_propertylist_get_const(a, b) \
 cpl_propertylist_get(a, b)
#define uves_propertylist_get(a, b) \
 cpl_propertylist_get(a, b)
#define uves_propertylist_get_comment(a, b) \
 cpl_propertylist_get_comment(a, b)
#define uves_propertylist_get_char(a, b) \
 cpl_propertylist_get_char(a, b)
#define uves_propertylist_get_bool(a, b) \
 cpl_propertylist_get_bool(a, b)
#define uves_propertylist_get_int(a, b) \
 cpl_propertylist_get_int(a, b)
#define uves_propertylist_get_long(a, b) \
 cpl_propertylist_get_long(a, b)
#define uves_propertylist_get_float(a, b) \
 cpl_propertylist_get_float(a, b)
#define uves_propertylist_get_double(a, b) \
 cpl_propertylist_get_double(a, b)
#define uves_propertylist_get_string(a, b) \
 cpl_propertylist_get_string(a, b)
#define uves_propertylist_insert_char(a, b, c, d) \
 cpl_propertylist_insert_char(a, b, c, d)
#define uves_propertylist_insert_bool(a, b, c, d) \
 cpl_propertylist_insert_bool(a, b, c, d)
#define uves_propertylist_insert_int(a, b, c, d) \
 cpl_propertylist_insert_int(a, b, c, d)
#define uves_propertylist_insert_long(a, b, c, d) \
 cpl_propertylist_insert_long(a, b, c, d)
#define uves_propertylist_insert_float(a, b, c, d) \
 cpl_propertylist_insert_float(a, b, c, d)
#define uves_propertylist_insert_double(a, b, c, d) \
 cpl_propertylist_insert_double(a, b, c, d)
#define uves_propertylist_insert_string(a, b, c, d) \
 cpl_propertylist_insert_string(a, b, c, d)
#define uves_propertylist_insert_after_char(a, b, c, d) \
 cpl_propertylist_insert_after_char(a, b, c, d)
#define uves_propertylist_insert_after_bool(a, b, c, d) \
 cpl_propertylist_insert_after_bool(a, b, c, d)
#define uves_propertylist_insert_after_int(a, b, c, d) \
 cpl_propertylist_insert_after_int(a, b, c, d)
#define uves_propertylist_insert_after_long(a, b, c, d) \
 cpl_propertylist_insert_after_long(a, b, c, d)
#define uves_propertylist_insert_after_float(a, b, c, d) \
 cpl_propertylist_insert_after_float(a, b, c, d)
#define uves_propertylist_insert_after_double(a, b, c, d) \
 cpl_propertylist_insert_after_double(a, b, c, d)
#define uves_propertylist_insert_after_string(a, b, c, d) \
 cpl_propertylist_insert_after_string(a, b, c, d)
#define uves_propertylist_prepend_char(a, b, c) \
 cpl_propertylist_prepend_char(a, b, c)
#define uves_propertylist_prepend_bool(a, b, c) \
 cpl_propertylist_prepend_bool(a, b, c)
#define uves_propertylist_prepend_int(a, b, c) \
 cpl_propertylist_prepend_int(a, b, c)
#define uves_propertylist_prepend_long(a, b, c) \
 cpl_propertylist_prepend_long(a, b, c)
#define uves_propertylist_prepend_float(a, b, c) \
 cpl_propertylist_prepend_float(a, b, c)
#define uves_propertylist_prepend_double(a, b, c) \
 cpl_propertylist_prepend_double(a, b, c)
#define uves_propertylist_prepend_string(a, b, c) \
 cpl_propertylist_prepend_string(a, b, c)
#define uves_propertylist_append_char(a, b, c) \
 cpl_propertylist_append_char(a, b, c)
#define uves_propertylist_append_bool(a, b, c) \
 cpl_propertylist_append_bool(a, b, c)
#define uves_propertylist_append_int(a, b, c) \
 cpl_propertylist_append_int(a, b, c)
#define uves_propertylist_append_long(a, b, c) \
 cpl_propertylist_append_long(a, b, c)
#define uves_propertylist_append_float(a, b, c) \
 cpl_propertylist_append_float(a, b, c)
#define uves_propertylist_append_double(a, b, c) \
 cpl_propertylist_append_double(a, b, c)
#define uves_propertylist_append_string(a, b, c) \
 cpl_propertylist_append_string(a, b, c)
#define uves_propertylist_append(a, b) \
 cpl_propertylist_append(a, b)
#define uves_propertylist_erase(a, b) \
 cpl_propertylist_erase(a, b)
#define uves_propertylist_erase_regexp(a, b, c) \
 cpl_propertylist_erase_regexp(a, b, c)
#define uves_propertylist_empty(a) \
 cpl_propertylist_empty(a)
#define uves_propertylist_update_char(a, b, c) \
 cpl_propertylist_update_char(a, b, c)
#define uves_propertylist_update_bool(a, b, c) \
 cpl_propertylist_update_bool(a, b, c)
#define uves_propertylist_update_int(a, b, c) \
 cpl_propertylist_update_int(a, b, c)
#define uves_propertylist_update_long(a, b, c) \
 cpl_propertylist_update_long(a, b, c)
#define uves_propertylist_update_float(a, b, c) \
 cpl_propertylist_update_float(a, b, c)
#define uves_propertylist_update_double(a, b, c) \
 cpl_propertylist_update_double(a, b, c)
#define uves_propertylist_update_string(a, b, c) \
 cpl_propertylist_update_string(a, b, c)
#define uves_propertylist_copy_property(a, b, c) \
 cpl_propertylist_copy_property(a, b, c)
#define uves_propertylist_copy_property_regexp(a, b, c, d) \
 cpl_propertylist_copy_property_regexp(a, b, c, d) 
#define uves_propertylist_load(a, b) \
 cpl_propertylist_load(a, b)  
#define uves_propertylist_load_regexp(a, b, c, d) \
 cpl_propertylist_load_regexp(a, b, c, d) 
#define uves_propertylist_to_fits(a) \
 cpl_propertylist_to_fits(a) 
#define uves_propertylist_from_fits(a) \
     cpl_propertylist_from_fits(a) 

#else /* if USE_CPL */

#include <cpl.h>
#include <qfits.h>

/**
 * @ingroup uves_propertylist
 *
 * @brief
 *   The opaque property list data type.
 */
     
typedef struct _uves_propertylist_ uves_propertylist;


/*
 * Wrappers for functions which have cpl_propertylists in their interface 
 */
cpl_error_code uves_vector_save(const cpl_vector *v, const char *f, cpl_type_bpp bpp,
                                const uves_propertylist *header, unsigned mode);
cpl_error_code uves_image_save(const cpl_image *image, const char *f, cpl_type_bpp bpp,
                               const uves_propertylist *header, unsigned mode);
cpl_error_code uves_imagelist_save(const cpl_imagelist *imagelist, const char *f, cpl_type_bpp bpp,
                   const uves_propertylist *header, unsigned mode);
cpl_error_code uves_table_save(const cpl_table *table, const uves_propertylist *header,
                   const uves_propertylist *ext_header, const char *filename,
                   unsigned mode);
cpl_error_code uves_dfs_setup_product_header(uves_propertylist *header,
                                             const cpl_frame *frame,
                                             const cpl_frameset *set,
                                             const cpl_parameterlist *par,
                                             const char *c1,
                                             const char *c2,
                                             const char *c3);
cpl_error_code uves_table_sort(cpl_table *, const uves_propertylist *);

/*
 * Create, copy and destroy operations.
 */

uves_propertylist *
uves_propertylist_new(void);

uves_propertylist *
uves_propertylist_duplicate(const uves_propertylist *other);

void
uves_propertylist_delete(const uves_propertylist *self);


/*
 * Non modifying operations
 */

long
uves_propertylist_get_size(const uves_propertylist *self);

int
uves_propertylist_is_empty(const uves_propertylist *self);

cpl_type
uves_propertylist_get_type(const uves_propertylist *self, const char *name);

int
uves_propertylist_contains(const uves_propertylist *self, const char *name);

int
my_uves_propertylist_contains(const cpl_propertylist *self, const char *name);


/*
 * Assignment operations
 */

cpl_error_code
uves_propertylist_set_comment(uves_propertylist *self, const char *name,
                             const char *comment);
cpl_error_code
uves_propertylist_set_char(uves_propertylist *self, const char *name,
                          char value);
cpl_error_code
uves_propertylist_set_bool(uves_propertylist *self, const char *name ,
                          int value);
cpl_error_code
uves_propertylist_set_int(uves_propertylist *self, const char *name,
                         int value);
cpl_error_code
uves_propertylist_set_long(uves_propertylist *self, const char *name,
                          long value);
cpl_error_code
uves_propertylist_set_float(uves_propertylist *self, const char *name,
                           float value);
cpl_error_code
uves_propertylist_set_double(uves_propertylist *self, const char *name,
                            double value);
cpl_error_code
uves_propertylist_set_string(uves_propertylist *self, const char *name,
                            const char *value);

/*
 * Element access
 */

const cpl_property *
uves_propertylist_get_const(const uves_propertylist *self, long position);

cpl_property *
uves_propertylist_get(uves_propertylist *self, long position);

const char *
uves_propertylist_get_comment(const uves_propertylist *self, const char *name);

char
uves_propertylist_get_char(const uves_propertylist *self, const char *name);

int
uves_propertylist_get_bool(const uves_propertylist *self, const char *name);

int
uves_propertylist_get_int(const uves_propertylist *self, const char *name);

long
uves_propertylist_get_long(const uves_propertylist *self, const char *name);

float
uves_propertylist_get_float(const uves_propertylist *self, const char *name);

double
uves_propertylist_get_double(const uves_propertylist *self, const char *name);

const char *
uves_propertylist_get_string(const uves_propertylist *self, const char *name);


/*
 * Inserting and removing elements
 */

cpl_error_code
uves_propertylist_insert_char(uves_propertylist *self, const char *here,
                             const char *name, char value);

cpl_error_code
uves_propertylist_insert_bool(uves_propertylist *self, const char *here,
                             const char *name, int value);

cpl_error_code
uves_propertylist_insert_int(uves_propertylist *self, const char *here,
                            const char *name, int value);

cpl_error_code
uves_propertylist_insert_long(uves_propertylist *self, const char *here,
                             const char *name, long value);

cpl_error_code
uves_propertylist_insert_float(uves_propertylist *self, const char *here,
                              const char *name, float value);

cpl_error_code
uves_propertylist_insert_double(uves_propertylist *self, const char *here,
                               const char *name, double value);

cpl_error_code
uves_propertylist_insert_string(uves_propertylist *self, const char *here,
                               const char *name, const char *value);


cpl_error_code
uves_propertylist_insert_after_char(uves_propertylist *self, const char *after,
                                   const char *name, char value);

cpl_error_code
uves_propertylist_insert_after_bool(uves_propertylist *self, const char *after,
                                   const char *name, int value);

cpl_error_code
uves_propertylist_insert_after_int(uves_propertylist *self, const char *after,
                                  const char *name, int value);

cpl_error_code
uves_propertylist_insert_after_long(uves_propertylist *self, const char *after,
                                   const char *name, long value);

cpl_error_code
uves_propertylist_insert_after_float(uves_propertylist *self, const char *after,
                                    const char *name, float value);

cpl_error_code
uves_propertylist_insert_after_double(uves_propertylist *self, const char *after,
                                     const char *name, double value);

cpl_error_code
uves_propertylist_insert_after_string(uves_propertylist *self, const char *after,
                                     const char *name, const char *value);


cpl_error_code
uves_propertylist_prepend_char(uves_propertylist *self, const char *name,
                              char value);

cpl_error_code
uves_propertylist_prepend_bool(uves_propertylist *self, const char *name,
                              int value);
cpl_error_code
uves_propertylist_prepend_int(uves_propertylist *self, const char *name,
                             int value);

cpl_error_code
uves_propertylist_prepend_long(uves_propertylist *self, const char *name,
                              long value);

cpl_error_code
uves_propertylist_prepend_float(uves_propertylist *self, const char *name,
                               float value);

cpl_error_code
uves_propertylist_prepend_double(uves_propertylist *self, const char *name,
                                double value);

cpl_error_code
uves_propertylist_prepend_string(uves_propertylist *self, const char *name,
                                const char *value);



cpl_error_code
uves_propertylist_append_c_char(uves_propertylist *self, const char *name,
                             char value, const char *comment);

cpl_error_code
uves_propertylist_append_c_bool(uves_propertylist *self, const char *name,
                             int value, const char *comment);

cpl_error_code
uves_propertylist_append_c_int(uves_propertylist *self, const char *name,
                            int value, const char *comment);

cpl_error_code
uves_propertylist_append_c_long(uves_propertylist *self, const char *name,
                             long value, const char *comment);

cpl_error_code
uves_propertylist_append_c_float(uves_propertylist *self, const char *name,
                              float value, const char *comment);

cpl_error_code
uves_propertylist_append_c_double(uves_propertylist *self, const char *name,
                               double value, const char *comment);

cpl_error_code
uves_propertylist_append_c_string(uves_propertylist *self, const char *name,
                               const char *value, const char *comment);




cpl_error_code
uves_propertylist_append_char(uves_propertylist *self, const char *name,
                             char value);

cpl_error_code
uves_propertylist_append_bool(uves_propertylist *self, const char *name,
                             int value);

cpl_error_code
uves_propertylist_append_int(uves_propertylist *self, const char *name,
                            int value);

cpl_error_code
uves_propertylist_append_long(uves_propertylist *self, const char *name,
                             long value);

cpl_error_code
uves_propertylist_append_float(uves_propertylist *self, const char *name,
                              float value);

cpl_error_code
uves_propertylist_append_double(uves_propertylist *self, const char *name,
                               double value);

cpl_error_code
uves_propertylist_append_string(uves_propertylist *self, const char *name,
                               const char *value);


cpl_error_code
uves_propertylist_append(uves_propertylist *self,
                        const uves_propertylist *other);

int
uves_propertylist_erase(uves_propertylist *self, const char *name);

int
uves_propertylist_erase_regexp(uves_propertylist *self, const char *regexp,
                              int invert);

void
uves_propertylist_empty(uves_propertylist *self);


/*
 * Convenience functions
 */
int
uves_propertylist_has(const uves_propertylist *self, const char *name);

cpl_error_code
uves_propertylist_update_char(uves_propertylist *self, const char *name,
                             char value);
cpl_error_code
uves_propertylist_update_bool(uves_propertylist *self, const char *name,
                             int value);
cpl_error_code
uves_propertylist_update_int(uves_propertylist *self, const char *name,
                            int value);
cpl_error_code
uves_propertylist_update_long(uves_propertylist *self, const char *name,
                             long value);
cpl_error_code
uves_propertylist_update_float(uves_propertylist *self, const char *name,
                              float value);
cpl_error_code
uves_propertylist_update_double(uves_propertylist *self, const char *name,
                               double value);
cpl_error_code
uves_propertylist_update_string(uves_propertylist *self, const char *name,
                               const char *value);

cpl_error_code
uves_propertylist_copy_property(uves_propertylist *self,
                               const uves_propertylist *other,
                               const char *name);
cpl_error_code
uves_propertylist_copy_property_regexp(uves_propertylist *self,
                                      const uves_propertylist *other,
                                      const char *regexp,
                                      int invert);

/*
 * Loading, saving and conversion operations.
 */

uves_propertylist *
uves_propertylist_load(const char *name, int position);

uves_propertylist *
uves_propertylist_load_regexp(const char *name, int position,
                             const char *regexp, int invert);



/* Internal functions */
qfits_header *
uves_propertylist_to_fits(const uves_propertylist *self);

uves_propertylist *
uves_propertylist_from_fits(const qfits_header *header);

cpl_propertylist *
my_uves_propertylist_from_fits(const cpl_propertylist *header);


/*
cxint
_my_uves_propertylist_from_fitsfile(cpl_propertylist *self, fitsfile *file,
				   cx_compare_func filter, cxptr data);


static cxint
_my_uves_propertylist_to_fitsfile(fitsfile *file, const cpl_propertylist *self,
				  cx_compare_func filter, cxptr data);
cpl_propertylist *
my_uves_propertylist_from_fitsfile(fitsfile *file);
*/

#endif /* USE_CPL */

#endif /* UVES_PROPERTYLIST_H */