GIRAFFE Pipeline Reference Manual

girange.c
1 /* $Id$
2  *
3  * This file is part of the GIRAFFE Pipeline
4  * Copyright (C) 2002-2006 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$
23  * $Date$
24  * $Revision$
25  * $Name$
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
31 
32 #include <cxmessages.h>
33 #include <cxmemory.h>
34 
35 #include <cpl_error.h>
36 
37 #include "girange.h"
38 
39 
48 struct GiRange {
49  cxdouble min;
50  cxdouble max;
51 };
52 
53 
65 GiRange *
67 {
68 
69  GiRange *self = cx_calloc(1, sizeof *self);
70  return self;
71 
72 }
73 
74 
90 GiRange *
91 giraffe_range_create(cxdouble min, cxdouble max)
92 {
93 
94  const cxchar *fctid = "giraffe_range_create";
95 
96  GiRange *self = NULL;
97 
98 
99  if (min > max) {
100  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
101  return NULL;
102  }
103 
104  self = cx_calloc(1, sizeof *self);
105 
106  self->min = min;
107  self->max = max;
108 
109  return self;
110 
111 }
112 
113 
125 void
126 giraffe_range_delete(GiRange *self)
127 {
128 
129  if (self) {
130  cx_free(self);
131  }
132 
133  return;
134 
135 }
136 
137 
151 void
152 giraffe_range_set_min(GiRange *self, cxdouble min)
153 {
154 
155  cx_assert(self != NULL);
156 
157  self->min = min;
158  return;
159 
160 }
161 
162 
174 cxdouble
175 giraffe_range_get_min(const GiRange *const self)
176 {
177 
178  cx_assert(self != NULL);
179  return self->min;
180 
181 }
182 
183 
197 void
198 giraffe_range_set_max(GiRange *self, cxdouble max)
199 {
200 
201  cx_assert(self != NULL);
202 
203  self->max = max;
204  return;
205 
206 }
207 
208 
220 cxdouble
221 giraffe_range_get_max(const GiRange *const self)
222 {
223 
224  cx_assert(self != NULL);
225  return self->max;
226 
227 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.12.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Mon Mar 24 2014 11:43:52 by doxygen 1.8.2 written by Dimitri van Heesch, © 1997-2004