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

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

Loading...
Searching...
No Matches
hdrl_types.h
Go to the documentation of this file.
1/* $Id: hdrl_types.h,v 1.2 2013-10-11 13:46:00 jtaylor Exp $
2 *
3 * This file is part of the HDRL
4 * Copyright (C) 2013 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/*
22 * $Author: jtaylor $
23 * $Date: 2013-10-11 13:46:00 $
24 * $Revision: 1.2 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifndef HDRL_TYPES_H
29#define HDRL_TYPES_H
30
31#include <float.h> /* for epsilon */
32#include <stddef.h> /* for size_t */
33
34/*-----------------------------------------------------------------------------
35 Generic types
36 -----------------------------------------------------------------------------*/
37
38 typedef void * (hdrl_alloc)(size_t);
39 typedef void (hdrl_free)(void *);
40
41/* basic type for bit mask values, e.g. bad pixel classifications */
42 typedef unsigned int hdrl_bitmask_t;
43
44#ifndef HDRL_SIZEOF_DATA
45#define HDRL_SIZEOF_DATA 8
46#endif
47#ifndef HDRL_SIZEOF_ERROR
48#define HDRL_SIZEOF_ERROR 8
49#endif
50
51/* makes little sense and causes problems when error propagation
52 * mixes the two types (mul/div) */
53#if HDRL_SIZEOF_ERROR > HDRL_SIZEOF_DATA
54#error HDRL_SIZEOF_ERROR must not be larger than HDRL_SIZEOF_DATA
55#endif
56
57#if HDRL_SIZEOF_DATA == 4
58 typedef float hdrl_data_t;
59#define HDRL_TYPE_DATA CPL_TYPE_FLOAT
60#define HDRL_EPS_DATA FLT_EPSILON
61#else
62 typedef double hdrl_data_t;
63#define HDRL_TYPE_DATA CPL_TYPE_DOUBLE
64#define HDRL_EPS_DATA DBL_EPSILON
65#endif
66
67#if HDRL_SIZEOF_ERROR == 4
68 typedef float hdrl_error_t;
69#define HDRL_TYPE_ERROR CPL_TYPE_FLOAT
70#define HDRL_EPS_ERROR FLT_EPSILON
71#else
72 typedef double hdrl_error_t;
73#define HDRL_TYPE_ERROR CPL_TYPE_DOUBLE
74#define HDRL_EPS_ERROR DBL_EPSILON
75#endif
76
77 typedef struct {
78 hdrl_data_t data;
79 hdrl_error_t error;
80} hdrl_value;
81
82#endif
hdrl_alloc
void *() hdrl_alloc(size_t)
Definition hdrl_types.h:38
hdrl_error_t
double hdrl_error_t
Definition hdrl_types.h:72
hdrl_data_t
double hdrl_data_t
Definition hdrl_types.h:62
hdrl_free
void() hdrl_free(void *)
Definition hdrl_types.h:39
hdrl_bitmask_t
unsigned int hdrl_bitmask_t
Definition hdrl_types.h:42
hdrl_value
Definition hdrl_types.h:77
hdrl_value::error
hdrl_error_t error
Definition hdrl_types.h:79
hdrl_value::data
hdrl_data_t data
Definition hdrl_types.h:78