Joedb 9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Type.h
Go to the documentation of this file.
1#ifndef joedb_Type_declared
2#define joedb_Type_declared
3
4#include "joedb/index_types.h"
5#include "joedb/Blob.h"
6
7#include <string>
8
9namespace joedb
10{
11 typedef uint8_t Type_Id_Storage;
12
13 /// @ingroup joedb
14 class Type
15 {
16 public:
17 enum class Type_Id: uint8_t
18 {
19 null,
20 #define TYPE_MACRO(a, b, c, d, e) c,
21 #include "joedb/TYPE_MACRO.h"
22 };
23
24 #define TYPE_MACRO(a, b, c, d, e) 1 +
25 enum {type_ids =
26 #include "joedb/TYPE_MACRO.h"
27 1
28 };
29
30 private:
31 Type_Id type_id;
32 Table_Id table_id;
33
34 Type(Type_Id type_id,
35 Table_Id table_id):
36 type_id(type_id),
37 table_id(table_id)
38 {}
39
40 public:
41 Type_Id get_type_id() const {return type_id;}
42 Table_Id get_table_id() const {return table_id;}
43
44 Type(): type_id(Type_Id::null), table_id{0} {}
45 Type(Type_Id type_id): type_id(type_id), table_id{0} {}
46
47 #define TYPE_MACRO(type, return_type, type_id, read, write)\
48 static Type type_id() {return Type(Type_Id::type_id);};
49 #define TYPE_MACRO_NO_REFERENCE
50 #include "joedb/TYPE_MACRO.h"
51
52 static Type reference(Table_Id table_id)
53 {
54 return Type(Type_Id::reference, table_id);
55 }
56 };
57}
58
59#endif
Type(Type_Id type_id)
Definition Type.h:45
static Type reference(Table_Id table_id)
Definition Type.h:52
Table_Id get_table_id() const
Definition Type.h:42
Type_Id get_type_id() const
Definition Type.h:41
@ type_ids
Definition Type.h:25
Definition Blob.h:7
uint8_t Type_Id_Storage
Definition Type.h:11