EHS
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
51 DbObject *CreateObject();
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
Definition: DbObject.h:11
Definition: DbTable.h:14
Definition: DbVarTmpl.h:12
Definition: DbVar.h:12
Definition: Anchor.h:6