/* filetypes.h */

/*
remap
Copyright (C) 2006 Fabrice Ducos, fabrice.ducos@icare.univ-lille1.fr

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef FILETYPES_H
#define FILETYPES_H

/**
 * Enum type for filetypes (files identifiers).
 * Once a file is resolved into a filetype (or file identifier), the latter will be used
 * to instantiate a specific file object able to handle its contents
 */

typedef enum {
  FILETYPE_EQUIRECT, ///< enum code identifying user's defined equirectangular projections
  FILETYPE_MOD021KM, ///< enum code identifying MOD021KM files (Modis products)
  FILETYPE_MYD021KM, ///< enum code identifying MYD021KM files (Modis products)
  FILETYPE_MOD03, ///< enum code identifying MYD03 files (Modis products)
  FILETYPE_MYD03, ///< enum code identifying MYD03 files (Modis products)
  FILETYPE_CAL_IIR_L1, ///< enum code identifying CAL_IIR_L1 files (IIR over CALIPSO products)
  FILETYPE_HDF_SEVIRI, ///< enum code identifying SEVIRI mosaic files (SEVIRI hdf products, from Icare)
  FILETYPE_XRIT_SEVIRI, ///< enum code identifying SEVIRI original files (SEVIRI XRIT products)
  FILETYPE_PARASOL, ///< enum code identifying PARASOL files
  FILETYPE_UNKNOWN ///< enum code for not known or not supported products (should always be the last field of the enum)
} filetype_type;

/**
 * resolves a filetype into a static C-style (char *) string (one of the enum codes from filetype_type).
 *
 * cautious: as the returned value is a pointer to a static zone of memory, the function should never be called more than
 * once in the same expression, nor in a multithread application (in theses cases its behaviour is undefined)
 *
 * @param filetype one of the filetypes owned by the filetype_type enumeration
 * @returns a pointer adressing a static array of chars containing a human readable description of the filetype
 * 
 */
extern char *filetype_to_cstr(filetype_type filetype);

/**
 * resolves a filename into one of the filetypes from the filetype_type enumeration
 *
 * @param filename the name of one of the software-supported products
 * @returns one of the filetypes from the filetype_type enumeration, or FILETYPE_UNKNOWN is the argument is invalid
 * or not supported
 */
extern filetype_type get_filetype(const char *filename);

/**
 * an helper function that prints every supported types of files in the application
 *
 * it simply calls filetype_to_cstr for each field of the filetype_type enumeration (except FILETYPE_UNKNOWN)
 * and prints the result on the standard error
 * 
 * @see filetype_type
 * @see filetype_to_cstr(filetype_type filetype)
 * @see usage()
 */
extern void print_supported_filetypes();

#endif