EHS/include/ehs/db/DbVarTmpl.h

69 lines
1.1 KiB
C
Raw Normal View History

2024-04-08 03:10:24 -07:00
#pragma once
#include "DbType.h"
#include "ehs/EHS.h"
#include "ehs/Serializer.h"
2024-04-08 03:10:24 -07:00
#include "ehs/Str.h"
namespace ehs
{
class DbVar;
class DbVarTmpl
2024-04-08 03:10:24 -07:00
{
private:
friend class DbTable;
friend class DbVar;
2024-04-08 03:10:24 -07:00
UInt_64 hashId;
Str_8 id;
DbType type;
bool array;
UInt_64 size;
Byte* def;
Array<DbVar*> slaves;
2024-04-08 03:10:24 -07:00
public:
~DbVarTmpl();
2024-04-08 03:10:24 -07:00
DbVarTmpl();
DbVarTmpl(Str_8 id, DbType type, UInt_64 size, const Byte* def);
DbVarTmpl(Str_8 id, DbType type, const Byte* def);
2024-04-08 03:10:24 -07:00
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);
2024-04-08 03:10:24 -07:00
};
}