uBlink  0.0.1
TheBlinkProtocol
blink_object

Description

Object model interface (under development)

Functions

blink_object_t BLINK_Object_newGroup (const struct blink_allocator *alloc, blink_schema_t group)
 Create a new group model from a group definition. More...
 
bool BLINK_Object_clear (blink_object_t group, const char *fieldName)
 Clear a field (i.e. More...
 
bool BLINK_Object_fieldIsNull (blink_object_t group, const char *fieldName)
 Test if a field value is NULL. More...
 
bool BLINK_Object_setEnum (blink_object_t group, const char *fieldName, const char *symbol)
 Write enum to field. More...
 
bool BLINK_Object_setBool (blink_object_t group, const char *fieldName, bool value)
 Write boolean to field. More...
 
bool BLINK_Object_setDecimal (blink_object_t group, const char *fieldName, int64_t mantissa, int8_t exponent)
 Write decimal to field. More...
 
bool BLINK_Object_setUint (blink_object_t group, const char *fieldName, uint64_t value)
 Write an unsigned integer to field. More...
 
bool BLINK_Object_setInt (blink_object_t group, const char *fieldName, int64_t value)
 Write a signed integer to field. More...
 
bool BLINK_Object_setF64 (blink_object_t group, const char *fieldName, double value)
 Write f64 to field. More...
 
bool BLINK_Object_setString (blink_object_t group, const char *fieldName, const char *str, uint32_t len)
 Write string to field. More...
 
bool BLINK_Object_setString2 (blink_object_t group, const char *fieldName, const char *str)
 
bool BLINK_Object_setBinary (blink_object_t group, const char *fieldName, const uint8_t *data, uint32_t len)
 Write binary to field. More...
 
bool BLINK_Object_setFixed (blink_object_t group, const char *fieldName, const uint8_t *data, uint32_t len)
 Write fixed to field. More...
 
bool BLINK_Object_setGroup (blink_object_t group, const char *fieldName, blink_object_t value)
 Write group to field. More...
 
const char * BLINK_Object_getEnum (blink_object_t group, const char *fieldName)
 Read enum from field. More...
 
bool BLINK_Object_getBool (blink_object_t group, const char *fieldName)
 Read boolean from field. More...
 
struct blink_decimal BLINK_Object_getDecimal (blink_object_t group, const char *fieldName)
 Read decimal from field. More...
 
uint64_t BLINK_Object_getUint (blink_object_t group, const char *fieldName)
 Read Uint from field. More...
 
int64_t BLINK_Object_getInt (blink_object_t group, const char *fieldName)
 Read Int from field. More...
 
double BLINK_Object_getF64 (blink_object_t group, const char *fieldName)
 Read f64 from field. More...
 
struct blink_string BLINK_Object_getString (blink_object_t group, const char *fieldName)
 Read string from field. More...
 
struct blink_string BLINK_Object_getBinary (blink_object_t group, const char *fieldName)
 Read binary from field. More...
 
struct blink_string BLINK_Object_getFixed (blink_object_t group, const char *fieldName)
 Read fixed from field. More...
 
blink_object_t BLINK_Object_getGroup (blink_object_t group, const char *fieldName)
 Read group from field. More...
 
blink_schema_t BLINK_Object_getFieldDefinition (blink_object_t group, const char *fieldName)
 Read field definition from field. More...
 
bool BLINK_Object_encodeCompact (blink_object_t group, blink_stream_t out)
 
blink_object_t BLINK_Object_decodeCompact (blink_stream_t in, const struct blink_allocator *alloc)
 

Typedefs

typedef struct blink_object * blink_object_t
 
typedef struct blink_streamblink_stream_t
 
typedef struct blink_schemablink_schema_t
 

Function Documentation

bool BLINK_Object_clear ( blink_object_t  group,
const char *  fieldName 
)

Clear a field (i.e.

set to NULL)

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
true if successful
bool BLINK_Object_fieldIsNull ( blink_object_t  group,
const char *  fieldName 
)

Test if a field value is NULL.

Test if field value is NULL.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
true if field value is NULL
struct blink_string BLINK_Object_getBinary ( blink_object_t  group,
const char *  fieldName 
)

Read binary from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
binary string
bool BLINK_Object_getBool ( blink_object_t  group,
const char *  fieldName 
)

Read boolean from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
boolean
struct blink_decimal BLINK_Object_getDecimal ( blink_object_t  group,
const char *  fieldName 
)

Read decimal from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
decimal
const char* BLINK_Object_getEnum ( blink_object_t  group,
const char *  fieldName 
)

Read enum from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
pointer to enum string
double BLINK_Object_getF64 ( blink_object_t  group,
const char *  fieldName 
)

Read f64 from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
f64
blink_schema_t BLINK_Object_getFieldDefinition ( blink_object_t  group,
const char *  fieldName 
)

Read field definition from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
field definition
struct blink_string BLINK_Object_getFixed ( blink_object_t  group,
const char *  fieldName 
)

Read fixed from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
fixed size string
blink_object_t BLINK_Object_getGroup ( blink_object_t  group,
const char *  fieldName 
)

Read group from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
group
int64_t BLINK_Object_getInt ( blink_object_t  group,
const char *  fieldName 
)

Read Int from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
int
struct blink_string BLINK_Object_getString ( blink_object_t  group,
const char *  fieldName 
)

Read string from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
string
uint64_t BLINK_Object_getUint ( blink_object_t  group,
const char *  fieldName 
)

Read Uint from field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
Returns
uint
blink_object_t BLINK_Object_newGroup ( const struct blink_allocator alloc,
blink_schema_t  group 
)

Create a new group model from a group definition.

Parameters
[in]allocator
[in]groupgroup definition
Returns
group model
Return values
NULLcould not create group model
bool BLINK_Object_setBinary ( blink_object_t  group,
const char *  fieldName,
const uint8_t *  data,
uint32_t  len 
)

Write binary to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]data
[in]lenbyte length of data
Returns
true if successful
bool BLINK_Object_setBool ( blink_object_t  group,
const char *  fieldName,
bool  value 
)

Write boolean to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]valueboolean
Returns
true if successful
bool BLINK_Object_setDecimal ( blink_object_t  group,
const char *  fieldName,
int64_t  mantissa,
int8_t  exponent 
)

Write decimal to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]mantissa
[in]exponent
Returns
true if successful
bool BLINK_Object_setEnum ( blink_object_t  group,
const char *  fieldName,
const char *  symbol 
)

Write enum to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]symbol
Returns
true if successful
bool BLINK_Object_setF64 ( blink_object_t  group,
const char *  fieldName,
double  value 
)

Write f64 to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]valuef64
Returns
true if successful
bool BLINK_Object_setFixed ( blink_object_t  group,
const char *  fieldName,
const uint8_t *  data,
uint32_t  len 
)

Write fixed to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]data
[in]valuebyte length of data
Returns
true if successful
bool BLINK_Object_setGroup ( blink_object_t  group,
const char *  fieldName,
blink_object_t  value 
)

Write group to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]valuegroup
Returns
true if successful
bool BLINK_Object_setInt ( blink_object_t  group,
const char *  fieldName,
int64_t  value 
)

Write a signed integer to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]value
Returns
true if successful
bool BLINK_Object_setString ( blink_object_t  group,
const char *  fieldName,
const char *  str,
uint32_t  len 
)

Write string to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]str
[in]lenbyte length of str
Returns
true if successful
bool BLINK_Object_setUint ( blink_object_t  group,
const char *  fieldName,
uint64_t  value 
)

Write an unsigned integer to field.

Parameters
[in]group
[in]fieldNamenull terminated field name string
[in]value
Returns
true if successful