Joedb 9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Multiplexer_h.cpp
Go to the documentation of this file.
3
4namespace joedb::generator
5{
6 ////////////////////////////////////////////////////////////////////////////
8 ////////////////////////////////////////////////////////////////////////////
9 (
10 const Compiler_Options &options
11 ):
12 Generator(".", "Multiplexer.h", options)
13 {
14 }
15
16 ////////////////////////////////////////////////////////////////////////////
18 ////////////////////////////////////////////////////////////////////////////
19 {
20 const Database &db = options.get_db();
21 auto tables = db.get_tables();
22
24
25 out << R"RRR(
26#include "Writable_Database.h"
27#include "joedb/Multiplexer.h"
28#include "joedb/Selective_Writable.h"
29
30)RRR";
31
32
34
35 out << R"RRR(
36 namespace detail
37 {
38 class Multiplexer_Parent
39 {
40 protected:
41 joedb::Selective_Writable selective_writable;
42
43 public:
44 Multiplexer_Parent(joedb::Writable_Journal &journal):
45 selective_writable(journal, joedb::Selective_Writable::data_and_information)
46 {
47 }
48 };
49 }
50
51 /// Write simultaneously to the database and the file (ignore schema changes)
52 class Multiplexer:
53 protected detail::Multiplexer_Parent,
54 public joedb::Multiplexer
55 {
56 public:
57 Multiplexer(Writable_Database &db):
58 Multiplexer_Parent(db.journal),
59 joedb::Multiplexer{db, selective_writable}
60 {
61 }
62 };
63)RRR";
64
66
67 out << "\n#endif\n";
68 }
69}
const std::vector< std::string > & get_name_space() const
const Database & get_db() const
const std::map< Table_Id, std::string > & get_tables() const override
const Compiler_Options & options
Definition Generator.h:14
Multiplexer_h(const Compiler_Options &options)
void namespace_open(std::ostream &out, const std::vector< std::string > &n)
void namespace_close(std::ostream &out, const std::vector< std::string > &n)
void namespace_include_guard(std::ostream &out, const char *name, const std::vector< std::string > &n)
One code generator for each of the file generated by joedbc.
Definition Client_h.cpp:5