// // Created by selim on 27.11.22. // #ifndef UNFLUTTER_SNAPSHOT_H #define UNFLUTTER_SNAPSHOT_H #include "Leb128Int.h" #include #include #include #include namespace Dart { class Snapshot { public: enum class Kind: uint64_t { FULL, FULL_JIT, FULL_AOT, MESSAGE, NONE, INVALID }; static const uint32_t MAGIC = 0xDCDCF5F5; private: uint32_t _magic; uint64_t _size; Kind _kind; std::string _versionHash; std::vector _features; Leb128Int _baseObjectsCount; Leb128Int _allObjectsCount; Leb128Int _clustersCount; Leb128Int _fieldTableLength; private: static std::vector split(const std::string &str); public: explicit Snapshot(const std::byte* data); [[nodiscard]] uint64_t size() const; [[nodiscard]] std::string kindString() const; [[nodiscard]] std::string versionHash() const; [[nodiscard]] std::string featuresString() const; [[nodiscard]] uint64_t baseObjectsCount() const; [[nodiscard]] uint64_t allObjectsCount() const; [[nodiscard]] uint64_t clustersCount() const; [[nodiscard]] uint64_t fieldTableLength() const; }; } #endif //UNFLUTTER_SNAPSHOT_H