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