OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers 20.0.1
Users' manual and API documentation
Loading...
Searching...
No Matches
Replay.h
Go to the documentation of this file.
1// Copyright 2005-2012 Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
4// and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable ONIXS Software
7// Services Agreement (the Agreement) and Customer end user license agreements granting
8// a non-assignable, non-transferable and non-exclusive license to use the software
9// for it's own data processing purposes under the terms defined in the Agreement.
10//
11// Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
12// of this source code or associated reference material to any other location for further reproduction
13// or redistribution, and any amendments to this copyright notice, are expressly prohibited.
14//
15// Any reproduction or redistribution for sale or hiring of the Software not in accordance with
16// the terms of the Agreement is a violation of copyright law.
17//
18
19#pragma once
20
21#include <string>
22#include <vector>
23
26
27namespace OnixS
28{
29 namespace Eurex
30 {
31 namespace MarketData
32 {
33 namespace Implementation { struct PcapReplayHelper; }
34
37 typedef std::vector<std::string> FilesList;
38
40 class ONIXS_EUREX_EMDI_API ReplayListener
41 {
42 public:
44 virtual void onReplayError (const std::string& errorDescription) = 0;
45
47 virtual void onReplayFinished() = 0;
48
49 protected:
52 virtual ~ReplayListener();
53 };
54
56 struct ONIXS_EUREX_EMDI_API ReplayMode
57 {
69 };
70
72 void ONIXS_EUREX_EMDI_API gatherFiles(FilesList* gatheredFiles, const std::string& root, const std::string& extension);
73
75 inline
76 void gatherLogs(FilesList* gatheredLogs, const std::string& root)
77 {
78 gatherFiles(gatheredLogs, root, ".log");
79 }
80
81#if defined (_MSC_VER)
82#pragma warning (push)
83#pragma warning (disable: 4251)
84#endif
85
87 struct ONIXS_EUREX_EMDI_API ReplayOptions
88 {
93
96
100 unsigned int packetReplayDelay;
101
105
108
111 : listener(defaultReplayListener())
114 , replayMode(ReplayMode::ConstantPacketReplayDelay)
115 {
116 }
117
119 explicit
120 ReplayOptions (const std::string& filesRoot, const std::string& filesExtension = ".log")
121 : listener(defaultReplayListener())
124 , replayMode(ReplayMode::ConstantPacketReplayDelay)
125 {
126 gatherFiles(&logs, filesRoot, filesExtension);
127 }
128
129 private:
130 static ReplayListener* defaultReplayListener();
131 };
132
133#if defined (_MSC_VER)
134#pragma warning (pop)
135#endif
136
138 struct ONIXS_EUREX_EMDI_API NoDelayReplay : public ReplayOptions
139 {
141 explicit NoDelayReplay(const std::string& filesRoot, const std::string& filesExtension = ".log");
142
145 };
146
148 struct ONIXS_EUREX_EMDI_API OriginalDelayReplay : public ReplayOptions
149 {
151 explicit OriginalDelayReplay(const std::string& filesRoot, const std::string& filesExtension = ".log");
152
155 };
156
158 struct ONIXS_EUREX_EMDI_API X2SpeedReplay : public ReplayOptions
159 {
161 explicit X2SpeedReplay(const std::string& filesRoot, const std::string& filesExtension = ".log");
162
165 };
166
167
168 inline
169 NoDelayReplay::NoDelayReplay(const std::string& filesRoot, const std::string& filesExtension)
170 : ReplayOptions(filesRoot, filesExtension)
171 {
175 }
176
177 inline
184
185 inline
186 OriginalDelayReplay::OriginalDelayReplay(const std::string& filesRoot, const std::string& filesExtension)
187 : ReplayOptions(filesRoot, filesExtension)
188 {
192 }
193
194 inline
201
202 inline
203 X2SpeedReplay::X2SpeedReplay (const std::string& filesRoot, const std::string& filesExtension)
204 : ReplayOptions(filesRoot, filesExtension)
205 {
209 }
210
211 inline
218 }
219 }
220}
Listening interface for log replay-related events.
Definition Replay.h:41
virtual void onReplayFinished()=0
Is called once the replay is finished.
virtual void onReplayError(const std::string &errorDescription)=0
Is called once error occurs while replaying.
std::vector< std::string > FilesList
Definition Replay.h:37
void gatherFiles(FilesList *gatheredFiles, const std::string &root, const std::string &extension)
Gathers files which are stored in a given folder.
void gatherLogs(FilesList *gatheredLogs, const std::string &root)
Gathers log files which are stored in a given folder.
Definition Replay.h:76
NoDelayReplay(const std::string &filesRoot, const std::string &filesExtension=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:169
NoDelayReplay()
Initializes instance with default values.
Definition Replay.h:178
OriginalDelayReplay(const std::string &filesRoot, const std::string &filesExtension=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:186
OriginalDelayReplay()
Initializes instance with default values.
Definition Replay.h:195
ReplayMode::Enum replayMode
Replay mode. The default value is ReplayMode::ConstantPacketReplayDelay.
Definition Replay.h:107
ReplayOptions(const std::string &filesRoot, const std::string &filesExtension=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:120
ReplayListener * listener
Instance to notify about replay events.
Definition Replay.h:95
ReplayOptions()
Initializes instance with default values.
Definition Replay.h:110
X2SpeedReplay()
Initializes instance with default values.
Definition Replay.h:212
X2SpeedReplay(const std::string &filesRoot, const std::string &filesExtension=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:203