High-Level Data Reduction Library: hdrl_parameter.h Source File

High-Level Data Reduction Library 1.6.0 High-Level data reduction routines for ESO pipelines

Loading...
Searching...
No Matches
hdrl_parameter.h
Go to the documentation of this file.
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2013 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef HDRL_PARAMETER_H
21#define HDRL_PARAMETER_H
22
23/*-----------------------------------------------------------------------------
24 New types
25 -----------------------------------------------------------------------------*/
26
27 typedef struct _hdrl_parameter_ hdrl_parameter;
28
29/*-----------------------------------------------------------------------------
30 Includes
31 -----------------------------------------------------------------------------*/
32
33#include "hdrl_types.h"
34#include "hdrl_utils.h"
35#include <cpl.h>
36
37CPL_BEGIN_DECLS
38
39/*-----------------------------------------------------------------------------
40 Functions
41 -----------------------------------------------------------------------------*/
42
43 void hdrl_parameter_delete(hdrl_parameter * obj);
44 void hdrl_parameter_destroy(hdrl_parameter * obj);
45
46/*-----------------------------------------------------------------------------
47 Private declarations - must not be used outside of hdrl
48 -----------------------------------------------------------------------------*/
49#ifdef HDRL_USE_PRIVATE
50
55 typedef enum {
56 HDRL_PARAMETER_COLLAPSE_MEAN,
57 HDRL_PARAMETER_COLLAPSE_MEDIAN,
58 HDRL_PARAMETER_COLLAPSE_WEIGHTED_MEAN,
59 HDRL_PARAMETER_COLLAPSE_SIGCLIP,
60 HDRL_PARAMETER_COLLAPSE_MINMAX,
61 HDRL_PARAMETER_COLLAPSE_MODE,
62 HDRL_PARAMETER_RECT_REGION,
63 HDRL_PARAMETER_OVERSCAN,
64 HDRL_PARAMETER_BPM_2D,
65 HDRL_PARAMETER_BPM_3D,
66 HDRL_PARAMETER_BPM_FIT,
67 HDRL_PARAMETER_LACOSMIC,
68 HDRL_PARAMETER_STREHL,
69 HDRL_PARAMETER_FLAT,
70 HDRL_PARAMETER_CATALOGUE,
71 HDRL_PARAMETER_SPECTRUM1D_RESAMPLE_INTERPOLATE,
72 HDRL_PARAMETER_SPECTRUM1D_RESAMPLE_FIT,
73 HDRL_PARAMETER_SPECTRUM1D_RESAMPLE_INTEGRATE,
74 HDRL_PARAMETER_SPECTRUM1D_SHIFT,
75 HDRL_PARAMETER_EFFICIENCY,
76 HDRL_PARAMETER_RESPONSE_TELLURIC_EVALUATION,
77 HDRL_PARAMETER_RESPONSE_FIT,
78 HDRL_PARAMETER_DAR,
79 HDRL_PARAMETER_RESAMPLE_OUTGRID,
80 HDRL_PARAMETER_RESAMPLE_METHOD,
81 HDRL_PARAMETER_PERSISTENCE
82} hdrl_parameter_enum;
83
84
85/* ---------------------------------------------------------------------------*/
94/* ---------------------------------------------------------------------------*/
95#define HDRL_PARAMETER_HEAD void * base
96
97/* ---------------------------------------------------------------------------*/
109/* ---------------------------------------------------------------------------*/
110 typedef struct {
111 /* enum defining type */
112 hdrl_parameter_enum type;
113 /* base parameter structure allocation, e.g. cpl_malloc */
114 hdrl_alloc * fp_alloc;
115 /* shallow destructor of the parameter */
116 hdrl_free * fp_free;
117 /* deep destructor of the parameter, deletes all childs
118 * may be NULL in which case fp_free is used */
119 hdrl_free * fp_destroy;
120 /* size of the base parameter structure, argument to fp_alloc */
121 size_t obj_size;
122} hdrl_parameter_typeobj;
123
124
125/* empty parameter, e.g. for collapse_mean */
126 typedef struct {
127 HDRL_PARAMETER_HEAD;
128} hdrl_parameter_empty;
129
130 hdrl_parameter *
131hdrl_parameter_new(const hdrl_parameter_typeobj * typeobj);
132
133 const hdrl_parameter_typeobj *
134hdrl_parameter_get_type(const hdrl_parameter * self);
135
136hdrl_parameter_enum
137hdrl_parameter_get_parameter_enum(const hdrl_parameter * self);
138
139 int
140hdrl_parameter_check_type(const hdrl_parameter * self,
141 const hdrl_parameter_typeobj * type);
142
143/* create a singleton parameter which does not need allocating or deleting a
144 * comon use case are enum like parameters */
145#define HDRL_PARAMETER_SINGLETON(name, type, alloc) \
146 hdrl_parameter * name = &(hdrl_parameter){ &type }; \
147 static void * alloc(size_t HDRL_UNUSED(n)) \
148{ \
149 return name; \
150}
151
152#endif
153
154CPL_END_DECLS
155
156#endif
hdrl_types.h
hdrl_alloc
void *() hdrl_alloc(size_t)
Definition hdrl_types.h:38
hdrl_free
void() hdrl_free(void *)
Definition hdrl_types.h:39
hdrl_utils.h
hdrl_parameter
struct _hdrl_parameter_ hdrl_parameter
Definition hdrl_parameter.h:27
hdrl_parameter_destroy
void hdrl_parameter_destroy(hdrl_parameter *obj)
deep delete of a parameter
Definition hdrl_parameter.c:164
hdrl_parameter_delete
CPL_BEGIN_DECLS void hdrl_parameter_delete(hdrl_parameter *obj)
shallow delete of a parameter
Definition hdrl_parameter.c:148