GIRAFFE Pipeline Reference Manual

girange.c

00001 /* $Id: girange.c,v 1.3 2007/03/12 12:53:23 rpalsa Exp $
00002  *
00003  * This file is part of the GIRAFFE Pipeline
00004  * Copyright (C) 2002-2006 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 /*
00022  * $Author: rpalsa $
00023  * $Date: 2007/03/12 12:53:23 $
00024  * $Revision: 1.3 $
00025  * $Name: giraffe-2_10 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #  include <config.h>
00030 #endif
00031 
00032 #include <cxmessages.h>
00033 #include <cxmemory.h>
00034 
00035 #include <cpl_error.h>
00036 
00037 #include "girange.h"
00038 
00039 
00048 struct GiRange {
00049     cxdouble min;
00050     cxdouble max;
00051 };
00052 
00053 
00065 GiRange *
00066 giraffe_range_new(void)
00067 {
00068 
00069     GiRange *self = cx_calloc(1, sizeof *self);
00070     return self;
00071 
00072 }
00073 
00074 
00090 GiRange *
00091 giraffe_range_create(cxdouble min, cxdouble max)
00092 {
00093 
00094     const cxchar *fctid = "giraffe_range_create";
00095 
00096     GiRange *self = NULL;
00097 
00098 
00099     if (min > max) {
00100         cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
00101         return NULL;
00102     }
00103 
00104     self = cx_calloc(1, sizeof *self);
00105 
00106     self->min = min;
00107     self->max = max;
00108 
00109     return self;
00110 
00111 }
00112 
00113 
00125 void
00126 giraffe_range_delete(GiRange *self)
00127 {
00128 
00129     if (self) {
00130         cx_free(self);
00131     }
00132 
00133     return;
00134 
00135 }
00136 
00137 
00151 void
00152 giraffe_range_set_min(GiRange *self, cxdouble min)
00153 {
00154 
00155     cx_assert(self != NULL);
00156 
00157     self->min = min;
00158     return;
00159 
00160 }
00161 
00162 
00174 cxdouble
00175 giraffe_range_get_min(const GiRange *const self)
00176 {
00177 
00178     cx_assert(self != NULL);
00179     return self->min;
00180 
00181 }
00182 
00183 
00197 void
00198 giraffe_range_set_max(GiRange *self, cxdouble max)
00199 {
00200 
00201     cx_assert(self != NULL);
00202 
00203     self->max = max;
00204     return;
00205 
00206 }
00207 
00208 
00220 cxdouble
00221 giraffe_range_get_max(const GiRange *const self)
00222 {
00223 
00224     cx_assert(self != NULL);
00225     return self->max;
00226 
00227 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.10.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Thu Mar 7 14:11:02 2013 by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2004