#pragma once #include "ehs/Str.h" #include "ehs/Serializer.h" #include "ehs/system/CPU.h" namespace ehs { class Mdl; class MdlCodec; typedef bool (*EnocdeMdlCb)(const MdlCodec*, Serializer&, const Mdl*); typedef bool (*DecodeMdlCb)(const MdlCodec*, Serializer&, Mdl*); class MdlCodec { private: Str_8 id; UInt_64 hashExt; Str_8 ext; Endianness endianness; EnocdeMdlCb encoder; DecodeMdlCb decoder; public: MdlCodec(); MdlCodec(Str_8 id, Str_8 ext, Endianness end, EnocdeMdlCb encoder, DecodeMdlCb decoder); MdlCodec(MdlCodec&& codec) noexcept; MdlCodec(const MdlCodec& codec); MdlCodec& operator=(MdlCodec&& codec) noexcept; MdlCodec& operator=(const MdlCodec& codec); Str_8 GetId() const; UInt_64 GetHashExt() const; Str_8 GetExt() const; Endianness GetEndianness() const; bool Encode(Serializer& out, const Mdl* in) const; bool Decode(Serializer& in, Mdl* out) const; }; }