sinfo_utils.c

00001 /*                                                                           *
00002  *   This file is part of the ESO SINFONI Pipeline                           *
00003  *   Copyright (C) 2004,2005 European Southern Observatory                   *
00004  *                                                                           *
00005  *   This library is free software; you can redistribute it and/or modify    *
00006  *   it under the terms of the GNU General Public License as published by    *
00007  *   the Free Software Foundation; either version 2 of the License, or       *
00008  *   (at your option) any later version.                                     *
00009  *                                                                           *
00010  *   This program is distributed in the hope that it will be useful,         *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
00013  *   GNU General Public License for more details.                            *
00014  *                                                                           *
00015  *   You should have received a copy of the GNU General Public License       *
00016  *   along with this program; if not, write to the Free Software             *
00017  *   Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA    *
00018  *                                                                           */
00019 /*
00020  * $Author: amodigli $
00021  * $Date: 2012/03/03 10:17:31 $
00022  * $Revision: 1.7 $
00023  * $Name: HEAD $
00024  * $Log: sinfo_utils.c,v $
00025  * Revision 1.7  2012/03/03 10:17:31  amodigli
00026  * fixed some doxygen warnings
00027  *
00028  * Revision 1.6  2010/09/30 14:00:03  kmirny
00029  * moving function from wavecal to utils
00030  *
00031  * Revision 1.5  2007/05/25 06:28:35  amodigli
00032  * fixed plugintest warnings
00033  *
00034  * Revision 1.4  2006/11/07 07:13:25  amodigli
00035  * added doxygen
00036  *
00037  * Revision 1.3  2006/11/04 15:28:36  amodigli
00038  * doxygen
00039  *
00040  * Revision 1.2  2006/10/17 07:02:24  amodigli
00041  * shorten line length
00042  *
00043  * Revision 1.1  2006/08/09 12:26:36  amodigli
00044  * added sinfo_utils.h sinfo_utils.c
00045  *
00046 
00047  */
00048 
00049 #ifdef HAVE_CONFIG_H
00050 #  include <config.h>
00051 #endif
00052 
00054 /*---------------------------------------------------------------------------*/
00061 /*---------------------------------------------------------------------------*/
00062 
00063 /*----------------------------------------------------------------------------
00064                             Includes
00065  ----------------------------------------------------------------------------*/
00066 
00067 #include <sinfo_utils.h>
00074 /*----------------------------------------------------------------------------
00075                             Functions prototypes
00076  ----------------------------------------------------------------------------*/
00077 /*----------------------------------------------------------------------------
00078                             Implementation
00079  ----------------------------------------------------------------------------*/
00080 
00081 /*---------------------------------------------------------------------------*/
00090 /*---------------------------------------------------------------------------*/
00091 long
00092 sinfo_round_double(double x)
00093 {
00094     return (x >=0) ? (long)(x+0.5) : (long)(x-0.5);
00095 }
00101 int
00102 sinfo_parameter_get_default_flag ( const cpl_parameter* p )
00103 {
00104    int flag_gasgano=0;
00105    int flag_norm=0;
00106    int flag=0;
00107    cpl_type type =0;
00108 
00109    flag_norm = ( cpl_parameter_get_default_flag ( p ) == 0 ) ? 1 : 0;
00110    type=cpl_parameter_get_type ( p );
00111 
00112    switch ( type )
00113    {
00114       case CPL_TYPE_BOOL:
00115          flag_gasgano = ( cpl_parameter_get_default_bool ( p ) ==
00116                           cpl_parameter_get_bool ( p ) ) ? 1:0;
00117          break;
00118       case CPL_TYPE_INT:
00119          flag_gasgano = ( cpl_parameter_get_default_int ( p ) ==
00120                           cpl_parameter_get_int ( p ) ) ? 1:0;
00121          break;
00122       case CPL_TYPE_DOUBLE:
00123          flag_gasgano = ( cpl_parameter_get_default_double ( p ) ==
00124                           cpl_parameter_get_double ( p ) ) ? 1:0;
00125          break;
00126       case CPL_TYPE_STRING:
00127          flag_gasgano = ( cpl_parameter_get_default_string ( p ) ==
00128                           cpl_parameter_get_string ( p ) ) ? 1:0;
00129          break;
00130 
00131       default:
00132          cpl_msg_error (cpl_func, "type not supported" );
00133    }
00134 
00135    flag = ( flag_gasgano && flag_norm ) ? 0 : 1;
00136 
00137    return flag;
00138 }

Generated on 3 Mar 2013 for SINFONI Pipeline Reference Manual by  doxygen 1.6.1