MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
serialization.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <stddef.h>
5 #include <stdbool.h>
6 
15 
16 #ifdef __cplusplus
17 #include <type_traits>
18 
19 namespace microstrain {
20 namespace C {
21 extern "C" {
22 #endif // __cplusplus
23 
24 
25 
32 
33 
42 typedef struct microstrain_serializer
43 {
44  uint8_t* _buffer;
45  size_t _buffer_size;
46  size_t _offset;
48 
49 void microstrain_serializer_init_insertion(microstrain_serializer* serializer, uint8_t* buffer, size_t buffer_size);
50 void microstrain_serializer_init_extraction(microstrain_serializer* serializer, const uint8_t* buffer, size_t buffer_size);
51 
55 
58 
59 
60 void microstrain_insert_bool(microstrain_serializer* serializer, bool value);
61 void microstrain_insert_char(microstrain_serializer* serializer, char value);
62 
63 void microstrain_insert_u8 (microstrain_serializer* serializer, uint8_t value);
64 void microstrain_insert_u16(microstrain_serializer* serializer, uint16_t value);
65 void microstrain_insert_u32(microstrain_serializer* serializer, uint32_t value);
66 void microstrain_insert_u64(microstrain_serializer* serializer, uint64_t value);
67 
68 void microstrain_insert_s8 (microstrain_serializer* serializer, int8_t value);
69 void microstrain_insert_s16(microstrain_serializer* serializer, int16_t value);
70 void microstrain_insert_s32(microstrain_serializer* serializer, int32_t value);
71 void microstrain_insert_s64(microstrain_serializer* serializer, int64_t value);
72 
73 void microstrain_insert_float(microstrain_serializer* serializer, float value);
74 void microstrain_insert_double(microstrain_serializer* serializer, double value);
75 
76 
77 void microstrain_extract_bool(microstrain_serializer* serializer, bool* value);
78 void microstrain_extract_char(microstrain_serializer* serializer, char* value);
79 
80 void microstrain_extract_u8 (microstrain_serializer* serializer, uint8_t* value);
81 void microstrain_extract_u16(microstrain_serializer* serializer, uint16_t* value);
82 void microstrain_extract_u32(microstrain_serializer* serializer, uint32_t* value);
83 void microstrain_extract_u64(microstrain_serializer* serializer, uint64_t* value);
84 
85 void microstrain_extract_s8 (microstrain_serializer* serializer, int8_t* value);
86 void microstrain_extract_s16(microstrain_serializer* serializer, int16_t* value);
87 void microstrain_extract_s32(microstrain_serializer* serializer, int32_t* value);
88 void microstrain_extract_s64(microstrain_serializer* serializer, int64_t* value);
89 
90 void microstrain_extract_float (microstrain_serializer* serializer, float* value);
91 void microstrain_extract_double(microstrain_serializer* serializer, double* value);
92 
93 void microstrain_extract_count(microstrain_serializer* serializer, uint8_t* count_out, uint8_t max_count);
94 
97 
98 #ifdef __cplusplus
99 } // extern "C"
100 } // namespace C
101 } // namespace microstrain
102 #endif // __cplusplus
103 
microstrain::C::microstrain_insert_float
void microstrain_insert_float(microstrain_serializer *serializer, float value)
microstrain::C::microstrain_extract_u16
void microstrain_extract_u16(microstrain_serializer *serializer, uint16_t *value)
microstrain::C::microstrain_insert_double
void microstrain_insert_double(microstrain_serializer *serializer, double value)
microstrain::C::microstrain_serializer_init_extraction
void microstrain_serializer_init_extraction(microstrain_serializer *serializer, const uint8_t *buffer, size_t buffer_size)
microstrain::C::microstrain_extract_float
void microstrain_extract_float(microstrain_serializer *serializer, float *value)
microstrain::C::microstrain_extract_u32
void microstrain_extract_u32(microstrain_serializer *serializer, uint32_t *value)
microstrain::C::microstrain_extract_s64
void microstrain_extract_s64(microstrain_serializer *serializer, int64_t *value)
microstrain::C::microstrain_serializer
struct microstrain::C::microstrain_serializer microstrain_serializer
Structure used for serialization.
microstrain::C::microstrain_extract_bool
void microstrain_extract_bool(microstrain_serializer *serializer, bool *value)
microstrain::C::microstrain_extract_count
void microstrain_extract_count(microstrain_serializer *serializer, uint8_t *count_out, uint8_t max_count)
microstrain::C::microstrain_insert_s16
void microstrain_insert_s16(microstrain_serializer *serializer, int16_t value)
microstrain::C::microstrain_extract_u8
void microstrain_extract_u8(microstrain_serializer *serializer, uint8_t *value)
microstrain::C::microstrain_insert_char
void microstrain_insert_char(microstrain_serializer *serializer, char value)
microstrain::C::microstrain_insert_u32
void microstrain_insert_u32(microstrain_serializer *serializer, uint32_t value)
microstrain::C::microstrain_insert_s8
void microstrain_insert_s8(microstrain_serializer *serializer, int8_t value)
microstrain::C::microstrain_serializer
Structure used for serialization.
Definition: serialization.h:42
microstrain::C::microstrain_extract_s8
void microstrain_extract_s8(microstrain_serializer *serializer, int8_t *value)
microstrain::C::microstrain_insert_u8
void microstrain_insert_u8(microstrain_serializer *serializer, uint8_t value)
microstrain::C::microstrain_insert_s64
void microstrain_insert_s64(microstrain_serializer *serializer, int64_t value)
microstrain::C::microstrain_insert_u64
void microstrain_insert_u64(microstrain_serializer *serializer, uint64_t value)
microstrain::C::microstrain_extract_s16
void microstrain_extract_s16(microstrain_serializer *serializer, int16_t *value)
microstrain::C::microstrain_serializer_init_insertion
void microstrain_serializer_init_insertion(microstrain_serializer *serializer, uint8_t *buffer, size_t buffer_size)
microstrain::C::microstrain_serializer_capacity
size_t microstrain_serializer_capacity(const microstrain_serializer *serializer)
microstrain::C::microstrain_serializer_is_complete
bool microstrain_serializer_is_complete(const microstrain_serializer *serializer)
microstrain::C::microstrain_extract_u64
void microstrain_extract_u64(microstrain_serializer *serializer, uint64_t *value)
microstrain::C::microstrain_extract_s32
void microstrain_extract_s32(microstrain_serializer *serializer, int32_t *value)
microstrain::C::microstrain_extract_double
void microstrain_extract_double(microstrain_serializer *serializer, double *value)
microstrain::C::microstrain_insert_u16
void microstrain_insert_u16(microstrain_serializer *serializer, uint16_t value)
microstrain::C::microstrain_serializer_remaining
int microstrain_serializer_remaining(const microstrain_serializer *serializer)
microstrain::C::microstrain_insert_bool
void microstrain_insert_bool(microstrain_serializer *serializer, bool value)
microstrain::C::microstrain_extract_char
void microstrain_extract_char(microstrain_serializer *serializer, char *value)
microstrain::C::microstrain_serializer_length
size_t microstrain_serializer_length(const microstrain_serializer *serializer)
microstrain::C::microstrain_serializer_is_ok
bool microstrain_serializer_is_ok(const microstrain_serializer *serializer)
microstrain
Definition: embedded_time.h:8
microstrain::C::microstrain_insert_s32
void microstrain_insert_s32(microstrain_serializer *serializer, int32_t value)