MAK Data Logger API Documentation for DIS
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
libsrc
lgrCore
lgrCheckpointPolicy.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 1992-2010 VT MAK
3
** All rights reserved.
4
******************************************************************************/
5
9
10
#ifndef lgrCheckpointPolicy_H_
11
#define lgrCheckpointPolicy_H_
12
13
#include "
lgrCore.h
"
14
15
#include "
absoluteTime.h
"
16
#include "
filePosition.h
"
17
#include "
observe.h
"
18
#include "
virtualConstructor.h
"
19
20
namespace
MAKLogger
21
{
22
class
DtLgrFileOutput;
23
class
DtPacket;
24
class
DtMessageState;
25
28
class
DT_DLL_LGRCORE
DtCheckpointPolicy
29
{
30
public
:
31
DT_PURE_VIRTUAL_CTR
(
DtCheckpointPolicy
,())
32
33
34
virtual
~
DtCheckpointPolicy
();
35
36
37
enum
Policy
38
{
39
ByCount
,
40
BySize
,
41
ByTime
42
};
43
44
45
private
:
47
DtCheckpointPolicy
(
const
DtCheckpointPolicy
&);
49
DtCheckpointPolicy
& operator=(
const
DtCheckpointPolicy
&);
50
public
:
51
56
virtual
bool
timeForCheckpoint()
const
= 0;
57
59
virtual
void
reset() = 0;
60
62
virtual
void
checkpointWritten() = 0;
63
66
virtual
void
packetWritten(
const
DtPacket
&) = 0;
67
69
virtual
void
connectFileOutput(
DtMessageState
*,
DtLgrFileOutput
*);
70
71
protected
:
72
73
void
onPacketWritten(
const
DtPacket
&);
74
76
typedef
DtObserverFunctor<DtCheckpointPolicy,DtPacket>
PacketObserverFunctor
;
77
78
PacketObserverFunctor
myPacketWrittenObserver
;
79
80
81
//DtObserverFunctor<DtCheckpointPolicy,DtPacket> myPacketWrittenObserver;
82
DtMessageState
*
myMessageState
;
83
DtLgrFileOutput
*
myLgrFileOutput
;
84
};
85
88
class
DT_DLL_LGRCORE
DtCheckpointBySize
:
public
DtCheckpointPolicy
89
{
90
public
:
91
DT_VIRTUAL_CTR
(
DtCheckpointBySize
,(
size_t
size))
92
DT_VIRTUAL_BASE_CTR
(
DtCheckpointPolicy
,(
size_t
size))
93
94
95
virtual
~
DtCheckpointBySize
();
96
97
private
:
99
DtCheckpointBySize
(
const
DtCheckpointBySize
&);
101
DtCheckpointBySize
& operator=(
const
DtCheckpointBySize
&);
102
public
:
103
109
virtual
bool
timeForCheckpoint()
const
;
110
112
virtual
void
reset();
113
115
virtual
size_t
sizeBetweenCheckpoints()
const
;
116
118
virtual
void
checkpointWritten();
119
121
virtual
void
packetWritten(
const
DtPacket
&);
122
123
protected
:
124
126
size_t
myCheckpointSize
;
127
129
size_t
myCurrentDataSize
;
130
};
131
134
class
DT_DLL_LGRCORE
DtCheckpointByCount
:
public
DtCheckpointPolicy
135
{
136
public
:
137
DT_VIRTUAL_CTR
(
DtCheckpointByCount
,(
int
count))
138
DT_VIRTUAL_BASE_CTR
(
DtCheckpointPolicy
,(
int
count))
139
140
141
virtual
~
DtCheckpointByCount
();
142
148
virtual
bool
timeForCheckpoint()
const
;
149
151
virtual
void
reset();
152
154
virtual
void
checkpointWritten();
155
157
virtual
void
packetWritten(
const
DtPacket
&);
158
159
protected
:
161
int
myCheckpointCount
;
162
164
int
myCurrentPacketsCount
;
165
};
166
169
class
DT_DLL_LGRCORE
DtCheckpointByTime
:
public
DtCheckpointPolicy
170
{
171
public
:
172
DT_VIRTUAL_CTR
(
DtCheckpointByTime
,(
DtRelativeTime
time))
173
DT_VIRTUAL_BASE_CTR
(
DtCheckpointPolicy
,(
DtRelativeTime
time))
174
175
176
virtual
~
DtCheckpointByTime
();
177
182
virtual
bool
timeForCheckpoint()
const
;
183
185
virtual
void
reset();
186
188
virtual
void
checkpointWritten();
189
191
virtual
void
packetWritten(
const
DtPacket
&);
192
193
protected
:
194
197
DtRelativeTime
myCheckpointTime
;
198
199
DtAbsoluteTime
myLastCheckpointTime
;
201
DtAbsoluteTime
myLastPacketTime
;
202
};
203
}
204
205
#endif
Document ID: Generated on Sun Dec 15 18:04:30 EST 2013 from SVN revision 134418
Copyright © 2005-2012 VT MÄK. All Rights Reserved (
www.mak.com
)