/*--------------------------------------------------------------------------- File name : products.c Author : N. Devillard Created on : January 2002 Description : CONICA product category handling *--------------------------------------------------------------------------*/ /* $Id: products.c,v 1.1 2002/01/23 14:01:07 ndevilla Exp $ $Author: ndevilla $ $Date: 2002/01/23 14:01:07 $ $Revision: 1.1 $ */ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include #include "products.h" #include "products_sta.h" /*--------------------------------------------------------------------------- Function codes ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @name conica_get_pro_catg_key @memo Associate a category label to a string. @param key A string found in a product as PRO.CATG @return A category label @doc This function expects a string as read from e.g. the PRO.CATG keyword in a PAF or FITS header, and converts it to a valid category label. The returned label is invalid_product_key (0) if the string has no known association. */ /*--------------------------------------------------------------------------*/ pro_catg_key conica_get_pro_catg_key(char * key) { pro_catg_key found ; int i ; i=0 ; found = invalid_product_key ; while (prod_list[i].prod_id != end_product_key) { if (!strcmp(prod_list[i].key, key)) { found = prod_list[i].prod_id ; break ; } i++ ; } return found ; } /*-------------------------------------------------------------------------*/ /** @name conica_get_pro_catg_value @memo Associate a string to a category label. @param cat A category label @return 1 pointer to statically allocated string. @doc This function expects a valid category label, and returns an associated character string to be placed e.g. in the PRO.CATG keyword of an output PAF or FITS file. The returned string is statically allocated so do not free it or modify it. */ /*--------------------------------------------------------------------------*/ char * conica_get_pro_catg_value(pro_catg_key cat) { int i ; char * key ; i=0 ; key = NULL ; while (prod_list[i].prod_id != end_product_key) { if (prod_list[i].prod_id == cat) { key = prod_list[i].key ; break ; } i++ ; } return key ; }