si_step_objnod.c

00001 /* $Id: si_step_objnod.c,v 1.13 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.13 $
00024  * $Name:  $
00025  */
00026 
00027  /****************************************************************
00028   *           Object Data reduction                              *
00029   ****************************************************************/
00030 #include <strings.h>
00031 #include <string.h>
00032 #include <stdio.h>
00033 
00034 #ifdef HAVE_CONFIG_H
00035 #include <config.h>          /* allows the program compilation */
00036 #endif
00037 #include <cxmacros.h>
00038 #include <cxtypes.h>
00039 #include <cxmessages.h>     /* defines message level types */
00040 #include <cpl_memory.h>       /* defines memory allocation functions */
00041 
00042 #include <cpl_parameterlist.h>    /* defines parlist structure */
00043 #include <cpl_msg.h>  /* defines different messaging functions */
00044 
00045 
00046 #include <cpl_recipe.h>     /* recipe plugin definitions */
00047 #include <cpl_plugin.h>     /* memory allocations functions */
00048 #include <cpl_pluginlist.h> /* memory allocations functions */
00049 #include <cpl_frameset.h>   /* defines operations on frames */
00050 #include <cpl_error.h>
00051 
00052 #include <sinfoni_pro_types.h>
00053 #include <sinfoni_general_config.h>
00054 #include <sinfoni_objnod_config.h>
00055 #include <objnod.h>
00056 #include <objnod_rel.h>
00057 #include <sinfoni_globals.h>
00058 #include <sinfoni_memory.h>
00059 static cxint si_step_objnod(cpl_parameterlist *, cpl_frameset *);
00060 const char * sinfoni_get_licence(void)
00061 {
00062   return "bla bla";
00063 
00064 }
00065 
00066 
00067 cxint
00068 si_step_objnod_create(cpl_plugin *plugin)
00069 {
00070 
00071   /*
00072    * We have to provide the option we accept to the application.
00073    * We need to setup our parameter list and hook it into the recipe
00074    * interface.
00075    */
00076   cpl_recipe *recipe = (cpl_recipe *)plugin;
00077   recipe->parameters = cpl_parameterlist_new();
00078   if(recipe->parameters == NULL) {
00079     return 1;
00080   }
00081 
00082   /*
00083    * Fill the parameter list.
00084    */
00085 
00086   /* General parameters */
00087   sinfoni_general_config_add(recipe->parameters); 
00088   sinfoni_objnod_config_add(recipe->parameters); 
00089   
00090   return 0;
00091 
00092 }
00093 
00094 cxint
00095 si_step_objnod_exec(cpl_plugin *plugin)
00096 {
00097  
00098   cpl_recipe *recipe = (cpl_recipe *) plugin;
00099   if(recipe->parameters == NULL) {
00100     return 1;
00101   }
00102   if(recipe->frames == NULL) {
00103     return 1;
00104   }
00105   cpl_error_reset();
00106   return si_step_objnod(recipe->parameters, recipe->frames);
00107 
00108 }
00109 
00110 cxint
00111 si_step_objnod_destroy(cpl_plugin *plugin)
00112 {
00113   cpl_recipe *recipe = (cpl_recipe *) plugin;
00114   /*
00115    * We just destroy what was created during the plugin initializzation phase
00116    * i.e. the parameter list. The frame set is managed by the application which
00117    * called us, so that we must not touch it.
00118    */
00119 
00120   cpl_parameterlist_delete(recipe->parameters);
00121 
00122   return 0;
00123 
00124 }
00125 
00126 int
00127 cpl_plugin_get_info(cpl_pluginlist *list)
00128 {
00129 
00130   cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00131   cpl_plugin *plugin = &recipe->interface;
00132 
00133 
00134   cpl_plugin_init(plugin,
00135           CPL_PLUGIN_API,
00136           SINFONI_BINARY_VERSION,
00137           CPL_PLUGIN_TYPE_RECIPE,
00138           "si_step_objnod",
00139           "Object data reduction",
00140           "TBD",
00141           "A. Modigliani",
00142           "amodigli@eso.org",
00143           "No license",
00144           si_step_objnod_create,
00145           si_step_objnod_exec,
00146           si_step_objnod_destroy);
00147 
00148   cpl_pluginlist_append(list, plugin);
00149 
00150   return 0;
00151 
00152 }
00153 
00154 
00155 
00156 /*
00157  * The actual recipe actually start here.
00158  */
00159 
00160 static cxint
00161 si_step_objnod(cpl_parameterlist *config, cpl_frameset *set)
00162 { 
00163   const char *_id = "si_step_objnod";
00164   int  ind =0;
00165  
00166  
00167   /* cpl_parameterlist_dump(config); */
00168   cpl_msg_info (_id,"------------------------------") ;
00169   cpl_msg_info(_id,"NODDING SCIENCE FRAMES");
00170   cpl_msg_info (_id,"------------------------------") ; 
00171   if ( -1 == (ind = objnod(config, set, PRO_COADD_OBJ ) ) ) {
00172     cpl_msg_info(_id,"no: %d\n", ind) ;
00173     return -1 ;
00174   } else {
00175     cpl_msg_info(_id,"success");
00176   }
00177   return 0 ;
00178 
00179 }
00180 

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