EHS
Loading...
Searching...
No Matches
DbTable.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/Version.h"
4#include "ehs/Array.h"
5#include "DbVarTmpl.h"
6#include "DbObject.h"
7#include "ehs/Serializer.h"
8
9namespace ehs
10{
11 class Database;
12
13 class EHS_LIB_IO DbTable
14 {
15 private:
16 friend class Database;
17 friend class DbVar;
18 friend class DbObject;
19
20 Database *parent;
21 UInt_64 hashId;
22 Str_8 id;
23 Array<DbVarTmpl> varTmpls;
24 Array<DbObject> objects;
25
26 public:
27 DbTable();
28
29 DbTable(Str_8 id);
30
31 DbTable(DbTable&& table) noexcept;
32
33 DbTable(const DbTable& table);
34
35 DbTable& operator=(DbTable&& table) noexcept;
36
37 DbTable& operator=(const DbTable& table);
38
39 UInt_64 GetHashId() const;
40
41 void SetId(Str_8 newId);
42
43 Str_8 GetId() const;
44
45 bool HasVariable(UInt_64 hashId) const;
46
47 bool HasVariable(const Str_8& id) const;
48
49 bool CreateVariable(DbVarTmpl var);
50
52
53 DbObject *GetObject(UInt_64 variableHashId, const Str_8 &value) const;
54
55 DbObject *GetObject(const Str_8 &variable, const Str_8 &value) const;
56
57 DbObject *GetObject(UInt_64 id) const;
58
59 private:
60 DbVarTmpl *GetVariableTemplate(UInt_64 hashId) const;
61
62 void Serialize(const Str_8 &dir, Serializer<UInt_64>& data) const;
63
64 void Deserialize(const Str_8 &dir, Serializer<UInt_64>& data);
65 };
66}
Definition Array.h:16
Definition Database.h:9
UInt_64 GetHashId() const
Definition DbTable.cpp:68
DbObject * CreateObject()
Definition DbTable.cpp:113
void SetId(Str_8 newId)
Definition DbTable.cpp:73
DbTable()
Definition DbTable.cpp:8
DbObject * GetObject(UInt_64 variableHashId, const Str_8 &value) const
Definition DbTable.cpp:127
friend class DbObject
Definition DbTable.h:18
bool CreateVariable(DbVarTmpl var)
Definition DbTable.cpp:98
friend class Database
Definition DbTable.h:16
bool HasVariable(UInt_64 hashId) const
Definition DbTable.cpp:84
DbTable & operator=(DbTable &&table) noexcept
Definition DbTable.cpp:31
friend class DbVar
Definition DbTable.h:17
Str_8 GetId() const
Definition DbTable.cpp:79
Definition DbVarTmpl.h:12
Definition Serializer.h:25
Definition Anchor.h:6
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953