-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChainHandler.cpp
125 lines (107 loc) · 2.74 KB
/
ChainHandler.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// -----------------------------------------------------------------------------
// ChainHandler.cpp ChainHandler.cpp
// -----------------------------------------------------------------------------
/**
* @file
* @brief This file holds the implementation of the @ref ChainHandler class.
* @author Col. Walter E. Kurtz
* @version 2016-11-07
* @copyright GNU General Public License - Version 3.0
*/
// -----------------------------------------------------------------------------
// Includes Includes
// -----------------------------------------------------------------------------
#include "ChainHandler.h"
// -----------------------------------------------------------------------------
// Construction Construction
// -----------------------------------------------------------------------------
// ------------
// ChainHandler
// ------------
/*
*
*/
ChainHandler::ChainHandler(KVHandler* next)
: m_next(next)
{
// nothing
}
// -----------------------------------------------------------------------------
// Initialization Initialization
// -----------------------------------------------------------------------------
// --------------
// setNextHandler
// --------------
/*
*
*/
void ChainHandler::setNextHandler(KVHandler* next)
{
m_next = next;
}
// -----------------------------------------------------------------------------
// Callback handler Callback handler
// -----------------------------------------------------------------------------
// --------------
// OnBeginParsing
// --------------
/*
*
*/
void ChainHandler::OnBeginParsing(const string& filename)
{
if (m_next)
{
m_next->OnBeginParsing(filename);
}
}
// ------------
// OnEndParsing
// ------------
/*
*
*/
void ChainHandler::OnEndParsing(bool healthy)
{
if (m_next)
{
m_next->OnEndParsing(healthy);
}
}
// ------
// OnData
// ------
/*
*
*/
void ChainHandler::OnData(const string& key, const string& value)
{
if (m_next)
{
m_next->OnData(key, value);
}
}
// -----------------------------------------------------------------------------
// Status information Status information
// -----------------------------------------------------------------------------
// -------
// healthy
// -------
/*
*
*/
bool ChainHandler::healthy() const
{
// check if this handler got stuck itself
if ( !KVHandler::healthy() )
{
return false;
}
// check if next handler got stuck
if (m_next)
{
return m_next->healthy();
}
// everything ok
return true;
}