libdballe 4.0.18
msg.h
Go to the documentation of this file.
00001 /*
00002  * DB-ALLe - Archive for punctual meteorological data
00003  *
00004  * Copyright (C) 2005--2010  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 DBA_MSG_H
00023 #define DBA_MSG_H
00024 
00025 #ifdef  __cplusplus
00026 extern "C" {
00027 #endif
00028 
00071 #include <dballe/core/error.h>
00072 #include <dballe/core/var.h>
00073 #include <stdio.h>
00074 
00078 enum _dba_msg_type {
00079     MSG_GENERIC,    
00080     MSG_SYNOP,      
00081     MSG_PILOT,      
00082     MSG_TEMP,       
00083     MSG_TEMP_SHIP,  
00084     MSG_AIREP,      
00085     MSG_AMDAR,      
00086     MSG_ACARS,      
00087     MSG_SHIP,       
00088     MSG_BUOY,       
00089     MSG_METAR,      
00090     MSG_SAT,        
00091     MSG_POLLUTION   
00092 };
00094 typedef enum _dba_msg_type dba_msg_type;
00095 
00096 struct _dba_msg_context;
00098 typedef struct _dba_msg_context* dba_msg_context;
00099 
00103 struct _dba_msg
00104 {
00106     dba_msg_type type;
00107 
00109     int data_count;
00110 
00115     int data_alloc;
00116 
00120     dba_msg_context* data;
00121 };
00123 typedef struct _dba_msg* dba_msg;
00124 
00133 const char* dba_msg_type_name(dba_msg_type type);
00134 
00135 
00144 dba_err dba_msg_create(dba_msg* msg);
00145 
00154 void dba_msg_print(dba_msg msg, FILE* out);
00155 
00169 void dba_msg_diff(dba_msg msg1, dba_msg msg2, int* diffs, FILE* out);
00170 
00177 void dba_msg_delete(dba_msg msg);
00178 
00179 
00207 dba_err dba_msg_set(dba_msg msg, dba_var var, dba_varcode code, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00208 
00233 dba_err dba_msg_set_nocopy(dba_msg msg, dba_var var, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00234 
00247 dba_err dba_msg_set_by_id(dba_msg msg, dba_var var, int id);
00248 
00263 dba_err dba_msg_set_nocopy_by_id(dba_msg msg, dba_var var, int id);
00264 
00293 dba_err dba_msg_seti(dba_msg msg, dba_varcode code, int val, int conf, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00294 
00323 dba_err dba_msg_setd(dba_msg msg, dba_varcode code, double val, int conf, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00324 
00353 dba_err dba_msg_setc(dba_msg msg, dba_varcode code, const char* val, int conf, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00354 
00355 
00376 dba_msg_context dba_msg_find_context(dba_msg msg, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00377 
00394 dba_var dba_msg_find(dba_msg msg, dba_varcode code, int ltype1, int l1, int ltype2, int l2, int pind, int p1, int p2);
00395 
00406 dba_var dba_msg_find_by_id(dba_msg msg, int id);
00407 
00408 
00417 dba_msg_type dba_msg_get_type(dba_msg msg);
00418 
00419 
00423 dba_msg_type dba_msg_type_from_repmemo(const char* repmemo);
00424 
00428 const char* dba_msg_repmemo_from_type(dba_msg_type type);
00429 
00430 
00439 dba_err dba_msg_sounding_pack_levels(dba_msg msg, dba_msg* dst);
00440 
00450 dba_err dba_msg_sounding_unpack_levels(dba_msg msg, dba_msg* dst);
00451 
00452 
00453 struct lua_State;
00454 
00458 dba_err dba_msg_lua_push(dba_msg var, struct lua_State* L);
00459 
00465 dba_msg dba_msg_lua_check(struct lua_State* L, int idx);
00466 
00467 
00468 #include <dballe/msg/vars.h>
00469 
00470 #ifdef  __cplusplus
00471 }
00472 #endif
00473 
00474 // vim:set ts=4 sw=4:
00475 #endif