You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `binary_serialize` functions and classes provide serializing and unserializing of binary data. Serialization provides a way to transform application objects into and out of byte streams that can be sent over a network (or used for file IO).
17
+
The `binary_serialize` functions and classes provide serializing and unserializing of binary data. Serialization provides a way to transform application objects into and out of byte streams that can be sent over a network (or used for file IO). Many serialization libraries transform objects to and from text representations, but this library keeps data in binary formats.
18
+
19
+
The serialization functionality in this repository is useful when explicit control is needed for every bit and byte. This allows a developer to match an existing wire protocol or encoding scheme or to define his or her own wire protocol. Support is provided for fundamental arithmetic types as well as many C++ vocabulary types such as `std::optional`. Both big and little endian support is provided.
20
+
21
+
Full flexibility is provided for sequences such as `std::string` or `std::vector`. The number of elements can be specified to take 8 or 16 or 32 (etc) bits, followed by the sequence of chars or array elements. Similar flexibility is provided for vocabulary types such as `std::optional`, where the boolean flag can be specified as 8 or 16 or 32 (etc) bits, followed by the object (or none, if there is no value in the optional).
22
+
23
+
This library uses `std::format` style formatting. For example:
The buffer will contain the following (note that truncation or casting will happen between the application
44
+
object types and the serialized types as needed):
45
+
46
+
```
47
+
32 bit unsigned integer containing distance value
48
+
16 bit signed integer containing elevation value
49
+
8 bit unsigned integer corresponding to true or false for the optional
50
+
16 bit unsigned integer for the size of the name string (if optional is true)
51
+
0 - N 8 bit characters for the name string (if optional is true)
52
+
16 bit unsigned integer for the size of the waypoints vector
53
+
0 - N 64 bit signed integers for each waypoint value
54
+
```
55
+
56
+
The documentation overview provides a comparison with other serialization libraries as well as a rationale for the design decisions.
16
57
17
-
The serialization functionality in this repository is useful when explicit control is needed for every bit and byte. This allows a developer to match an existing wire protocol or encoding scheme or to define his or her own wire protocol. Support is provided for fundamental arithmetic types as well as certain C++ vocabulary types such as `std::optional`. Both big and little endian support is provided.
58
+
Inspiration and thanks go to [Louis Langholtz](https://github.com/louis-langholtz), who steered me towards considering the `std::format` API.
18
59
19
60
## Generated Documentation
20
61
@@ -38,7 +79,7 @@ The unit test code uses [Catch2](https://github.com/catchorg/Catch2). If the `BI
38
79
39
80
The unit test uses utilities from Connective C++'s [utility-rack](https://github.com/connectivecpp/utility-rack).
40
81
41
-
Specific version (or branch) specs for the dependenies are in `test/CMakeLists.txt`.
82
+
Specific version (or branch) specs for the dependencies are in the [test/CMakeLists.txt](test/CMakeLists.txt) file, look for the `CPMAddPackage` commands.
0 commit comments