{"id":15047602,"url":"https://github.com/poseidon-code/serializer","last_synced_at":"2026-01-19T02:01:20.011Z","repository":{"id":248569603,"uuid":"826407630","full_name":"poseidon-code/Serializer","owner":"poseidon-code","description":"A modern C++ binary data serializer library.","archived":false,"fork":false,"pushed_at":"2025-07-30T16:55:36.000Z","size":485,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T18:59:27.762Z","etag":null,"topics":["binary","cpp17","cpp20","decoder","encoder","serializer"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/poseidon-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-09T16:44:42.000Z","updated_at":"2025-07-30T16:55:41.000Z","dependencies_parsed_at":"2025-05-15T13:44:16.117Z","dependency_job_id":"42aa01d4-1477-4dcf-a6b8-9fc43ab4cea5","html_url":"https://github.com/poseidon-code/Serializer","commit_stats":null,"previous_names":["poseidon-code/serializer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/poseidon-code/Serializer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FSerializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FSerializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FSerializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FSerializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poseidon-code","download_url":"https://codeload.github.com/poseidon-code/Serializer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FSerializer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28557783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T00:46:33.223Z","status":"online","status_checked_at":"2026-01-19T02:00:08.049Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","cpp17","cpp20","decoder","encoder","serializer"],"created_at":"2024-09-24T21:01:08.202Z","updated_at":"2026-01-19T02:01:20.006Z","avatar_url":"https://github.com/poseidon-code.png","language":"C++","readme":"# Serializer\n\nA binary data serializer in modern C++. Encodes \u0026 Decodes data to/from bytes with Little \u0026 Big Endian byte orders.\n\n## Usage\n\n### 1. Plain Old Arrays\n\n```cpp\n#include \u003ciostream\u003e\n\n#include \"Serializer.hpp\"\n\nint main() {\n    const size_t stream_length = 16;\n    unsigned char stream[stream_length] = {0}; // create the bytes array\n    Serializer::byte_t\u003cint64_t\u003e byte_8; // create a default Serializer object (Big Endian) of 8 bytes\n\n    byte_8.serialize(stream, 0x1122334455667788); // serialize the data and start putting it from 0 index of bytes array\n\n    byte_8.serialize(stream, 0x8877665544332211, 8); // serialize the data and start putting it from 8th index of bytes array\n\n    Serializer::print(stream, stream_length); // prints the entire bytes array (default delimeter \"\u003cspace\u003e\")\n    std::cout \u003c\u003c \"\\n\";\n\n    int64_t deserialized_value1 = byte_8.deserialize(stream); // returns the data after deserializing from 0 index of bytes array\n    int64_t deserialized_value2 = byte_8.deserialize(stream, 8); // returns the data after deserializing from 8th index of bytes array\n\n    std::cout \u003c\u003c std::hex \u003c\u003c \"0x\" \u003c\u003c deserialized_value1 \u003c\u003c \", 0x\" \u003c\u003c deserialized_value2 \u003c\u003c std::dec \u003c\u003c \"\\n\";\n\n\n    return 0;\n}\n\n```\n\n### 2. Vector of Bytes\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n\n#include \"Serializer.hpp\"\n\nint main() {\n    const size_t stream_length = 16;\n    std::vector\u003cunsigned char\u003e stream(16, 0x00); // create bytes vector with size \u0026 default values\n\n    byte_8_le.serialize(stream, 0x1122334455667788); // serialize the data and start putting it from 0 index of bytes vector (using the libray provided, 8-byte signed integer in little endian byte order - object)\n\n    std::vector\u003cunsigned char\u003e serialized_value2 = byte_8_le.serialize(0x1122334455667788); // returns the bytes vector of the serialized data\n    for (auto byte : serialized_value2) std::cout \u003c\u003c std::hex \u003c\u003c static_cast\u003cuint\u003e(byte) \u003c\u003c \" \"; std::cout \u003c\u003c std::dec \u003c\u003c \"\\n\"; // prints the returned bytes vector\n    std::copy(serialized_value2.begin(), serialized_value2.end(), stream.begin() + 8); // putting the returned bytes vector to the `stream` bytes vector from its 8th index\n\n    std::string stream_str = Serializer::sprint(stream, \", \"); // returns the bytes as a string with \u003ccomma\u003e delimeter\n    std::cout \u003c\u003c stream_str \u003c\u003c \"\\n\"; // prints the returned string\n\n    int64_t deserialized_value1 = byte_8_le.deserialize(stream); // returns the data after deserializing from 0 index of bytes array\n    int64_t deserialized_value2 = byte_8_le.deserialize(stream.data(), 8); // returns the data after deserializing from 8th index of internal memory of the bytes array\n\n    std::cout \u003c\u003c std::hex \u003c\u003c \"0x\" \u003c\u003c deserialized_value1 \u003c\u003c \" - 0x\" \u003c\u003c deserialized_value2 \u003c\u003c std::dec \u003c\u003c \"\\n\";\n\n\n    return 0;\n}\n```\n\n\n### 3. Fixed Point Quantization\n\n```cpp\n#include \u003cstdfloat\u003e\n#include \u003ccstdint\u003e\n\n#include \"Serializer.hpp\"\n\n\nint main() {\n    std::float64_t value = 67.9834672;\n    Serializer::fixed_point_quantizer\u003cstd::float64_t\u003e quantizer(-90.0, 90.0); // precision will be lost if there are low number of bits\n\n    auto quantized_value = quantizer.to_fpq(value); // quantized value to 64bit signed integer\n    std::cout \u003c\u003c quantized_value \u003c\u003c std::endl;\n\n    std::cout \u003c\u003c quantizer.from_fpq(quantized_value) \u003c\u003c std::endl; // switched back to floating point value\n\n    return 0;\n}\n```\n\n\n\n## [GPL v3 License](./LICENSE)\n\nSerializer : A modern C++ binary data serializer library. \\\nCopyright (C) 2024 Pritam Halder\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposeidon-code%2Fserializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposeidon-code%2Fserializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposeidon-code%2Fserializer/lists"}