uves_recipe.h

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: 2007/06/06 08:17:33 $
00023  * $Revision: 1.12 $
00024  * $Name: uves-3_4_5 $
00025  * $Log: uves_recipe.h,v $
00026  * Revision 1.12  2007/06/06 08:17:33  amodigli
00027  * replace tab with 4 spaces
00028  *
00029  * Revision 1.11  2007/02/09 15:10:42  jmlarsen
00030  * Show recipe name correctly
00031  *
00032  * Revision 1.10  2007/02/09 13:40:11  jmlarsen
00033  * Added year 2007
00034  *
00035  * Revision 1.9  2007/01/10 12:39:44  jmlarsen
00036  * Replace UVES_TFLAT_ID with recipe name parameter
00037  *
00038  * Revision 1.8  2006/11/16 14:10:49  jmlarsen
00039  * Fixed usage of recipe name string in error message
00040  *
00041  * Revision 1.7  2006/11/15 15:02:15  jmlarsen
00042  * Implemented const safe workarounds for CPL functions
00043  *
00044  * Revision 1.5  2006/11/15 14:04:08  jmlarsen
00045  * Removed non-const version of parameterlist_get_first/last/next which is already
00046  * in CPL, added const-safe wrapper, unwrapper and deallocator functions
00047  *
00048  * Revision 1.4  2006/10/24 14:01:21  jmlarsen
00049  * include uves_msg.h
00050  *
00051  * Revision 1.3  2006/10/17 12:33:08  jmlarsen
00052  * Added semicolon at UVES_RECIPE_DEFINE invocation
00053  *
00054  * Revision 1.2  2006/10/10 14:43:48  jmlarsen
00055  * Add semicolon at invocation of IRPLIB_RECIPE_DEFINE
00056  *
00057  * Revision 1.1  2006/10/09 13:01:33  jmlarsen
00058  * Use macro to define recipe interface functions
00059  *
00060  * Revision 1.3  2005/12/19 16:17:55  jmlarsen
00061  * Replaced bool -> int
00062  *
00063  */
00064 
00065 #ifndef UVES_RECIPE_H
00066 #define UVES_RECIPE_H
00067 
00068 #include <uves_msg.h>
00069 #include <uves_error.h>
00070 #include <irplib_plugin.h>
00071 #include <cpl.h>
00072 
00073 /*-----------------------------------------------------------------------------
00074                                    Defines
00075  -----------------------------------------------------------------------------*/
00076 #define UVES_RECIPE_DEFINE(NAME, MSG_DOMAIN, FILL_PARAMS_FUNC,                 \
00077                AUTHOR, AUTHOR_EMAIL,                               \
00078                SYNOPSIS, DESCRIPTION)                              \
00079      IRPLIB_RECIPE_DEFINE(NAME, UVES_BINARY_VERSION,                           \
00080      FILL_PARAMS_FUNC(recipe->parameters),                                     \
00081      AUTHOR, AUTHOR_EMAIL, "2004, 2005, 2006, 2007", SYNOPSIS, DESCRIPTION);   \
00082                                                                                \
00083 static void IRPLIB_CONCAT2X(NAME,exe)(cpl_frameset *,                          \
00084                      const cpl_parameterlist *,                \
00085                                      const char *starttime);                   \
00086                                                                                \
00087 /* This is the UVES pipeline specific (but common to all recipes)              \
00088    code to run before/after executing each recipe. It calls the function       \
00089    uves_rrrecipe_exe(frames, parameters, starttime) declared above. */         \
00090                                                                                \
00091 static int NAME(cpl_frameset *frames,                                          \
00092         const cpl_parameterlist *parameters)                           \
00093 {                                                                              \
00094     char *starttime = NULL;                                                    \
00095                                                                                \
00096     /* Error handling (irplib) was already initialized */                      \
00097                                                                                \
00098     /* Initialize messaging */                                                 \
00099     uves_msg_init(-1, MSG_DOMAIN);        /* -1 = max level */                 \
00100                                                                                \
00101     /* Initialize recipe */                                                    \
00102     check( (uves_msg_louder(),                                                 \
00103             starttime = uves_initialize(frames, parameters, make_str(NAME),    \
00104                        SYNOPSIS),                              \
00105             uves_msg_softer()),                                                \
00106        "Initialization failed");                                           \
00107                                                                                \
00108     /* Recipe specific actions */                                              \
00109     check( (uves_msg_louder(),                                                 \
00110             IRPLIB_CONCAT2X(NAME,exe)(frames, parameters, starttime),          \
00111             uves_msg_softer()),                                                \
00112         MSG_DOMAIN " execution failed");                                   \
00113                                                                                \
00114     /* Terminate recipe */                                                     \
00115     check( uves_end(make_str(NAME), frames), "Termination failed");            \
00116                                                                                \
00117   cleanup:                                                                     \
00118     cpl_free(starttime);                                                       \
00119                                            \
00120     return (cpl_error_get_code() == CPL_ERROR_NONE) ? 0 : 1;                   \
00121 }                                                                              \
00122   /* This dummy declaration requires the macro to be invoked as if it was      \
00123      a kind of function declaration, with a terminating ; */                   \
00124 extern int uves_recipe_end
00125 
00126 
00127 #endif

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