irplib_detmon_body.h

00001 /* $Id: irplib_detmon_body.h,v 1.2 2007/11/06 17:48:15 lbilbao Exp $
00002  *
00003  * This file is part of the ESO Common Pipeline Library
00004  * Copyright (C) 2001-2004 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 #define CPL_CONCAT(a,b) a ## _ ## b
00022 #define CPL_CONCAT2X(a,b) CPL_CONCAT(a,b)
00023 
00024 /* Type dependent macros */
00025 #if   CPL_CLASS == CPL_TABLE
00026 #define CPL_OBJECT          cpl_table
00027 
00028 #elif CPL_CLASS == CPL_PROPERTYLIST
00029 #define CPL_OBJECT          cpl_propertylist
00030 
00031 #elif CPL_CLASS == CPL_IMAGELIST
00032 #define CPL_OBJECT          cpl_imagelist
00033 
00034 #elif CPL_CLASS == CPL_IMAGE
00035 #define CPL_OBJECT          cpl_image
00036 
00037 #else
00038 #undef CPL_OBJECT
00039 #endif
00040 
00041 #define CPL_OBJECT_ADD(a) CPL_CONCAT2X(CPL_OBJECT, a)
00042 
00043 #if   CPL_OPERATION == CPL_NEW
00044 
00045     CPL_OBJECT ** ptr
00046     = (CPL_OBJECT **) cpl_malloc(nexts * sizeof(CPL_OBJECT *));
00047     int j;
00048 
00049     for(j = 0; j < nexts; j++) {
00050     ptr[j] = NULL;
00051     }
00052 
00053     return ptr;
00054 
00055 #elif CPL_OPERATION == CPL_DELETE
00056 
00057     int j;
00058 
00059     if (d == NULL) return;
00060 
00061     for(j = 0; j < nexts; j++) {
00062     CPL_OBJECT_ADD(delete)(d[j]);
00063     }
00064     cpl_free(d);
00065 
00066     return;
00067 
00068 #endif
00069 
00070 #undef CPL_OBJECT

Generated on Thu Nov 15 14:32:25 2007 for UVES Pipeline Reference Manual by  doxygen 1.5.1