Joedb 10.2.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
RPC_Client_h.cpp
Go to the documentation of this file.
3
4namespace joedb::generator
5{
7 (
8 const Compiler_Options &options,
9 const std::vector<Procedure> &procedures
10 ):
11 Generator(".", "rpc/Client.h", options),
12 procedures(procedures)
13 {
14 }
15
17 {
18 auto name_space = options.get_name_space();
19 name_space.emplace_back("rpc");
20
21 namespace_include_guard_open(out, "Client", name_space);
22 out << "\n#include \"Signatures.h\"\n";
23 out << "#include \"joedb/rpc/Client.h\"\n\n";
24
25 namespace_open(out, name_space);
26
27 out << R"RRR(
28 /// Specialization of joedb::rpc::Client
29 class Client: private joedb::rpc::Client
30 {
31 public:
32 Client(joedb::Channel &channel):
33 joedb::rpc::Client(channel, get_signatures())
34 {
35 }
36)RRR";
37
38 for (size_t i = 0; i < procedures.size(); i++)
39 {
40 const auto &procedure = procedures[i];
41 out << "\n void " << procedure.name << '(' << procedure.schema << "::Memory_Database &db)\n";
42 out << " {\n";
43 out << " db.soft_checkpoint();\n";
44 out << " call(" << i << ", db);\n";
45 out << " db.pull();\n";
46 out << " }\n";
47 }
48
49 out << " };\n";
50
51 namespace_close(out, name_space);
53 }
54}
const std::vector< std::string > & get_name_space() const
const Compiler_Options & options
Definition Generator.h:13
RPC_Client_h(const Compiler_Options &options, const std::vector< Procedure > &procedures)
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_open(std::ostream &out, const char *name, const std::vector< std::string > &n)
void namespace_include_guard_close(std::ostream &out)
One code generator for each of the file generated by joedbc.
Definition Client_h.cpp:5