EHS/include/ehs/db/DbVarTmpl.h

69 lines
1.1 KiB
C++

#pragma once
#include "DbType.h"
#include "ehs/EHS.h"
#include "ehs/Serializer.h"
#include "ehs/Str.h"
namespace ehs
{
class DbVar;
class DbVarTmpl
{
private:
friend class DbTable;
friend class DbVar;
UInt_64 hashId;
Str_8 id;
DbType type;
bool array;
UInt_64 size;
Byte* def;
Array<DbVar*> slaves;
public:
~DbVarTmpl();
DbVarTmpl();
DbVarTmpl(Str_8 id, DbType type, UInt_64 size, const Byte* def);
DbVarTmpl(Str_8 id, DbType type, const Byte* def);
DbVarTmpl(DbVarTmpl&& varTmpl) noexcept;
DbVarTmpl(const DbVarTmpl& varTmpl);
DbVarTmpl& operator=(DbVarTmpl&& varTmpl) noexcept;
DbVarTmpl& operator=(const DbVarTmpl& varTmpl);
UInt_64 GetHashId() const;
void SetId(Str_8 newId);
Str_8 GetId() const;
void SetType(DbType newType);
DbType GetType() const;
void SetIsArray(bool value);
bool IsArray() const;
UInt_64 GetSize() const;
Byte* GetDefault() const;
private:
void UpdateSlave(const DbVar *oldSlave, DbVar *newSlave) const;
void Serialize(Serializer<UInt_64> &data) const;
void Deserialize(Serializer<UInt_64> &data);
};
}