C-Plus-Plus icon indicating copy to clipboard operation
C-Plus-Plus copied to clipboard

feat: added serializers

Open SharonIV0x86 opened this issue 1 year ago • 1 comments

Pull Request Title: Add Serializer and Deserializer Classes for Binary Serialization of Primitives and Strings

Description:

This pull request introduces a Serializer and Deserializer class for the serialization and deserialization of fundamental types such as int, double, char, and std::string in binary format. The feature supports both serialization of primitive types and strings, ensuring safe handling of binary data.

For primitives like int, float, and double, serialization is straightforward. However, serializing or deserializing std::string is more challenging due to its dynamic size and the absence of a delimiter (like null termination in C-style strings), which means we wouldn’t know how much to read or write.

To address this, the following approach is used:

Serializing:

  • Writing the size of the string immediately before the string data.
  • Adding a delimiter | at the end of the string to signify its boundary.

Deserializing:

  • Reading the size of the string before reading the actual string data to know how much to read.
  • Reading the string until the delimiter | is encountered.

Note: You can replace | with any other delimiter of your choice if needed.

Checklist:

  • [x] Added a description of the change.
  • [x] File name matches File Name Guidelines.
  • [x] Added tests and example; tests must pass.
  • [x] Added documentation to make the program self-explanatory and educational, following Doxygen guidelines.
  • [x] Relevant documentation/comments are changed or added.
  • [x] PR title follows semantic commit guidelines.
  • [x] Searched for previous suggestions before making a new one to avoid duplication.
  • [x] I acknowledge that all my contributions will be made under the project's license.

SharonIV0x86 avatar Oct 04 '24 19:10 SharonIV0x86

Hey, thank you for the contribution question is this for hacktoberfest?

realstealthninja avatar Oct 05 '24 10:10 realstealthninja

Hey, thank you for the contribution question is this for hacktoberfest?

Yes.

SharonIV0x86 avatar Oct 16 '24 13:10 SharonIV0x86

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 12 '24 00:12 github-actions[bot]

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!

github-actions[bot] avatar Dec 20 '24 00:12 github-actions[bot]