ocssw  1.0
/disk01/web/ocssw/build/inc/meris/epr_core.h (r8102/r7671)
Go to the documentation of this file.
00001 /*
00002  * $Id: epr_core.h,v 1.1.1.1 2004-10-28 19:22:22 norman Exp $
00003  *
00004  * Copyright (C) 2002 by Brockmann Consult (info@brockmann-consult.de)
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the
00008  * Free Software Foundation. This program is distributed in the hope it will
00009  * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00010  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00011  * See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016  */
00017 
00018 #ifndef EPR_CORE_H_INCL
00019 #define EPR_CORE_H_INCL
00020 
00021 #ifdef __cplusplus
00022 extern "C"
00023 {
00024 #endif
00025 
00026 
00027 #include <stdio.h> /* just to get the ANSI-C type FILE */
00028 
00029 #include "epr_ptrarray.h"
00030 
00031 struct EPR_API;
00032 struct EPR_Parameter;
00033 
00034 typedef struct EPR_API EPR_SAPI;
00035 typedef struct EPR_Parameter EPR_SParameter;
00036 
00037 
00038 #define EPR_ENVISAT_PRODUCT_MERIS        "MER"
00039 #define EPR_ENVISAT_PRODUCT_ASAR         "ASA"
00040 #define EPR_ENVISAT_PRODUCT_SAR          "SAR"
00041 #define EPR_ENVISAT_PRODUCT_AATSR        "ATS"
00042 
00043 #define EPR_LONGI_BAND_NAME               "longitude"
00044 
00045 #define EPR_AATSR_LINES_PER_TIE_PT        32
00046 
00047 #define EPR_MPH_SIZE                      1247
00048 #define EPR_SPH_SIZE                      11622
00049 #define EPR_DSD_SIZE                      280
00050 
00051 #define EPR_PRODUCT_MPH_SIZE              1048 /*??????*/
00052 #define EPR_PRODUCT_MAGIC_STR             "PRODUCT=\""
00053 #define EPR_PRODUCT_ID_OFFSET             9
00054 
00055 #define EPR_PRODUCT_TYPE_ID_STRLEN        10
00056 #define EPR_LENGTH_NUM_DSD_IDENTIFIER     9
00057 #define EPR_COUNT_SEPARATOR_ARRAY         ",*"
00058 #define EPR_IRRELEVANCE_SYMBOL            '*'
00059 #define EPR_FIELD_SEPARATOR_ARRAY         "|"
00060 #define EPR_HEADER_SEPARATOR_ARRAY        "=<>"
00061 #define EPR_HEADER_EXCEPTIONS_ARRAY       "eE"
00062 
00063 #define EPR_LONGI_ABS_MAX                 180
00064 #define EPR_LONGI_ABS_MIN                 -180
00065 
00066 #define EPR_LINE_MAX_LENGTH               2000
00067 
00068 #define EPR_BE_MAGIC_NUMBER  1162761801UL
00069 #define EPR_LE_MAGIC_NUMBER  1230392901UL
00070 #define EPR_LE_MAGIC_BYTE_0  'E'
00071 #define EPR_LE_MAGIC_BYTE_1  'N'
00072 #define EPR_LE_MAGIC_BYTE_2  'V'
00073 #define EPR_LE_MAGIC_BYTE_3  'I'
00074 
00075 #define EPR_ATS_NUM_PER_POINT_ACROSS_LOCAT      23
00076 #define EPR_ATS_NUM_PER_POINT_ACROSS_SOLAR      11
00077 #define EPR_ATS_LINE_LENGTH                     512
00078 
00079 #define EPR_ASAR_NUM_PER_POINT_ACROSS_LOCAT     11
00080 
00087 struct EPR_API
00088 {
00092     epr_boolean init_flag;
00093 
00100     int little_endian_order;
00101 
00105     epr_uint epr_head_size;
00106 
00110     /*char* db_dir_path;*/
00111 
00115     EPR_ELogLevel log_level;
00116 
00121     EPR_FLogHandler log_handler;
00122 
00126     EPR_EErrCode last_err_code;
00127 
00131     char* last_err_message;
00132 
00137     EPR_FErrHandler err_handler;
00138 };
00139 
00140 
00144 extern EPR_SAPI epr_api;
00145 
00146 
00147 /*
00148  * ======================================================================
00149  */
00150 
00160 void epr_free_product_id(EPR_SProductId* product_id);
00161 
00162 
00173 void epr_log(EPR_ELogLevel log_level, const char* log_message);
00174 
00182 void epr_set_err(EPR_EErrCode err_code, const char* err_message);
00183 
00192 EPR_SRecord* epr_read_mph(EPR_SProductId* product_id);
00193 
00202 EPR_SRecord* epr_read_sph(EPR_SProductId* product_id);
00203 
00212 EPR_EDataTypeId epr_str_to_data_type_id(const char* str);
00213 
00214 /*
00215  * Converts the given string into a field length.
00216  *
00217  * The string can represent a single integer value or a sequence
00218  * of integer value and parameter references (names). Integers
00219  * and value are expected to be separated by the asterisk
00220  * character ('*'). E.g. the string "3 * 4 * num_pixels_across"
00221  * is represents a valid field length as long as the parameter
00222  * name 'num_pixels_across' is found in the given parameter table.
00223  *
00224  * @param str the string to be converted
00225  * @param param_table the parameter table containing the values
00226  *                    for the parameter references in the string
00227  * @return the field length computed from the given string or
00228  *         <code>(uint)-1</code> if an error occured.
00229  */
00230 /*epr_uint epr_str_to_field_length(const char* str, EPR_SParamTable* param_table);*/
00231 
00245 char* epr_build_db_file_istream_name(EPR_SProductId* product_id, char* what);
00246 FILE* epr_open_file(char* path_to_file);
00247 int epr_str_to_number(const char* str);
00248 epr_uint epr_parse_value_count(EPR_SProductId* product_id, const char* str);
00249 epr_uint epr_param_to_value(const char* str, EPR_SPtrArray* param_table);
00250 void epr_make_os_compatible_path(char* path);
00251 epr_boolean epr_check_api_init_flag();
00252 
00253 /*
00254 void epr_make_image_header(EPR_SProductId* product_id, EPR_SDatasetId* dataset_id, EPR_SRecord* record);
00255 int epr_make_image(EPR_SProductId* product_id, EPR_SDatasetId* dataset_id, EPR_SRecord* record);
00256 */
00257 
00264 void epr_output_element(const EPR_SField* field, epr_uint field_index, epr_uint element_index, FILE* istream);
00265 
00266 #ifdef __cplusplus
00267 } /* extern "C" */
00268 #endif
00269 
00270 #endif /* #ifndef EPR_CORE_H_INCL */