Zero
0.1.0
src
cmd
base
handler.h
Go to the documentation of this file.
1
#ifndef __HANDLER_H
2
#define __HANDLER_H
3
4
#include "
logrec.h
"
5
6
#include <fstream>
7
#include <sstream>
8
#include <unordered_set>
9
#include <algorithm>
10
11
class
Handler
{
12
public
:
13
Handler
() :
14
hout
(
std
::cout) {}
15
16
virtual
~Handler
() {};
17
18
virtual
void
initialize
() {};
19
20
virtual
void
invoke
(
logrec_t
&r) = 0;
21
22
virtual
void
finalize
() {};
23
24
virtual
void
newFile
(
const
char
*
/* fname */
) {};
25
26
Handler
(
const
Handler
&) =
delete
;
27
28
Handler
&
operator=
(
const
Handler
&) =
delete
;
29
30
void
setFileOutput
(
string
fpath) {
31
fileOutput
.reset(
new
ofstream(fpath));
32
hout
= *
fileOutput
;
33
}
34
35
protected
:
36
ostream&
out
() {
37
return
hout
.get();
38
}
39
40
private
:
41
reference_wrapper<ostream>
hout
;
42
43
unique_ptr<ofstream>
fileOutput
;
44
};
45
46
class
PageHandler
{
47
public
:
48
virtual
void
finalize
() {};
49
50
virtual
void
handle(
const
generic_page
& page) = 0;
51
};
52
53
class
StoreHandler
{
54
public
:
55
virtual
void
finalize
() {};
56
57
virtual
void
handle(
const
StoreID
&) = 0;
58
};
59
60
#endif // __HANDLER_H
Handler::fileOutput
unique_ptr< ofstream > fileOutput
Definition:
handler.h:43
std
STL namespace.
Handler::finalize
virtual void finalize()
Definition:
handler.h:22
StoreID
uint32_t StoreID
Definition:
basics.h:47
generic_page
A generic page view: any Zero page can be viewed as being of this type but it only exposes fields sha...
Definition:
generic_page.h:121
Handler::hout
reference_wrapper< ostream > hout
Definition:
handler.h:41
StoreHandler::finalize
virtual void finalize()
Definition:
handler.h:55
logrec_t
Represents a transactional log record.
Definition:
logrec.h:143
Handler::Handler
Handler()
Definition:
handler.h:13
PageHandler
Definition:
handler.h:46
StoreHandler
Definition:
handler.h:53
Handler::~Handler
virtual ~Handler()
Definition:
handler.h:16
Handler::setFileOutput
void setFileOutput(string fpath)
Definition:
handler.h:30
Handler::newFile
virtual void newFile(const char *)
Definition:
handler.h:24
Handler
Definition:
handler.h:11
PageHandler::finalize
virtual void finalize()
Definition:
handler.h:48
Handler::initialize
virtual void initialize()
Definition:
handler.h:18
Handler::operator=
Handler & operator=(const Handler &)=delete
logrec.h
Handler::invoke
virtual void invoke(logrec_t &r)=0
Handler::out
ostream & out()
Definition:
handler.h:36
Generated by
1.8.12