#pragma once #include #include namespace clice::index { /// Serialize the index to JSON format. json::Value toJson(const memory::Index& index); /// This defines the structures that used to serialize the index to binary format. /// All pointers are serialized as offsets to the beginning of the binary. namespace binary { template struct array { uint32_t offset; uint32_t size; using value_type = T; }; using string = array; using File = index::File; using Symbol = index::Symbol; using Index = index::Index; } // namespace binary /// Serialize the index to binary format. The binary format is a sequence of bytes. /// `binary::Index` is at the beginning of the binary. std::vector toBinary(const memory::Index& index); /// TODO: ... support more serialization formats. } // namespace clice::index