hawki_alloc.c

00001 /* $Id: hawki_alloc.c,v 1.1 2008/11/26 09:53:31 cgarcia Exp $
00002  *
00003  * This file is part of the HAWKI Pipeline
00004  * Copyright (C) 2002,2003 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: cgarcia $
00023  * $Date: 2008/11/26 09:53:31 $
00024  * $Revision: 1.1 $
00025  * $Name: hawki-1_8_0 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*-----------------------------------------------------------------------------
00033                                    Includes
00034  -----------------------------------------------------------------------------*/
00035 
00036 #include <cpl.h>
00037 #include "hawki_utils.h"
00038 #include "hawki_alloc.h"
00039 
00040 /*----------------------------------------------------------------------------*/
00044 /*----------------------------------------------------------------------------*/
00045 
00054 int hawki_table_delete(cpl_table ** table)
00055 {
00056     int idet;
00057     
00058     for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
00059         cpl_table_delete(table[idet]);
00060     cpl_free(table);
00061     if(cpl_errorstate_get() != CPL_ERROR_NONE)
00062         return -1;
00063     return 0;
00064 }
00065 
00072 cpl_table ** hawki_table_new(int nrow)
00073 {
00074     int idet;
00075     cpl_table ** tables;
00076     
00077     tables = cpl_malloc(sizeof(cpl_table *) * HAWKI_NB_DETECTORS);
00078     for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
00079         tables[idet] = cpl_table_new(nrow);
00080     
00081     if(cpl_errorstate_get() != CPL_ERROR_NONE)
00082         return NULL;
00083     return tables;    
00084 }
00085 

Generated on Thu Feb 17 17:13:07 2011 for HAWKI Pipeline Reference Manual by  doxygen 1.4.7