Joedb 10.2.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Readable.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2//
3// This code was automatically generated by the joedb compiler
4// https://www.joedb.org/
5//
6// Path to compiler: /home/rcoulom/repos/joedb/compcmake/gcc_debug/joedbc
7// Version: 10.2.1
8// joedbc compilation time: Sep 15 2025 20:22:33
9// Generation of this file: 2025-09-15 18:23:01 GMT
10//
11/////////////////////////////////////////////////////////////////////////////
12#ifndef tutorial_rpc_city_Readable_declared
13#define tutorial_rpc_city_Readable_declared
14
15#include "Database_Writable.h"
16
19
20namespace tutorial::rpc::city
21{
22 /// Implement the @ref joedb::Readable interface for a compiled database
23 ///
24 /// This allows using a compiled database with tools such as the
25 /// command interpreter.
27 {
28 private:
29 const Database &db;
30
31 public:
32 Readable(const Database &db): db(db)
33 {
34 joedb::Readonly_Memory_File file(detail::schema_string, detail::schema_string_size);
35 joedb::Readonly_Journal journal(file);
36 journal.replay_log(*this);
37 }
38
40 (
41 Table_Id table_id
42 ) const override
43 {
44 if (table_id == Table_Id{1})
45 return db.storage_of_city.freedom_keeper;
46
47 throw joedb::Exception("unknown table_id");
48 }
49
50 const std::string& get_string
51 (
52 Table_Id table_id,
53 Record_Id record_id,
54 Field_Id field_id
55 ) const override
56 {
57 if (table_id == Table_Id{1})
58 {
59 if (field_id == Field_Id(1))
60 {
61 return db.storage_of_city.field_value_of_name[to_underlying(record_id)];
62 }
63 }
64
65 throw joedb::Exception("unknown field");
66 }
67
68 const int32_t& get_int32
69 (
70 Table_Id table_id,
71 Record_Id record_id,
72 Field_Id field_id
73 ) const override
74 {
75 throw joedb::Exception("unknown field");
76 }
77
78 const int64_t& get_int64
79 (
80 Table_Id table_id,
81 Record_Id record_id,
82 Field_Id field_id
83 ) const override
84 {
85 throw joedb::Exception("unknown field");
86 }
87
89 (
90 Table_Id table_id,
91 Record_Id record_id,
92 Field_Id field_id
93 ) const override
94 {
95 throw joedb::Exception("unknown field");
96 }
97
98 const char& get_boolean
99 (
100 Table_Id table_id,
101 Record_Id record_id,
102 Field_Id field_id
103 ) const override
104 {
105 throw joedb::Exception("unknown field");
106 }
107
108 const float& get_float32
109 (
110 Table_Id table_id,
111 Record_Id record_id,
112 Field_Id field_id
113 ) const override
114 {
115 throw joedb::Exception("unknown field");
116 }
117
118 const double& get_float64
119 (
120 Table_Id table_id,
121 Record_Id record_id,
122 Field_Id field_id
123 ) const override
124 {
125 throw joedb::Exception("unknown field");
126 }
127
128 const int8_t& get_int8
129 (
130 Table_Id table_id,
131 Record_Id record_id,
132 Field_Id field_id
133 ) const override
134 {
135 throw joedb::Exception("unknown field");
136 }
137
138 const int16_t& get_int16
139 (
140 Table_Id table_id,
141 Record_Id record_id,
142 Field_Id field_id
143 ) const override
144 {
145 throw joedb::Exception("unknown field");
146 }
147
149 (
150 Table_Id table_id,
151 Record_Id record_id,
152 Field_Id field_id
153 ) const override
154 {
155 throw joedb::Exception("unknown field");
156 }
157 };
158
159 namespace city_table
160 {
161 constexpr static Table_Id id{1};
162
163 namespace name_field
164 {
165 constexpr static Field_Id id{1};
166 }
167 }
168}
169
170#endif
void replay_log(Writable &writable)
Store all the tables of the database.
Definition Database.h:63
detail::data_of_city storage_of_city
Definition Database.h:77
Implement the joedb::Readable interface for a compiled database.
Definition Readable.h:27
const joedb::Record_Id & get_reference(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:89
const char & get_boolean(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:99
const int16_t & get_int16(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:139
const float & get_float32(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:109
const int32_t & get_int32(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:69
const int64_t & get_int64(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:79
const int8_t & get_int8(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:129
const double & get_float64(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:119
Readable(const Database &db)
Definition Readable.h:32
const std::string & get_string(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:51
const joedb::Freedom_Keeper & get_freedom(Table_Id table_id) const override
Definition Readable.h:40
const joedb::Blob & get_blob(Table_Id table_id, Record_Id record_id, Field_Id field_id) const override
Definition Readable.h:149
Automatically generated by joedbc.
Definition Client.h:19