https://github.com/zhuagenborn/secs-ii-serialization
📦 A C++23 SECS-II/SEMI E5 serialization library, supporting byte serialization and SML formatting.(使用C++23开发的SECS-II/SEMI E5序列化库,支持字节序列化和SML格式化。)
https://github.com/zhuagenborn/secs-ii-serialization
secs-ii semi semiconductor
Last synced: 3 months ago
JSON representation
📦 A C++23 SECS-II/SEMI E5 serialization library, supporting byte serialization and SML formatting.(使用C++23开发的SECS-II/SEMI E5序列化库,支持字节序列化和SML格式化。)
- Host: GitHub
- URL: https://github.com/zhuagenborn/secs-ii-serialization
- Owner: Zhuagenborn
- License: mit
- Created: 2025-05-22T08:55:53.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-06-26T09:19:41.000Z (4 months ago)
- Last Synced: 2025-06-26T10:26:26.613Z (4 months ago)
- Topics: secs-ii, semi, semiconductor
- Language: C++
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# *SECS-II* Serialization

[](https://cmake.org)

## Introduction
A *SECS-II/SEMI E5* serialization library written in *C++23*, supporting:
- Deserializing SECS-II data from bytes.
- Serializing SECS-II data to bytes.
- Formatting SECS-II data to *SML* (*SECS Message Language*) strings.## Unit Tests
### Prerequisites
- Install *GoogleTest*.
- Install *CMake*.### Building
Go to the project folder and run:
```bash
mkdir -p build
cd build
cmake -DSECS2_BUILD_TESTS=ON ..
cmake --build .
```### Running
Go to the `build` folder and run:
```bash
ctest -V
```## Examples
### Serialization
```c++
List list;
list.push_back(U1 {1, 2});
list.push_back(list);
list.push_back(ASCII {"msg"});
list.push_back(U2 {3, 4});
list.push_back(U1 {});const auto bytes {Message {list}.ToBytes()};
```The value of `bytes` is:
```console
0x01 (List, 1 size byte)
0x05 (5 elements)
0xA5 (U1, 1 size byte)
0x02 (2 bytes)
0x01 (1)
0x02 (2)
0x01 (List, 1 size byte)
0x01 (1 element)
0xA5 (U1, 1 size byte)
0x02 (2 bytes)
0x01 (1)
0x02 (2)
0x41 (ASCII, 1 size byte)
0x03 (3 bytes)
0x6D ('m')
0x73 ('s')
0x67 ('g')
0xA9 (U2, 1 size byte)
0x02 (4 bytes)
0x00 0x03 (3)
0x00 0x04 (4)
0xA5 (U1, 1 size byte)
0x00 (0 bytes)
```### SML Formatting
```c++
List list;
list.push_back(I1 {});
list.push_back(Binary {static_cast(1), static_cast(2)});
list.push_back(list);
list.push_back(ASCII {"hello"});const auto sml {Message {list}.ToSml()};
```The value of `sml` is:
```console
>
>
```## License
Distributed under the *MIT License*. See `LICENSE` for more information.