OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers 18.2.0
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
83 {
87
90
94 unsigned int packetReplayDelay;
95
99
102
105 : listener(defaultReplayListener())
108 , replayMode(ReplayMode::ConstantPacketReplayDelay)
109 {
110 }
111
113 explicit
114 ReplayOptions (const std::string& filesRoot, const std::string& filesExtention = ".log")
115 : listener(defaultReplayListener())
118 , replayMode(ReplayMode::ConstantPacketReplayDelay)
119 {
120 gatherFiles(&logs, filesRoot, filesExtention);
121 }
122
123 private:
124 ONIXS_EUREX_EMDI_API static ReplayListener* defaultReplayListener();
125 };
126
128 struct ONIXS_EUREX_EMDI_API NoDelayReplay : public ReplayOptions
129 {
131 explicit NoDelayReplay(const std::string& filesRoot, const std::string& filesExtention = ".log");
132
135 };
136
138 struct ONIXS_EUREX_EMDI_API OriginalDelayReplay : public ReplayOptions
139 {
141 explicit OriginalDelayReplay(const std::string& filesRoot, const std::string& filesExtention = ".log");
142
145 };
146
148 struct ONIXS_EUREX_EMDI_API X2SpeedReplay : public ReplayOptions
149 {
151 explicit X2SpeedReplay(const std::string& filesRoot, const std::string& filesExtention = ".log");
152
155 };
156
157
158 inline
159 NoDelayReplay::NoDelayReplay(const std::string& filesRoot, const std::string& filesExtention)
160 : ReplayOptions(filesRoot, filesExtention)
161 {
165 }
166
167 inline
174
175 inline
176 OriginalDelayReplay::OriginalDelayReplay(const std::string& filesRoot, const std::string& filesExtention)
177 : ReplayOptions(filesRoot, filesExtention)
178 {
182 }
183
184 inline
191
192 inline
193 X2SpeedReplay::X2SpeedReplay (const std::string& filesRoot, const std::string& filesExtention)
194 : ReplayOptions(filesRoot, filesExtention)
195 {
199 }
200
201 inline
208 }
209 }
210}
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 &filesExtention=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:159
NoDelayReplay()
Initializes instance with default values.
Definition Replay.h:168
OriginalDelayReplay()
Initializes instance with default values.
Definition Replay.h:185
OriginalDelayReplay(const std::string &filesRoot, const std::string &filesExtention=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:176
ReplayMode::Enum replayMode
Replay mode. The default value is ReplayMode::ConstantPacketReplayDelay.
Definition Replay.h:101
ReplayListener * listener
Instance to notify about replay events.
Definition Replay.h:89
ReplayOptions(const std::string &filesRoot, const std::string &filesExtention=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:114
ReplayOptions()
Initializes instance with default values.
Definition Replay.h:104
X2SpeedReplay()
Initializes instance with default values.
Definition Replay.h:202
X2SpeedReplay(const std::string &filesRoot, const std::string &filesExtention=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:193