libdballe 4.0.18
exporters.h
00001 /*
00002  * DB-ALLe - Archive for punctual meteorological data
00003  *
00004  * Copyright (C) 2005,2006  ARPA-SIM <urpsim@smr.arpa.emr.it>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00018  *
00019  * Author: Enrico Zini <enrico@enricozini.com>
00020  */
00021 
00022 #ifndef BUFREX_EXPORTERS_H
00023 #define BUFREX_EXPORTERS_H
00024 
00025 #ifdef  __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 #include <dballe/core/var.h>
00030 #include <dballe/msg/msg.h>
00031 #include <dballe/bufrex/msg.h>
00032 
00033 struct _bufrex_exporter;
00034     
00035 /*
00036  * Type can be:
00037  *  0: encode a BUFR
00038  *  1: encode a CREX
00039  * TODO: replace with the enum from bufrex_msg
00040  */
00041 
00045 typedef dba_err (*bufrex_exporter_func)(dba_msg src, bufrex_msg bmsg, bufrex_subset dst, int type);
00046 
00050 typedef dba_err (*bufrex_datadesc_func)(struct _bufrex_exporter* exp, dba_msg src, bufrex_msg dst);
00051 
00055 struct _bufrex_exporter
00056 {
00058     int type;
00060     int subtype;
00062     int localsubtype;
00063 
00065     dba_msg_type accept_type;
00066 
00068     dba_varcode* ddesc;
00069 
00071     bufrex_datadesc_func datadesc;
00072 
00074     bufrex_exporter_func exporter;
00075 };
00077 typedef struct _bufrex_exporter* bufrex_exporter;
00078 
00082 dba_err bufrex_standard_datadesc_func(bufrex_exporter exp, dba_msg src, bufrex_msg dst);
00083 
00087 dba_err bufrex_infer_type_subtype(dba_msg msg, int* type, int* subtype, int* localsubtype);
00088 
00093 dba_err bufrex_get_exporter(dba_msg src, int type, int subtype, int localsubtype, bufrex_exporter* exp);
00094 
00096 #define ORIG_CENTRE_ID 255
00097 
00098 #define ORIG_APP_ID 0
00099 
00100 #ifdef  __cplusplus
00101 }
00102 #endif
00103 
00104 /* vim:set ts=4 sw=4: */
00105 #endif