EHS/include/ehs/db/DbVar.h

57 lines
888 B
C++

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