aof_codec.h File Reference


Detailed Description

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.

#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)
 Print the contents of the 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.


Function Documentation

dba_err aof_codec_decode ( dba_rawmsg  msg,
dba_msgs msgs 
)

Decode an AOF message.

Parameters:
msg The aof_message with the data to decode
Return values:
msgs The decoded message
Returns:
The error indicator for the function. See error.h

void aof_codec_dump ( dba_rawmsg  msg,
FILE *  out 
)

Print the contents of the AOF message.

Parameters:
msg The encoded message to dump
out The stream to use to print the message

dba_err aof_codec_fix_header ( dba_file  file  ) 

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.

Parameters:
file The file to operate on. It must be open in read-write mode and be a seekable file.
Returns:
The error indicator for the function. See dba_err.

dba_err aof_codec_get_category ( dba_rawmsg  msg,
int *  category,
int *  subcategory 
)

Get category and subcategory of an AOF message.

Parameters:
msg The message to scan
Return values:
category The AOF category of the message
subcategory The AOF subcategory of the message
Returns:
The error indicator for the function. See error.h

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.

Parameters:
file The file to read from.
Return values:
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.
Returns:
The error indicator for the function. See dba_err.

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.

Parameters:
file The file to read from.
Return values:
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.
Returns:
The error indicator for the function. See dba_err.

dba_err aof_codec_write_dummy_header ( dba_file  file  ) 

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().

Parameters:
file The file to write the header to.
Returns:
The error indicator for the function. See dba_err.

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.

Parameters:
file The file to write to.
rec The data to write.
len The number of elements in the rec array.
Returns:
The error indicator for the function. See dba_err.


Generated on Fri Jun 22 13:06:52 2007 for libdballe-db by  doxygen 1.5.2