63 lines
1.1 KiB
C++
63 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "ehs/Version.h"
|
|
#include "ehs/Array.h"
|
|
#include "DbVarTmpl.h"
|
|
#include "DbObject.h"
|
|
#include "ehs/Serializer.h"
|
|
|
|
namespace ehs
|
|
{
|
|
class DbTable
|
|
{
|
|
private:
|
|
friend class Database;
|
|
friend class DbVar;
|
|
|
|
UInt_64 hashId;
|
|
Str_8 id;
|
|
Array<DbVarTmpl> varTmpls;
|
|
Array<DbObject> objects;
|
|
|
|
public:
|
|
DbTable();
|
|
|
|
DbTable(Str_8 id);
|
|
|
|
DbTable(DbTable&& table) noexcept;
|
|
|
|
DbTable(const DbTable& table);
|
|
|
|
DbTable& operator=(DbTable&& table) noexcept;
|
|
|
|
DbTable& operator=(const DbTable& table);
|
|
|
|
UInt_64 GetHashId() const;
|
|
|
|
void SetId(Str_8 newId);
|
|
|
|
Str_8 GetId() const;
|
|
|
|
bool HasVariable(UInt_64 hashId) const;
|
|
|
|
bool HasVariable(const Str_8& id) const;
|
|
|
|
bool CreateVariable(DbVarTmpl var);
|
|
|
|
DbObject *CreateObject();
|
|
|
|
DbObject *GetObject(UInt_64 variableHashId, const Str_8 &value) const;
|
|
|
|
DbObject *GetObject(const Str_8 &variable, const Str_8 &value) const;
|
|
|
|
DbObject *GetObject(UInt_64 id) const;
|
|
|
|
private:
|
|
DbVarTmpl *GetVariableTemplate(UInt_64 hashId) const;
|
|
|
|
void Serialize(Serializer<UInt_64>& data) const;
|
|
|
|
void Deserialize(Serializer<UInt_64>& data);
|
|
};
|
|
}
|