| 1 | #ifndef NIX_IRC_SERIALIZER_H |
| 2 | #define NIX_IRC_SERIALIZER_H |
| 3 | |
| 4 | #include "types.h" |
| 5 | #include <fstream> |
| 6 | #include <string> |
| 7 | #include <vector> |
| 8 | |
| 9 | namespace nix_irc { |
| 10 | |
| 11 | class Serializer { |
| 12 | public: |
| 13 | Serializer(); |
| 14 | ~Serializer(); |
| 15 | |
| 16 | void serialize(const IRModule& module, const std::string& path); |
| 17 | std::vector<uint8_t> serialize_to_bytes(const IRModule& module); |
| 18 | |
| 19 | private: |
| 20 | struct Impl; |
| 21 | std::unique_ptr<Impl> pImpl; |
| 22 | }; |
| 23 | |
| 24 | class Deserializer { |
| 25 | public: |
| 26 | Deserializer(); |
| 27 | ~Deserializer(); |
| 28 | |
| 29 | IRModule deserialize(const std::string& path); |
| 30 | IRModule deserialize(const std::vector<uint8_t>& data); |
| 31 | |
| 32 | private: |
| 33 | struct Impl; |
| 34 | std::unique_ptr<Impl> pImpl; |
| 35 | }; |
| 36 | |
| 37 | } // namespace nix_irc |
| 38 | |
| 39 | #endif |