50 lines
982 B
C++
50 lines
982 B
C++
#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<UInt_64>&, const Mdl*);
|
|
typedef bool (*DecodeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, Mdl*);
|
|
|
|
class EHS_LIB_IO 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<UInt_64>& out, const Mdl* in) const;
|
|
|
|
bool Decode(Serializer<UInt_64>& in, Mdl* out) const;
|
|
};
|
|
} |