Joedb 10.2.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Procedure_h.cpp
Go to the documentation of this file.
3
4namespace joedb::generator
5{
7 (
8 const Compiler_Options &options,
9 const Compiler_Options &parent_options
10 ):
11 Generator(".", "Procedure.h", options),
12 parent_options(parent_options)
13 {
14 }
15
17 {
19
20 out << '\n';
21 if (&options == &parent_options)
22 out << "#include \"rpc/Service.h\"";
23 else
24 out << "#include \"../Service.h\"";
25 out << R"RRR(
26#include "joedb/rpc/Procedure.h"
27#include "Writable_Database.h"
28
29)RRR";
30
31
33
34 out << R"RRR(
35 /// Class for all procedures based on this message schema
36 class Procedure: public joedb::rpc::Procedure
37 {
38 protected:
39 rpc::Service &service;
40
41 virtual void execute(Writable_Database &message) const = 0;
42
43 void execute(joedb::Abstract_File &file) const override
44 {
45 Writable_Database db(file, joedb::Recovery::ignore_header);
46 execute(db);
47 db.soft_checkpoint();
48 }
49
50 public:
51 Procedure(rpc::Service &service): service(service)
52 {
53 }
54 };
55)RRR";
56
59 }
60}
const std::vector< std::string > & get_name_space() const
const Compiler_Options & options
Definition Generator.h:13
Procedure_h(const Compiler_Options &options, const Compiler_Options &parent_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_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