bufr.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002 
00003     BUFR encoding and decoding software and library
00004     Copyright (c) 2007,  Institute of Broadband Communication, TU-Graz
00005     on behalf of EUMETNET OPERA, http://www.knmi.nl/opera
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; version 2.1 
00010     of the License.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00020 
00021 ----------------------------------------------------------------------------
00022 
00023 FILE:          BUFR.H
00024 IDENT:         $Id: bufr.h,v 1.6 2007/12/18 14:40:58 fuxi Exp $
00025 
00026 AUTHORS:       Juergen Fuchsberger, Helmut Paulitsch, Konrad Koeck
00027                Institute of Communication and Wave Propagation, 
00028                Technical University Graz, Austria
00029 
00030 VERSION NUMBER:3.0
00031 
00032 DATE CREATED:  18-DEC-2001
00033 
00034 STATUS:        DEVELOPMENT FINISHED
00035 
00036 
00037 FUNCTIONAL DESCRIPTION:
00038 -----------------------
00039 Includefile for BUFR.C. More details can be found there.
00040 
00041 AMENDMENT RECORD:
00042 
00043 $Log: bufr.h,v $
00044 Revision 1.6  2007/12/18 14:40:58  fuxi
00045 added licence header
00046 
00047 Revision 1.5  2007/12/07 08:34:43  fuxi
00048 update to version 3.0
00049 
00050 Revision 1.4  2005/04/04 14:56:09  helmutp
00051 update to version 2.3
00052 
00053 Revision 1.3  2003/03/27 17:17:39  helmutp
00054 update to version 2.2
00055 
00056 Revision 1.2  2003/03/06 17:12:32  helmutp
00057 update to version 2.1
00058 
00059 Revision 1.1  2003/02/28 13:41:12  helmutp
00060 Initial revision
00061 
00062 --------------------------------------------------------------------------- */
00063 
00071 /*===========================================================================*/
00072 /* global variables                                                          */
00073 /* If BUFR_MAIN is not defined all variables are declared as external.       */
00074 /* So you sould define BUFR_MAIN only in one function. Otherwise you will    */
00075 /* have this symbols multiple defined.                                       */
00076 /*===========================================================================*/
00077 
00078 #ifdef BUFR_MAIN
00079 
00080 int _bufr_edition = 3;      
00081 int _opera_mode = 1;        /* input and output bitmaps to / from file */
00082 int _replicating = 0;       
00084 #else
00085 
00093 extern int _bufr_edition;   
00094 extern int _opera_mode;
00095 
00106 extern int _replicating;
00107 #endif
00108 
00109 #ifndef BUFR_H_INCLUDED
00110 #define BUFR_H_INCLUDED
00111 
00112 #define MAX_DESCS 1000       
00115 #define MEMBLOCK   100       /* The memory-area holding data-strings 
00116                                 and data-descriptors is allocated and 
00117                                 reallocated in blocks of MEMBLOCK elements. */
00118 
00119 /*===========================================================================*/
00120 /* structures                                                                */
00121 /*===========================================================================*/
00122 
00124 typedef struct bufr_s {      
00125 
00126     char* sec[6];            
00127     int   secl[6];           
00128 } bufr_t;
00129 
00130 typedef char* bd_t;          
00135 typedef struct bufrval_s { 
00136     varfl* vals;            
00137     int vali;        
00138     int nvals;       
00139 } bufrval_t;
00140 
00141 
00142 
00143 /*===========================================================================*/
00144 /* protypes of functions in BUFR.C                                           */
00145 /*===========================================================================*/
00146 
00147 /* basic functions for encoding to BUFR */
00148 
00149 int bufr_create_msg (dd *descs, int ndescs, varfl *vals, void **datasec, 
00150                         void **ddsec, size_t *datasecl, size_t *ddescl);
00151 int bufr_encode_sections34 (dd* descs, int ndescs, varfl* vals, bufr_t* msg);
00152 int bufr_encode_sections0125 (sect_1_t* s1, bufr_t* msg);
00153 int bufr_write_file (bufr_t* msg, char* file);
00154 
00155 /* basic function for decoding from BUFR */
00156 
00157 int bufr_read_file (bufr_t* msg, char* file);
00158 int bufr_get_sections (char* bm, int len, bufr_t* msg);
00159 int bufr_decode_sections01 (sect_1_t* s1, bufr_t* msg);
00160 int bufr_read_msg (void *datasec, void *ddsec, size_t datasecl, size_t ddescl,
00161                       dd **desc, int *ndescs, varfl **vals, size_t *nvals);
00162 
00163 /* extended functions for encoding to BUFR */
00164 
00165 void bufr_sect_1_from_file (sect_1_t* s1, char* file);
00166 int bufr_open_descsec_w ();
00167 int bufr_out_descsec (dd *descp, int ndescs, int desch);
00168 void bufr_close_descsec_w(bufr_t* bufr, int desch);
00169 int bufr_parse_in  (dd *descs, int start, int end, 
00170                     int (*inputfkt) (varfl *val, int ind),
00171                     int callback_descs);
00172 
00173 /* extended functions for decoding from BUFR */
00174 
00175 int bufr_open_descsec_r (bufr_t* msg);
00176 int bufr_get_ndescs (bufr_t* msg);
00177 int bufr_in_descsec (dd** descs, int ndescs, int desch);
00178 void bufr_close_descsec_r(int desch);
00179 int bufr_parse_out  (dd *descs, int start, int end, 
00180                      int (*outputfkt) (varfl val, int ind),
00181                      int callback_all_descs);
00182 int bufr_sect_1_to_file (sect_1_t* s1, char* file);
00183 
00184 /* utility functions */
00185 
00186 void bufr_free_data (bufr_t* d);
00187 int bufr_check_fxy(dd *d, int ff, int xx, int yy);
00188 void bufr_get_date_time (long *year, long *mon, long *day, long *hour,
00189                             long *min);
00190 int bufr_val_to_array (varfl **vals, varfl v, int *nvals);
00191 int bufr_desc_to_array (dd* descs, dd d, int* ndescs);
00192 int bufr_parse_new (dd *descs, int start, int end, 
00193                     int (*inputfkt) (varfl *val, int ind),
00194                     int (*outputfkt) (varfl val, int ind),
00195                     int callback_all_descs);
00196 int bufr_parse (dd *descs, int start, int end, varfl *vals, unsigned *vali,
00197                 int (*userfkt) (varfl val, int ind));
00198 bufrval_t* bufr_open_val_array ();
00199 void bufr_close_val_array ();
00200 int bufr_open_datasect_w ();
00201 void bufr_close_datasect_w(bufr_t* msg);
00202 int bufr_open_datasect_r (bufr_t* msg);
00203 void bufr_close_datasect_r();
00204 
00205 /* callback functions for use with bufr_parse_* */
00206 
00207 int bufr_val_from_global (varfl *val, int ind);
00208 int bufr_val_to_global (varfl val, int ind);
00209 
00210 /* deprecated functions */
00211 
00212 void bufr_clean ();
00213 int val_to_array (varfl **vals, varfl v, size_t *nvals);
00214 int setup_sec0125 (char *sec[], size_t secl[], sect_1_t s1);
00215 int save_sections (char *sec[], size_t secl[], char *buffile);
00216 
00217 #endif
00218 
00219 /* end of file */

Generated on Tue Dec 18 16:52:44 2007 for OPERA BUFR software by  doxygen 1.5.4