irplib_utils.h

00001 /* $Id: irplib_utils.h,v 1.29 2006/11/27 10:25:57 llundin Exp $
00002  *
00003  * This file is part of the irplib package 
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., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: llundin $
00023  * $Date: 2006/11/27 10:25:57 $
00024  * $Revision: 1.29 $
00025  * $Name:  $
00026  */
00027 
00028 #ifndef IRPLIB_UTILS_H
00029 #define IRPLIB_UTILS_H
00030 
00031 /*-----------------------------------------------------------------------------
00032                                    Includes
00033  -----------------------------------------------------------------------------*/
00034 
00035 #include <stdarg.h>
00036 
00037 #include <cpl.h>
00038 
00039 /*-----------------------------------------------------------------------------
00040                                    Define
00041  -----------------------------------------------------------------------------*/
00042 
00043 /*
00044   @ingroup irplib_utils
00045   @brief  Create a string and fill it using vsnprintf()
00046   @param  format  The format string
00047   @param  arglist The argument list for the format
00048   @return The created string or NULL on error
00049   @note   The created string must be deallocated with cpl_free()
00050   @see vsnprintf()
00051  
00052  @hideinitializer
00053 */
00054 
00055 #define irplib_vsprintf(FORMAT, ARGLIST) \
00056    irplib_vsprintf_macro(FORMAT, ARGLIST, ARGLIST)
00057 
00058 /* Deprecated, remove (when irplib_image_save() has been updated) */
00059 #define irplib_vsnprintf_create irplib_vsprintf
00060 #define irplib_string_concatenate_all irplib_sprintf
00061 
00062 /* Useful for debugging */
00063 #define irplib_trace()  do if (cpl_error_get_code()) { \
00064     cpl_msg_debug(cpl_func, __FILE__ " at line %d: ERROR '%s' at %s", \
00065          __LINE__, cpl_error_get_message(), cpl_error_get_where()); \
00066   } else { \
00067     cpl_msg_debug(cpl_func, __FILE__ " at line %d: OK", __LINE__); \
00068   } while (0)
00069 
00070 /* FIXME: These can be replaced with cpl_ensure{,_code}() once support for
00071    CPL 2.1 is dropped */
00072 #define irplib_assure cpl_ensure
00073 #define irplib_assure_code cpl_ensure_code
00074 
00075 /*-----------------------------------------------------------------------------
00076                                    Function prototypes
00077  -----------------------------------------------------------------------------*/
00078 
00079 void irplib_reset(void);
00080 int irplib_compare_tags(cpl_frame *, cpl_frame *);
00081 const char * irplib_frameset_find_file(const cpl_frameset *, const char *);
00082 cpl_frame * irplib_frameset_get_first_from_group(const cpl_frameset *,
00083                                                  cpl_frame_group);
00084 
00085 cpl_error_code irplib_apertures_find_max_flux(const cpl_apertures *, int *,
00086                                               int);
00087 
00088 cpl_type_bpp irplib_bpp_find(int, int);
00089 
00090 char * irplib_vsprintf_macro(const char *, va_list, va_list)
00091 #ifdef __GNUC__
00092      __attribute__((format (printf, 1, 0)))
00093 #endif
00094      ;
00095 
00096      char * irplib_sprintf(const char *, ...)
00097 #ifdef __GNUC__
00098      __attribute__((format (printf, 1, 2)))
00099 #endif
00100      ;
00101 
00102 #endif

Generated on Wed Jan 17 08:33:41 2007 for SINFONI Pipeline Reference Manual by  doxygen 1.4.4