GIRAFFE Pipeline Reference Manual

gierror.c

00001 /* $Id: gierror.c,v 1.8 2010/03/08 08:39:33 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: 2010/03/08 08:39:33 $
00024  * $Revision: 1.8 $
00025  * $Name: giraffe-2_10 $
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     _error_init = TRUE;
00068     return;
00069 
00070 }
00071 
00072 
00073 void
00074 giraffe_error_clear(void)
00075 {
00076 
00077     if (_error_init == TRUE) {
00078         _error_init = FALSE;
00079     }
00080 
00081     return;
00082 
00083 }
00084 
00085 
00086 void
00087 giraffe_error_push(void)
00088 {
00089 
00090     cx_assert(_error_init == TRUE);
00091 
00092     _error.state = cpl_errorstate_get();
00093     _error_saved = TRUE;
00094 
00095     cpl_error_reset();
00096 
00097     return;
00098 
00099 }
00100 
00101 
00102 void
00103 giraffe_error_pop(void)
00104 {
00105 
00106     cx_assert(_error_init == TRUE);
00107 
00108     if (_error_saved == TRUE) {
00109 
00110         cpl_errorstate_set(_error.state);
00111         _error_saved = FALSE;
00112 
00113     }
00114 
00115     return;
00116 
00117 }

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