Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
tutorial_interpreter.cpp
Go to the documentation of this file.
3#include "tutorial/Readable.h"
10
11#include <iostream>
12#include <joedb/Multiplexer.h>
13
14namespace joedb
15{
16 ////////////////////////////////////////////////////////////////////////////
17 static int main(int argc, char **argv)
18 ////////////////////////////////////////////////////////////////////////////
19 {
20 tutorial::File_Client client("tutorial.joedb");
21
22 client.transaction([](tutorial::Writable_Database &db){
23 tutorial::Readable readable(db);
24 tutorial::Multiplexer multiplexer(db);
25
26 Command_Interpreter interpreter;
27
28 Blob_Reader_Command_Processor blob_reader_processor
29 (
31 );
32
33 Data_Manipulation_Command_Processor data_manipulation_processor
34 (
35 readable,
36 multiplexer,
37 0
38 );
39
40 Writable_Command_Processor writable_processor(multiplexer, db);
41
42 interpreter.add_processor(blob_reader_processor);
43 interpreter.add_processor(data_manipulation_processor);
44 interpreter.add_processor(writable_processor);
45
46 interpreter.main_loop(std::cin, std::cout);
47 });
48
49 return 0;
50 }
51}
52
53/////////////////////////////////////////////////////////////////////////////
54int main(int argc, char **argv)
55/////////////////////////////////////////////////////////////////////////////
56{
57 joedb::main_exception_catcher(joedb::main, argc, argv);
58}
const Buffered_File & get_file() const
Shortcut to directly build a Client from a file name.
Definition File_Client.h:39
Write simultaneously to the database and the file (ignore schema changes)
Definition Multiplexer.h:40
Implement the joedb::Readable interface for a compiled database.
Definition Readable.h:27
A writable Database constructed from a writable joedb::Buffered_File.
const joedb::Readonly_Journal & get_journal() const
int main()
int main_exception_catcher(int(*main)(int, char **), int argc, char **argv)
Catch exception from main.
Definition Blob.h:7