GIRAFFE Pipeline Reference Manual

gierror.c

00001 /* $Id: gierror.c,v 1.7 2007/08/23 08:39:06 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/08/23 08:39:06 $
00024  * $Revision: 1.7 $
00025  * $Name: giraffe-2_5_1 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #  include <config.h>
00030 #endif
00031 
00032 #include <cxmemory.h>
00033 #include <cxstring.h>
00034 #include <cxstrutils.h>
00035 
00036 #include <cpl_error.h>
00037 #include <cpl_errorstate.h>
00038 
00039 #include "gierror.h"
00040 
00041 
00042 struct GiError {
00043     cpl_errorstate state;
00044 };
00045 
00046 typedef struct GiError GiError;
00047 
00048 
00049 static GiError _error ;
00050 
00051 static cxbool _error_init = FALSE;
00052 static cxbool _error_saved = FALSE;
00053 
00054 
00063 void
00064 giraffe_error_init(void)
00065 {
00066 
00067     cpl_errorstate_get();
00068     _error_init = TRUE;
00069 
00070     return;
00071 
00072 }
00073 
00074 
00075 void
00076 giraffe_error_clear(void)
00077 {
00078 
00079     if (_error_init == TRUE) {
00080         _error_init = FALSE;
00081     }
00082 
00083     return;
00084 
00085 }
00086 
00087 
00088 void
00089 giraffe_error_push(void)
00090 {
00091 
00092     cx_assert(_error_init == TRUE);
00093 
00094     _error.state = cpl_errorstate_get();
00095     _error_saved = TRUE;
00096 
00097     cpl_error_reset();
00098 
00099     return;
00100 
00101 }
00102 
00103 
00104 void
00105 giraffe_error_pop(void)
00106 {
00107 
00108     cx_assert(_error_init == TRUE);
00109 
00110     if (_error_saved == TRUE) {
00111 
00112         cpl_errorstate_set(_error.state);
00113         _error_saved = FALSE;
00114 
00115     }
00116 
00117     return;
00118 
00119 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.5.1.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Tue Mar 18 10:47:41 2008 by doxygen 1.4.6 written by Dimitri van Heesch, © 1997-2004