HAWKI Pipeline Reference Manual  1.8.12
hawki_alloc.c
1 /* $Id: hawki_alloc.c,v 1.1 2008/11/26 09:53:31 cgarcia Exp $
2  *
3  * This file is part of the HAWKI Pipeline
4  * Copyright (C) 2002,2003 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: cgarcia $
23  * $Date: 2008/11/26 09:53:31 $
24  * $Revision: 1.1 $
25  * $Name: hawki-1_8_12 $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 /*-----------------------------------------------------------------------------
33  Includes
34  -----------------------------------------------------------------------------*/
35 
36 #include <cpl.h>
37 #include "hawki_utils.h"
38 #include "hawki_alloc.h"
39 
40 /*----------------------------------------------------------------------------*/
44 /*----------------------------------------------------------------------------*/
45 
54 int hawki_table_delete(cpl_table ** table)
55 {
56  int idet;
57 
58  for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
59  cpl_table_delete(table[idet]);
60  cpl_free(table);
61  if(cpl_errorstate_get() != CPL_ERROR_NONE)
62  return -1;
63  return 0;
64 }
65 
72 cpl_table ** hawki_table_new(int nrow)
73 {
74  int idet;
75  cpl_table ** tables;
76 
77  tables = cpl_malloc(sizeof(cpl_table *) * HAWKI_NB_DETECTORS);
78  for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
79  tables[idet] = cpl_table_new(nrow);
80 
81  if(cpl_errorstate_get() != CPL_ERROR_NONE)
82  return NULL;
83  return tables;
84 }
85