00001 /* 00002 * This file is part of the ESO UVES Pipeline 00003 * Copyright (C) 2004,2005 European Southern Observatory 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA 00018 */ 00019 00020 /* 00021 * $Author: amodigli $ 00022 * $Date: 2010/09/24 09:32:07 $ 00023 * $Revision: 1.15 $ 00024 * $Name: uves-5_0_0 $ 00025 * $Log: uves_recipe.h,v $ 00026 * Revision 1.15 2010/09/24 09:32:07 amodigli 00027 * put back QFITS dependency to fix problem spot by NRI on FIBER mode (with MIDAS calibs) data 00028 * 00029 * Revision 1.13 2008/03/28 08:56:19 amodigli 00030 * IRPLIB_RECIPE_DEFINE-->UVES_IRPLIB_RECIPE_DEFINE IRPLIB_CONCAT2X UVES_CONCAT2X irplib_plugin-->uves_plugin 00031 * 00032 * Revision 1.12 2007/06/06 08:17:33 amodigli 00033 * replace tab with 4 spaces 00034 * 00035 * Revision 1.11 2007/02/09 15:10:42 jmlarsen 00036 * Show recipe name correctly 00037 * 00038 * Revision 1.10 2007/02/09 13:40:11 jmlarsen 00039 * Added year 2007 00040 * 00041 * Revision 1.9 2007/01/10 12:39:44 jmlarsen 00042 * Replace UVES_TFLAT_ID with recipe name parameter 00043 * 00044 * Revision 1.8 2006/11/16 14:10:49 jmlarsen 00045 * Fixed usage of recipe name string in error message 00046 * 00047 * Revision 1.7 2006/11/15 15:02:15 jmlarsen 00048 * Implemented const safe workarounds for CPL functions 00049 * 00050 * Revision 1.5 2006/11/15 14:04:08 jmlarsen 00051 * Removed non-const version of parameterlist_get_first/last/next which is already 00052 * in CPL, added const-safe wrapper, unwrapper and deallocator functions 00053 * 00054 * Revision 1.4 2006/10/24 14:01:21 jmlarsen 00055 * include uves_msg.h 00056 * 00057 * Revision 1.3 2006/10/17 12:33:08 jmlarsen 00058 * Added semicolon at UVES_RECIPE_DEFINE invocation 00059 * 00060 * Revision 1.2 2006/10/10 14:43:48 jmlarsen 00061 * Add semicolon at invocation of IRPLIB_RECIPE_DEFINE 00062 * 00063 * Revision 1.1 2006/10/09 13:01:33 jmlarsen 00064 * Use macro to define recipe interface functions 00065 * 00066 * Revision 1.3 2005/12/19 16:17:55 jmlarsen 00067 * Replaced bool -> int 00068 * 00069 */ 00070 00071 #ifndef UVES_RECIPE_H 00072 #define UVES_RECIPE_H 00073 00074 #include <uves_msg.h> 00075 #include <uves_error.h> 00076 #include <uves_plugin.h> 00077 #include <cpl.h> 00078 00079 /*----------------------------------------------------------------------------- 00080 Defines 00081 -----------------------------------------------------------------------------*/ 00082 #define UVES_RECIPE_DEFINE(NAME, MSG_DOMAIN, FILL_PARAMS_FUNC, \ 00083 AUTHOR, AUTHOR_EMAIL, \ 00084 SYNOPSIS, DESCRIPTION) \ 00085 UVES_IRPLIB_RECIPE_DEFINE(NAME, UVES_BINARY_VERSION, \ 00086 FILL_PARAMS_FUNC(recipe->parameters), \ 00087 AUTHOR, AUTHOR_EMAIL, "2004, 2005, 2006, 2007", SYNOPSIS, DESCRIPTION); \ 00088 \ 00089 static void UVES_CONCAT2X(NAME,exe)(cpl_frameset *, \ 00090 const cpl_parameterlist *, \ 00091 const char *starttime); \ 00092 \ 00093 /* This is the UVES pipeline specific (but common to all recipes) \ 00094 code to run before/after executing each recipe. It calls the function \ 00095 uves_rrrecipe_exe(frames, parameters, starttime) declared above. */ \ 00096 \ 00097 static int NAME(cpl_frameset *frames, \ 00098 const cpl_parameterlist *parameters) \ 00099 { \ 00100 char *starttime = NULL; \ 00101 \ 00102 /* Error handling (irplib) was already initialized */ \ 00103 \ 00104 /* Initialize messaging */ \ 00105 uves_msg_init(-1, MSG_DOMAIN); /* -1 = max level */ \ 00106 \ 00107 /* Initialize recipe */ \ 00108 check( (uves_msg_louder(), \ 00109 starttime = uves_initialize(frames, parameters, make_str(NAME), \ 00110 SYNOPSIS), \ 00111 uves_msg_softer()), \ 00112 "Initialization failed"); \ 00113 \ 00114 /* Recipe specific actions */ \ 00115 check( (uves_msg_louder(), \ 00116 UVES_CONCAT2X(NAME,exe)(frames, parameters, starttime), \ 00117 uves_msg_softer()), \ 00118 MSG_DOMAIN " execution failed"); \ 00119 \ 00120 /* Terminate recipe */ \ 00121 check( uves_end(make_str(NAME), frames), "Termination failed"); \ 00122 \ 00123 cleanup: \ 00124 cpl_free(starttime); \ 00125 \ 00126 return (cpl_error_get_code() == CPL_ERROR_NONE) ? 0 : 1; \ 00127 } \ 00128 /* This dummy declaration requires the macro to be invoked as if it was \ 00129 a kind of function declaration, with a terminating ; */ \ 00130 extern int uves_recipe_end 00131 00132 00133 #endif