si_step_lampspec.c

00001 /* $Id: si_step_lampspec.c,v 1.9 2005/10/08 10:34:50 amodigli Exp $
00002  *
00003  * This file is part of the CPL (Common Pipeline Library)
00004  * Copyright (C) 2002 European Southern Observatory
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library 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 GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 /*
00021  * $Author: amodigli $
00022  * $Date: 2005/10/08 10:34:50 $
00023  * $Revision: 1.9 $
00024  * $Name:  $
00025  */
00026 
00027  /****************************************************************
00028   *          Lamp_Spec Frames Data Reduction                          *
00029   ****************************************************************/
00030 #include <strings.h>
00031 #include <string.h>
00032 #include <stdio.h>
00033 
00034 
00035 #ifdef HAVE_CONFIG_H
00036 #include <config.h>          /* allows the program compilation */
00037 #endif
00038 #include <cxmacros.h>
00039 #include <cxtypes.h>
00040 #include <cxmessages.h>     /* defines message level types */
00041 #include <cpl_memory.h>       /* defines memory allocation functions */
00042 
00043 #include <cpl_parameterlist.h>    /* defines parlist structure */
00044 #include <cpl_msg.h>  /* defines different messaging functions */
00045 
00046 
00047 #include <cpl_recipe.h>     /* recipe plugin definitions */
00048 #include <cpl_plugin.h>     /* memory allocations functions */
00049 #include <cpl_pluginlist.h> /* memory allocations functions */
00050 #include <cpl_frameset.h>   /* defines operations on frames */
00051 #include <cpl_error.h>
00052 #include <sinfoni_general_config.h>
00053 #include <sinfoni_lamp_spec_config.h>
00054 #include <lamp_spec.h>
00055 #include <sinfoni_memory.h>
00056 
00057 
00058  static cxint si_step_lampspec(cpl_parameterlist *, cpl_frameset *);
00059  const char * sinfoni_get_licence(void)
00060  {
00061   return "bla bla";
00062 
00063  } 
00064  /*
00065   *
00066   * Create the recipe instance, i.e. setup the parameter list for this
00067   * recipe and make it available to the application using the interface.
00068   *
00069   */
00070 
00071 
00072 cxint
00073 si_step_lampspec_create(cpl_plugin *plugin)
00074 {
00075 
00076   /*
00077    * We have to provide the option we accept to the application.
00078    * We need to setup our parameter list and hook it into the recipe
00079    * interface.
00080    */
00081   cpl_recipe *recipe = (cpl_recipe *)plugin;
00082   recipe->parameters = cpl_parameterlist_new();
00083   if(recipe->parameters == NULL) {
00084     return 1;
00085   }
00086 
00087   /*
00088    * Fill the parameter list.
00089    */
00090   sinfoni_general_config_add(recipe->parameters);
00091 
00092   sinfoni_lamp_spec_config_add(recipe->parameters);
00093   
00094   return 0;
00095 
00096 }
00097 
00098 cxint
00099 si_step_lampspec_exec(cpl_plugin *plugin)
00100 {
00101 
00102   cpl_recipe *recipe = (cpl_recipe *) plugin;
00103   if(recipe->parameters == NULL) {
00104     return 1;
00105   }
00106   if(recipe->frames == NULL) {
00107     return 1;
00108   }
00109   cpl_error_reset();
00110   return si_step_lampspec(recipe->parameters, recipe->frames);
00111 
00112 }
00113 
00114 cxint
00115 si_step_lampspec_destroy(cpl_plugin *plugin)
00116 {
00117 
00118   cpl_recipe *recipe = (cpl_recipe *) plugin;
00119   /*
00120    * We just destroy what was created during the plugin initializzation phase
00121    * i.e. the parameter list. The frame set is managed by the application which
00122    * called us, so that we must not touch it.
00123    */
00124   cpl_parameterlist_delete(recipe->parameters);
00125   return 0;
00126 
00127 }
00128 
00129 int
00130 cpl_plugin_get_info(cpl_pluginlist *list)
00131 {
00132 
00133   cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00134   cpl_plugin *plugin = &recipe->interface;
00135 
00136 
00137   cpl_plugin_init(plugin,
00138           CPL_PLUGIN_API,
00139           SINFONI_BINARY_VERSION,
00140           CPL_PLUGIN_TYPE_RECIPE,
00141           "si_step_lampspec",
00142           "Lamp Flats data reduction",
00143           "TBD",
00144           "A. Modigliani",
00145           "amodigli@eso.org",
00146           "No license",
00147           si_step_lampspec_create,
00148           si_step_lampspec_exec,
00149           si_step_lampspec_destroy);
00150 
00151   cpl_pluginlist_append(list, plugin);
00152 
00153   return 0;
00154 
00155 }
00156 
00157 
00158 /*
00159  * The actual recipe actually start here.
00160  */
00161 
00162 static cxint
00163 si_step_lampspec(cpl_parameterlist *config, cpl_frameset *set)
00164 {
00165  
00166   const char *_id = "si_step_lampspec";
00167   int  ind =0;
00168  
00169   /* cpl_parameterlist_dump(config); */
00170 
00171     
00172     {
00173       
00174     cpl_msg_info (_id,"Running") ; 
00175         if ( -1 == (ind = lamp_spec(config,set ) ) )
00176         {
00177         cpl_msg_error(_id,"no: %d\n") ;
00178         return -1 ;
00179     }
00180      
00181     cpl_msg_info (_id,"success") ; 
00182     }    
00183 
00184     return 0 ;
00185 }
00186 
00187 

Generated on Wed Oct 26 13:08:54 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001