libdballe 4.0.18
|
AOF message codec. More...
#include <dballe/core/rawmsg.h>
#include <dballe/core/file.h>
#include <dballe/msg/msgs.h>
#include <stdint.h>
Go to the source code of this file.
Functions | |
dba_err | aof_codec_decode (dba_rawmsg msg, dba_msgs *msgs) |
Decode an AOF message. | |
dba_err | aof_codec_get_category (dba_rawmsg msg, int *category, int *subcategory) |
Get category and subcategory of an AOF message. | |
void | aof_codec_dump (dba_rawmsg msg, FILE *out) |
Encode an AOF message. | |
dba_err | aof_codec_read_record (dba_file file, uint32_t **rec, int *len) |
Read a fortran "unformatted sequential" record with an array of 32-bit words. | |
dba_err | aof_codec_write_record (dba_file file, const uint32_t *rec, int len) |
Write a fortran "unformatted sequential" record contained in an array of 32-bit words. | |
dba_err | aof_codec_read_header (dba_file file, uint32_t **fdr, int *fdr_len, uint32_t **ddr, int *ddr_len) |
Read the header of an aof file. | |
dba_err | aof_codec_write_dummy_header (dba_file file) |
Writes a dummy header to the AOF file. | |
dba_err | aof_codec_fix_header (dba_file file) |
Fix the header of an AOF file. |
AOF message codec.
It provides various AOF encoding and decoding functions, and implements dba_file reading and writing of AOF files.
AOF records can be read, written and interpreted into a dba_msg. Encoding from a dba_msg is not yet implemented. A "makeaof" tool exists, not part of DB-All.e, that can convert BUFR messages into AOF.
Endianness of the written records can be controlled by the environment variable DBA_AOF_ENDIANNESS:
If the environment variable is not set, the default is to write using the host endianness.
dba_err aof_codec_decode | ( | dba_rawmsg | msg, |
dba_msgs * | msgs | ||
) |
Decode an AOF message.
msg | The aof_message with the data to decode |
msgs | The decoded message |
References DBA_RUN_OR_GOTO, DBA_RUN_OR_RETURN, DBA_VAR, _dba_rawmsg::file, _dba_rawmsg::offset, and TRACE.
void aof_codec_dump | ( | dba_rawmsg | msg, |
FILE * | out | ||
) |
Encode an AOF message.
msg | The aof_message with the data to encode |
in | The message to encode |
msg | The encoded message to dump |
out | The stream to use to print the message |
References _dba_rawmsg::buf, _dba_rawmsg::len, and TRACE.
Fix the header of an AOF file.
Currently it just recomputes the start and end of the observation period by looking at the observation headers for all the observations found in the file.
file | The file to operate on. It must be open in read-write mode and be a seekable file. |
References dba_error_consistency, DBA_RUN_OR_GOTO, _dba_file::fd, and _dba_file::name.
dba_err aof_codec_get_category | ( | dba_rawmsg | msg, |
int * | category, | ||
int * | subcategory | ||
) |
Get category and subcategory of an AOF message.
msg | The message to scan |
category | The AOF category of the message |
subcategory | The AOF subcategory of the message |
References DBA_RUN_OR_RETURN, _dba_rawmsg::file, and _dba_rawmsg::offset.
dba_err aof_codec_read_header | ( | dba_file | file, |
uint32_t ** | fdr, | ||
int * | fdr_len, | ||
uint32_t ** | ddr, | ||
int * | ddr_len | ||
) |
Read the header of an aof file.
file | The file to read from. |
fdr | The contents of the First Data Record. It will need to be deallocated by the caller. |
fdr_len | The length of the fdr array. |
ddr | The contents of the Data Description Record. It will need to be deallocated by the caller. |
ddr_len | The length of the ddr array. |
References DBA_RUN_OR_GOTO, _dba_file::fd, and _dba_file::name.
Read a fortran "unformatted sequential" record with an array of 32-bit words.
file | The file to read from. |
rec | The contents of the "unformatted sequential" record read. It will need to be deallocated by the caller. |
len | The length of the returned rec record. |
References _dba_file::fd, and _dba_file::name.
Writes a dummy header to the AOF file.
This function is used to write a file header before having any information on the data that will be written afterwards. The dummy header can be completed later using aof_codec_fix_header().
file | The file to write the header to. |
References DBA_RUN_OR_RETURN.
Write a fortran "unformatted sequential" record contained in an array of 32-bit words.
file | The file to write to. |
rec | The data to write. |
len | The number of elements in the rec array. |
References DBA_RUN_OR_RETURN.