C Serialize API

Functions

static inline int serialize_ascii_table(const seri_t s, char *buf, const size_t buf_siz, int *args_used, va_list ap)

Serialize arguments to create a table row.

Parameters:
  • s[in] seri_t Structure sepcifying how to serialize arguments.

  • buf[out] character pointer to pointer to memory where serialized message should be stored.

  • buf_siz[in] size_t Size of memory allocated to buf.

  • args_used[out] int Number of arguments formatted.

  • ap[in] va_list Arguments to be formatted. returns: int The length of the serialized message or -1 if there is an error.

static inline int deserialize_ascii_table(const seri_t s, const char *buf, const size_t buf_siz, va_list ap)

Deserialize table row to populate arguments.

Parameters:
  • s[in] seri_t Structure sepcifying how to deserialize message.

  • buf[in] character pointer to serialized message.

  • buf_siz[in] size_t Size of buf.

  • ap[in] va_list Arguments to be parsed from message. returns: int The number of populated arguments. -1 indicates an error.

static inline int serialize_ascii_table_array(const seri_t s, char *buf, const size_t buf_siz, int *args_used, va_list ap)

Serialize column arrays to create table.

Parameters:
  • s[in] seri_t Structure sepcifying how to serialize arguments.

  • buf[out] character pointer to pointer to memory where serialized message should be stored.

  • buf_siz[in] size_t Size of memory allocated to buf.

  • args_used[out] int Number of arguments formatted.

  • ap[in] va_list Arguments to be formatted. These should be pointers to arrays, one for each column in the table. The first argument should be the number of rows in each column. returns: int The length of the serialized message or -1 if there is an error.

static inline int deserialize_ascii_table_array(const seri_t s, const char *buf, const size_t buf_siz, va_list ap)

Deserialize table to populate column arrays.

Parameters:
  • s[in] seri_t Structure sepcifying how to deserialize message.

  • buf[in] character pointer to serialized message.

  • buf_siz[in] size_t Size of buf.

  • ap[in] va_list Pointers to pointers where column arrays should be stored. These should not be allocated prior to passing them as they will be allocated. returns: int The number of populated arguments. -1 indicates an error.

Functions

static inline int serialize_format(const seri_t s, char *buf, const size_t buf_siz, int *args_used, va_list ap)

Serialize arguments to create a message.

Parameters:
  • s[in] seri_t Structure sepcifying how to serialize arguments.

  • buf[in] character pointer to pointer to memory where serialized message should be stored.

  • buf_siz[in] size_t Size of memory allocated to buf.

  • args_used[out] int Number of arguments formatted.

  • ap[in] va_list Arguments to be formatted. returns: int The length of the serialized message or -1 if there is an error.

static inline int deserialize_format(const seri_t s, const char *buf, const size_t buf_siz, va_list ap)

Deserialize message to populate arguments.

Parameters:
  • s[in] seri_t Structure sepcifying how to deserialize message.

  • buf[in] character pointer to serialized message.

  • buf_siz[in] size_t Size of buf.

  • ap[in] va_list Arguments to be parsed from message. returns: int The number of populated arguments. -1 indicates an error.

Typedefs

typedef struct obj_t obj_t

Obj structure.

Functions

static inline obj_t init_obj()

Initialize empty obj structure.

Returns:

obj_t Obj structure.

static inline void free_obj(obj_t *p)

Free obj structure.

Parameters:

p[in] *obj_t Pointer to obj structure.

static inline int alloc_obj(obj_t *p, int nvert, int nface, int ntexc, int nnorm, int do_color)

Allocate obj structure.

Parameters:
  • p[inout] *obj_t Pointer to obj structure that should be allocated.

  • nvert[in] int Number of vertices that should be allocated for.

  • nface[in] int Number of faces that should be allocated for.

  • ntexc[in] int Number of texcoords that should be allocated for.

  • nnorm[in] int Number of normals that should be allocated for.

  • do_color[in] int 1 if vertex colors should be allocated, 0 if not.

Returns:

int 0 if successful, -1 otherwise.

static inline int serialize_obj(const seri_t s, char *buf, const size_t buf_size, int *args_used, va_list ap)

Serialize obj information to create a message.

Parameters:
  • s[in] seri_t Structure sepcifying how to serialize arguments.

  • buf[in] character pointer to memory where serialized message should be stored.

  • buf_size[in] size_t Size of memory allocated to buf.

  • args_used[out] int Number of arguments formatted.

  • ap[in] va_list Arguments to be formatted.

Returns:

: int The length of the serialized message or -1 if there is an error.

static inline int deserialize_obj(const seri_t s, const char *buf, const size_t buf_siz, va_list ap)

Deserialize message to populate obj structure.

Parameters:
  • s[in] seri_t Structure sepcifying how to deserialize message.

  • buf[in] character pointer to serialized message.

  • buf_siz[in] size_t Size of buf.

  • ap[out] va_list Arguments to be parsed from message. returns: int The number of populated arguments. -1 indicates an error.

struct obj_t
#include <ObjSerialize.h>

Obj structure.

Public Members

int nvert

Number of vertices.

int nface

Number faces.

float **vertices

X, Y, Z positions of vertices.

int **faces

Indices of the vertices composing each face.

int **vertex_colors

RGB colors of each vertex.

char material[100]

Material that should be used for faces.

int ntexc

Number of texture coordinates.

int nnorm

Number of normals.

float **texcoords

Texture coordinates.

float **normals

X, Y, Z direction of normals.

int **face_texcoords

Indices of texcoords for each face.

int **face_normals

Indices of normals for each face.

Typedefs

typedef struct ply_t ply_t

Ply structure.

Functions

static inline ply_t init_ply()

Initialize empty ply structure.

Returns:

ply_t Ply structure.

static inline void free_ply(ply_t *p)

Free ply structure.

Parameters:

p[in] *ply_t Pointer to ply structure.

static inline int alloc_ply(ply_t *p, int nvert, int nface, int do_color)

Allocate ply structure.

Parameters:
  • p[inout] *ply_t Pointer to ply structure that should be allocated.

  • nvert[in] int Number of vertices that should be allocated for.

  • nface[in] int Number of faces that should be allocated for.

  • do_color[in] int 1 if vertex colors should be allocated, 0 if not.

Returns:

int 0 if successful, -1 otherwise.

static inline int serialize_ply(const seri_t s, char *buf, const size_t buf_size, int *args_used, va_list ap)

Serialize ply information to create a message.

Parameters:
  • s[in] seri_t Structure sepcifying how to serialize arguments.

  • buf[in] character pointer to memory where serialized message should be stored.

  • buf_size[in] size_t Size of memory allocated to buf.

  • args_used[out] int Number of arguments formatted.

  • ap[in] va_list Arguments to be formatted.

Returns:

: int The length of the serialized message or -1 if there is an error.

static inline int deserialize_ply(const seri_t s, const char *buf, const size_t buf_siz, va_list ap)

Deserialize message to populate ply structure.

Parameters:
  • s[in] seri_t Structure sepcifying how to deserialize message.

  • buf[in] character pointer to serialized message.

  • buf_siz[in] size_t Size of buf.

  • ap[out] va_list Arguments to be parsed from message. returns: int The number of populated arguments. -1 indicates an error.

struct ply_t
#include <PlySerialize.h>

Ply structure.

Public Members

int nvert

Number of vertices.

int nface

Number faces.

float **vertices

X, Y, Z positions of vertices.

int **faces

Indices of the vertices composing each face.

int **vertex_colors

RGB colors of each vertex.

int *nvert_in_face

Number of vertices in each face.

Typedefs

typedef enum seri_enum seri_type
typedef struct seri_t seri_t

Serializer structure.

Enums

enum seri_enum

Serializer types.

Values:

enumerator DIRECT_SERI
enumerator FORMAT_SERI
enumerator ARRAY_SERI
enumerator ASCII_TABLE_SERI
enumerator ASCII_TABLE_ARRAY_SERI
enumerator PLY_SERI
enumerator OBJ_SERI

Functions

static inline int serialize_direct(const seri_t s, char *buf, const size_t buf_siz, int *args_used, va_list ap)

Serialize arguments to create a message.

Parameters:
  • s[in] seri_t Structure sepcifying how to serialize arguments.

  • buf[in] character pointer to memory where serialized message should be stored.

  • buf_siz[in] size_t Size of memory allocated to buf.

  • args_used[out] int Number of arguments formatted.

  • ap[in] va_list Arguments to be formatted. returns: int The length of the serialized message or -1 if there is an error.

static inline int deserialize_direct(const seri_t s, const char *buf, const size_t buf_siz, va_list ap)

Deserialize message to populate arguments.

Parameters:
  • s[in] seri_t Structure sepcifying how to deserialize message.

  • buf[in] character pointer to serialized message.

  • buf_siz[in] size_t Size of buf.

  • ap[out] va_list Arguments to be parsed from message. returns: int The number of populated arguments. -1 indicates an error.

struct seri_t
#include <SerializeBase.h>

Serializer structure.

Public Members

seri_type type

Serializer type.

void *info

Pointer to any extra info serializer requires.

size_t size_info

Size of allocate space for info.

Warning

autodoxygenfile: Cannot find file “serialize.h