libcbor  0.5.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
floats_ctrls.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2017 Pavel Kalvoda <me@pavelkalvoda.com>
3  *
4  * libcbor is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7 
8 #ifndef LIBCBOR_FLOATS_CTRLS_H
9 #define LIBCBOR_FLOATS_CTRLS_H
10 
11 #include "cbor/common.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /*
18 * ============================================================================
19 * Float manipulation
20 * ============================================================================
21 */
22 
28 bool cbor_float_ctrl_is_ctrl(const cbor_item_t * item);
29 
36 
44 float cbor_float_get_float2(const cbor_item_t * item);
45 
53 float cbor_float_get_float4(const cbor_item_t * item);
54 
62 double cbor_float_get_float8(const cbor_item_t * item);
63 
71 double cbor_float_get_float(const cbor_item_t * item);
72 
80 
88 
96 
104 
110 
116 
122 cbor_item_t * cbor_build_bool(bool value);
123 
133 void cbor_set_ctrl(cbor_item_t * item, uint8_t value);
134 
140 void cbor_set_float2(cbor_item_t * item, float value);
141 
147 void cbor_set_float4(cbor_item_t * item, float value);
148 
154 void cbor_set_float8(cbor_item_t * item, double value);
155 
161 uint8_t cbor_ctrl_value(const cbor_item_t * item);
162 
168 bool cbor_ctrl_is_bool(const cbor_item_t * item);
169 
175 cbor_item_t *cbor_build_float2(float value);
176 
182 cbor_item_t *cbor_build_float4(float value);
183 
189 cbor_item_t *cbor_build_float8(double value);
190 
196 cbor_item_t *cbor_build_ctrl(uint8_t value);
197 
198 
199 #ifdef __cplusplus
200 }
201 #endif
202 
203 #endif //LIBCBOR_FLOATS_CTRLS_H
uint8_t cbor_ctrl_value(const cbor_item_t *item)
Reads the control value.
Definition: floats_ctrls.c:18
void cbor_set_ctrl(cbor_item_t *item, uint8_t value)
Assign a control value.
Definition: floats_ctrls.c:85
bool cbor_float_ctrl_is_ctrl(const cbor_item_t *item)
Is this a ctrl value?
Definition: floats_ctrls.c:25
cbor_float_width
Possible widths of CBOR_TYPE_FLOAT_CTRL items.
Definition: data.h:54
void cbor_set_float8(cbor_item_t *item, double value)
Assigns a float value.
Definition: floats_ctrls.c:78
cbor_item_t * cbor_build_float8(double value)
Constructs a new float.
Definition: floats_ctrls.c:179
cbor_item_t * cbor_new_ctrl()
Constructs a new ctrl item.
Definition: floats_ctrls.c:98
bool cbor_ctrl_is_bool(const cbor_item_t *item)
Is this ctrl item a boolean?
Definition: floats_ctrls.c:92
cbor_item_t * cbor_build_float4(float value)
Constructs a new float.
Definition: floats_ctrls.c:172
cbor_float_width cbor_float_get_width(const cbor_item_t *item)
Get the float width.
Definition: floats_ctrls.c:12
cbor_item_t * cbor_new_null()
Constructs new null ctrl item.
Definition: floats_ctrls.c:146
cbor_item_t * cbor_new_float8()
Constructs a new float item.
Definition: floats_ctrls.c:134
void cbor_set_float2(cbor_item_t *item, float value)
Assigns a float value.
Definition: floats_ctrls.c:64
double cbor_float_get_float8(const cbor_item_t *item)
Get a double precision float.
Definition: floats_ctrls.c:45
cbor_item_t * cbor_build_bool(bool value)
Constructs new boolean ctrl item.
Definition: floats_ctrls.c:160
void cbor_set_float4(cbor_item_t *item, float value)
Assigns a float value.
Definition: floats_ctrls.c:71
cbor_item_t * cbor_build_ctrl(uint8_t value)
Constructs a ctrl item.
Definition: floats_ctrls.c:186
cbor_item_t * cbor_build_float2(float value)
Constructs a new float.
Definition: floats_ctrls.c:165
float cbor_float_get_float4(const cbor_item_t *item)
Get a single precision float.
Definition: floats_ctrls.c:38
double cbor_float_get_float(const cbor_item_t *item)
Get the float value represented as double.
Definition: floats_ctrls.c:52
cbor_item_t * cbor_new_undef()
Constructs new under ctrl item.
Definition: floats_ctrls.c:153
The item handle.
Definition: data.h:149
float cbor_float_get_float2(const cbor_item_t *item)
Get a half precision float.
Definition: floats_ctrls.c:31
cbor_item_t * cbor_new_float2()
Constructs a new float item.
Definition: floats_ctrls.c:110
cbor_item_t * cbor_new_float4()
Constructs a new float item.
Definition: floats_ctrls.c:122