Apriltag WASM Detector
Apriltag detector using the apriltag C library and compiled to WASM using emscripten.
Data Structures | Macros | Functions | Variables
str_json.h File Reference

Definitions for simple json strings creation. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  t_str_json
 

Macros

#define STR_JSON_INITIALIZER   { .len = 0, .str=NULL, .alloc_size=0 }
 

Functions

int str_json_create (t_str_json *str_json, size_t size_bytes)
 Init a string. More...
 
int str_json_destroy (t_str_json *str_json)
 Free a string. More...
 
void str_json_clear (t_str_json *str_json)
 Clear a string. More...
 
size_t str_json_concat (t_str_json *str_json_dest, const char *source_c_str)
 Copy the content of source_c_str to str_json_dest. More...
 
size_t str_json_printf (t_str_json *str_json_dest, const char *format,...)
 Composes a string with the same text that would be printed if format was used on printf,. More...
 

Variables

const char fmt_error []
 
const char fmt_det_point []
 
const char fmt_det_point_pose []
 

Detailed Description

Definitions for simple json strings creation.

Copyright (C) Wiselab CMU.

Date
July, 2020

Function Documentation

◆ str_json_clear()

void str_json_clear ( t_str_json str_json)

Clear a string.

Parameters
str_jsont_str_json structure of the string to clear

Clear a string.

Parameters
str_jsont_str_json structure of the string to clear

Clear a string.

◆ str_json_concat()

size_t str_json_concat ( t_str_json str_json_dest,
const char *  source_c_str 
)

Copy the content of source_c_str to str_json_dest.

Copies up to the terminating null-character, or no more space in dest A terminating null character is always appended to dest.str. IMPORTANT: dest is assumed to be null-terminated

Parameters
str_json_destthe destination t_str_json structure with the destination string info
source_c_stra null-terminated c string (char *) to the source string
Returns
the length, in bytes, of the new string

Copy the content of source_c_str to str_json_dest.

Copies up to the terminating null-character, or no more space in dest A terminating null character is always appended to dest.str. IMPORTANT: dest is assumed to be null-terminated

Parameters
str_json_destthe destination t_str_json structure with the destination string info
source_c_stra null-terminated c string (char *) to the source string
Returns
the length, in bytes, of the new string

Copy the content of source_c_str to str_json_dest.

◆ str_json_create()

int str_json_create ( t_str_json str_json,
size_t  size_bytes 
)

Init a string.

Parameters
str_jsont_str_json structure to hold the string info
size_bytessize of the string to allocate
Returns
0=success; -1 on error
Warning
Declare strings with: t_str_json a_str = STR_JSON_INITIALIZER;
Do not call str_json_create() on a string you already created without destroying it

Init a string.

Parameters
str_jsont_str_json structure to hold the string info
size_bytessize of the string to allocate
Returns
0=success; -1 on error
Warning
Declare strings with: t_str_json a_str = STR_JSON_INITIALIZER;
Do not call str_json_create() on a string you already created without destroying it

Init a string.

◆ str_json_destroy()

int str_json_destroy ( t_str_json str_json)

Free a string.

Parameters
str_jsont_str_json structure with the string info
Returns
0=success; -1 on error

Free a string.

Parameters
str_jsont_str_json structure with the string info
Returns
0=success; -1 on error

Free a string.

◆ str_json_printf()

size_t str_json_printf ( t_str_json str_json_dest,
const char *  format,
  ... 
)

Composes a string with the same text that would be printed if format was used on printf,.

Parameters
str_json_destthe destination t_str_json structure with the destination string info
formata format string
...additional arguments
Returns
The number of characters that would have been written if str_json_dest had been sufficiently large, not counting the terminating null character.

Composes a string with the same text that would be printed if format was used on printf,.

Parameters
str_json_destthe destination t_str_json structure with the destination string info
formata format string
...additional arguments
Returns
The number of characters that would have been written if str_json_dest had been sufficiently large, not counting the terminating null character.

Composes a string with the same text that would be printed if format was used on printf,.