EHS/include/ehs/db/DbVar.h

57 lines
888 B
C
Raw Normal View History

2024-04-08 03:10:24 -07:00
#pragma once
#include "ehs/Types.h"
#include "DbType.h"
#include "ehs/Serializer.h"
2024-04-08 03:10:24 -07:00
namespace ehs
{
class DbVarTmpl;
class DbObject;
2024-04-08 03:10:24 -07:00
class DbVar
{
private:
friend class DbObject;
friend class DbVarTmpl;
2024-04-08 03:10:24 -07:00
UInt_64 hashId;
DbObject *parent;
DbVarTmpl *master;
2024-04-08 03:10:24 -07:00
UInt_64 size;
Byte *data;
2024-04-08 03:10:24 -07:00
public:
~DbVar();
DbVar();
DbVar(UInt_64 hashId, DbVarTmpl *master, UInt_64 size, const Byte *data);
2024-04-08 03:10:24 -07:00
DbVar(DbVar &&var) noexcept;
2024-04-08 03:10:24 -07:00
DbVar(const DbVar &var);
2024-04-08 03:10:24 -07:00
DbVar &operator=(DbVar &&var) noexcept;
2024-04-08 03:10:24 -07:00
DbVar &operator=(const DbVar &var);
2024-04-08 03:10:24 -07:00
explicit operator Byte *() const;
2024-04-08 03:10:24 -07:00
UInt_64 GetHashId() const;
UInt_64 GetSize() const;
void SetData(UInt_64 newSize, const Byte* newData);
void SetData(const Byte* newData);
2024-04-08 03:10:24 -07:00
Byte* GetData() const;
private:
void Serialize(Serializer<UInt_64> &data) const;
void Deserialize(Serializer<UInt_64> &data);
2024-04-08 03:10:24 -07:00
};
}