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