rawmsg.h File Reference


Detailed Description

In-memory storage of an encoded weather report.

#include <dballe/core/error.h>

Go to the source code of this file.

Data Structures

struct  _dba_rawmsg
 Dynamic storage for encoded messages. More...

Typedefs

typedef struct _dba_rawmsgdba_rawmsg
 Dynamic storage for encoded messages.

Enumerations

enum  dba_encoding { BUFR = 0, CREX = 1, AOF = 2 }
 Supported encodings for report data.

Functions

const char * dba_encoding_name (dba_encoding enc)
 Return a string with the name of the given encoding.
dba_err dba_rawmsg_create (dba_rawmsg *msg)
 Create a new dba_rawmsg.
void dba_rawmsg_delete (dba_rawmsg msg)
 Delete a dba_rawmsg.
void dba_rawmsg_reset (dba_rawmsg msg)
 Clear all the contents of this dba_rawmsg.
dba_err dba_rawmsg_acquire_buf (dba_rawmsg msg, unsigned char *buf, int size)
 Set the internal buffer to `buf', taking ownership of the buffer.
dba_err dba_rawmsg_get_raw (dba_rawmsg msg, const unsigned char **buf, int *size)
 Get the raw (encoded) representation of the message.
dba_err dba_rawmsg_expand_buffer (dba_rawmsg msg)
 Expand the size of the buffer holding message data.


Function Documentation

const char* dba_encoding_name ( dba_encoding  enc  ) 

Return a string with the name of the given encoding.

Parameters:
enc The encoding to name.
Returns:
A short name for the encoding, such as "BUFR", "CREX", "AOF" or "(unknown)".

dba_err dba_rawmsg_create ( dba_rawmsg msg  ) 

Create a new dba_rawmsg.

Return values:
msg The new dba_rawmsg. It will need to be deallocated using dba_rawmsg_delete()
Returns:
The error indicator for the function. See error.h

void dba_rawmsg_delete ( dba_rawmsg  msg  ) 

Delete a dba_rawmsg.

Parameters:
msg The dba_rawmsg to delete
Returns:
The error indicator for the function. See error.h

References _dba_rawmsg::alloclen, and _dba_rawmsg::buf.

dba_err dba_rawmsg_expand_buffer ( dba_rawmsg  msg  ) 

Expand the size of the buffer holding message data.

Allocation is optimised for the normal message size of meteorological data: if the buffer size is below 16Kbytes, then the size is doubled; when above 16Kb, then it is grown by 2Kb.

Parameters:
msg The message to enlarge
Returns:
The error indicator for the function. See error.h

References _dba_rawmsg::alloclen, and _dba_rawmsg::buf.

dba_err dba_rawmsg_get_raw ( dba_rawmsg  msg,
const unsigned char **  buf,
int *  size 
)

Get the raw (encoded) representation of the message.

Parameters:
msg The message to query
Return values:
buf A const pointer to the internal buffer with the encoded representation of the message.
size The size of the data in buf
Returns:
The error indicator for the function. See error.h

References _dba_rawmsg::buf, and _dba_rawmsg::len.

void dba_rawmsg_reset ( dba_rawmsg  msg  ) 

Clear all the contents of this dba_rawmsg.

Parameters:
msg The dba_rawmsg to clear

References _dba_rawmsg::index, _dba_rawmsg::len, and _dba_rawmsg::offset.


Generated on Sun May 18 17:27:17 2008 for libdballe by  doxygen 1.5.5