TaPAS  0.2
Typedefs | Enumerations | Functions
ccl-serializer.h File Reference

Serialization function for basic C types. More...

#include <ccl/ccl-common.h>

Go to the source code of this file.

Typedefs

typedef enum
ccl_serializer_status_enum 
ccl_serializer_status
 Error code returned by serialization functions.
 

Enumerations

enum  ccl_serializer_status_enum {
  CCL_SERIALIZER_OK = 0,
  CCL_SERIALIZER_EOF,
  CCL_SERIALIZER_IO_ERROR,
  CCL_SERIALIZER_DATA_ERROR
}
 Error code returned by serialization functions. More...
 

Functions

void ccl_serializer_write_uint8 (uint8_t n, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_write_int8 (int8_t n, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_write_uint16 (uint16_t n, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_write_int16 (int16_t n, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_write_uint32 (uint32_t n, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_write_int32 (int32_t n, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_write_string (const char *s, FILE *out, ccl_serializer_status *p_err)
 
void ccl_serializer_read_uint8 (uint8_t *p_n, FILE *in, ccl_serializer_status *p_err)
 
void ccl_serializer_read_int8 (int8_t *p_n, FILE *in, ccl_serializer_status *p_err)
 
void ccl_serializer_read_uint16 (uint16_t *p_n, FILE *in, ccl_serializer_status *p_err)
 
void ccl_serializer_read_int16 (int16_t *p_n, FILE *in, ccl_serializer_status *p_err)
 
void ccl_serializer_read_uint32 (uint32_t *p_n, FILE *in, ccl_serializer_status *p_err)
 
void ccl_serializer_read_int32 (int32_t *p_n, FILE *in, ccl_serializer_status *p_err)
 
void ccl_serializer_read_string (char **p_s, FILE *in, ccl_serializer_status *p_err)
 

Detailed Description

Serialization function for basic C types.

The detailed description of functions is not given since they all operate in the same way. The name of each function follows the following convention:

ccl_serializer_mode_datatype

where mode is either write or read and datatype is one of the following data type: [u]int{8,16,32} or string.

The usage of functions is quite intuitive. They takes three arguments:

Before any other operations, functions always that the current value of the error code is CCL_SERIALIZER_OK. If this is not the case the function does nothing else and immediately returns.

All pointers used by the serialization function (input streams, pointers to data and pointers to error codes) are assumed to not be NULL.

Definition in file ccl-serializer.h.

Enumeration Type Documentation

Error code returned by serialization functions.

Enumerator
CCL_SERIALIZER_OK 

No error occurs.

CCL_SERIALIZER_EOF 

The end of the input stream has been reached.

CCL_SERIALIZER_IO_ERROR 

The write or read operation produces an error raised by the system.

CCL_SERIALIZER_DATA_ERROR 

The input stream is malformed.

Definition at line 55 of file ccl-serializer.h.

Function Documentation

void ccl_serializer_read_int16 ( int16_t *  p_n,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_n != NULL && in != NULL && p_err != NULL
void ccl_serializer_read_int32 ( int32_t *  p_n,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_n != NULL && in != NULL && p_err != NULL
void ccl_serializer_read_int8 ( int8_t *  p_n,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_n != NULL && in != NULL && p_err != NULL
void ccl_serializer_read_string ( char **  p_s,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_s != NULL && in != NULL && p_err != NULL
void ccl_serializer_read_uint16 ( uint16_t *  p_n,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_n != NULL && in != NULL && p_err != NULL
void ccl_serializer_read_uint32 ( uint32_t *  p_n,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_n != NULL && in != NULL && p_err != NULL
void ccl_serializer_read_uint8 ( uint8_t *  p_n,
FILE *  in,
ccl_serializer_status p_err 
)
Precondition
p_n != NULL && in != NULL && p_err != NULL
void ccl_serializer_write_int16 ( int16_t  n,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
out != NULL && p_err != NULL
void ccl_serializer_write_int32 ( int32_t  n,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
out != NULL && p_err != NULL
void ccl_serializer_write_int8 ( int8_t  n,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
out != NULL && p_err != NULL
void ccl_serializer_write_string ( const char *  s,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
s != NULL && out != NULL && p_err != NULL
void ccl_serializer_write_uint16 ( uint16_t  n,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
out != NULL && p_err != NULL
void ccl_serializer_write_uint32 ( uint32_t  n,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
out != NULL && p_err != NULL
void ccl_serializer_write_uint8 ( uint8_t  n,
FILE *  out,
ccl_serializer_status p_err 
)
Precondition
out != NULL && p_err != NULL