EHS
Loading...
Searching...
No Matches
MdlCodec.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/Str.h"
4#include "ehs/Serializer.h"
5#include "ehs/system/CPU.h"
6
7namespace ehs
8{
9 class Mdl;
10 class MdlCodec;
11
12 typedef bool (*EnocdeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, const Mdl*);
13 typedef bool (*DecodeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, Mdl*);
14
15 class EHS_LIB_IO MdlCodec
16 {
17 private:
18 Str_8 id;
19 UInt_64 hashExt;
20 Str_8 ext;
21 Endianness endianness;
22 EnocdeMdlCb encoder;
23 DecodeMdlCb decoder;
24
25 public:
26 MdlCodec();
27
28 MdlCodec(Str_8 id, Str_8 ext, Endianness end, EnocdeMdlCb encoder, DecodeMdlCb decoder);
29
30 MdlCodec(MdlCodec&& codec) noexcept;
31
32 MdlCodec(const MdlCodec& codec);
33
34 MdlCodec& operator=(MdlCodec&& codec) noexcept;
35
36 MdlCodec& operator=(const MdlCodec& codec);
37
38 Str_8 GetId() const;
39
40 UInt_64 GetHashExt() const;
41
42 Str_8 GetExt() const;
43
45
46 bool Encode(Serializer<UInt_64>& out, const Mdl* in) const;
47
48 bool Decode(Serializer<UInt_64>& in, Mdl* out) const;
49 };
50}
Definition MdlCodec.h:16
bool Encode(Serializer< UInt_64 > &out, const Mdl *in) const
Definition MdlCodec.cpp:87
MdlCodec & operator=(MdlCodec &&codec) noexcept
Definition MdlCodec.cpp:32
UInt_64 GetHashExt() const
Definition MdlCodec.cpp:72
Str_8 GetExt() const
Definition MdlCodec.cpp:77
MdlCodec()
Definition MdlCodec.cpp:5
Str_8 GetId() const
Definition MdlCodec.cpp:67
Endianness GetEndianness() const
Definition MdlCodec.cpp:82
bool Decode(Serializer< UInt_64 > &in, Mdl *out) const
Definition MdlCodec.cpp:98
Definition Mdl.h:19
Definition Serializer.h:25
Definition Anchor.h:6
Endianness
Definition CPU.h:21
bool(* DecodeMdlCb)(const MdlCodec *, Serializer< UInt_64 > &, Mdl *)
Definition MdlCodec.h:13
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953
bool(* EnocdeMdlCb)(const MdlCodec *, Serializer< UInt_64 > &, const Mdl *)
Definition MdlCodec.h:12