OnixS C++ B3 Binary UMDF Market Data Handler 1.10.0
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#pragma once
19
21
22#include <vector>
23#include <string>
24
25namespace OnixS
26{
27 namespace B3
28 {
29 namespace MarketData
30 {
31 namespace UMDF
32 {
34 typedef std::vector<std::string> HandlerLogs;
35
37 typedef std::vector<std::string>::iterator HandlerLogsEntry;
38
40 class ONIXS_B3_UMDF_MD_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_B3_UMDF_MD_API ReplayMode
57 {
69 };
70
71
74 typedef std::vector<std::string> FilesList;
75
77 void ONIXS_B3_UMDF_MD_API gatherFiles(FilesList* gatheredFiles, const std::string& root, const std::string& extension);
78
80 inline
81 void gatherLogs(FilesList* gatheredLogs, const std::string& root)
82 {
83 gatherFiles(gatheredLogs, root, ".log");
84 }
85
88 {
92
95
99 unsigned int packetReplayDelay = 0;
100
103
106
109 : listener(defaultReplayListener())
110 {
111 }
112
114 explicit
115 ReplayOptions (const std::string& filesRoot, const std::string& extension = ".log")
116 : listener(defaultReplayListener())
117 {
118 gatherFiles(&files, filesRoot, extension);
119 }
120
121 private:
122 ONIXS_B3_UMDF_MD_API static ReplayListener* defaultReplayListener();
123 };
124 }
125 }
126 }
127}
Listening interface for log replay-related events.
Definition Replay.h:41
virtual void onReplayFinished()=0
Is called once all the logs are replayed.
virtual void onReplayError(const std::string &errorDescription)=0
Is called once an error occurs while replaying logs.
virtual ~ReplayListener()
Deletion is not supposed through interface of this class.
std::vector< std::string > FilesList
Ordered list of files to be replayed.
Definition Replay.h:74
std::vector< std::string > HandlerLogs
Ordered list of logs to be replayed.
Definition Replay.h:34
void gatherLogs(FilesList *gatheredLogs, const std::string &root)
Gathers log files which are stored in a given folder.
Definition Replay.h:81
std::vector< std::string >::iterator HandlerLogsEntry
Read-write iterator over ordered list of logs to be replayed.
Definition Replay.h:37
void ONIXS_B3_UMDF_MD_API gatherFiles(FilesList *gatheredFiles, const std::string &root, const std::string &extension)
Gathers files which are stored in a given folder.
@ ConstantPacketReplayDelay
The packets are replayed with constant delay, defined by ReplayOptions::packetReplayDelay Timestamps ...
Definition Replay.h:63
@ NaturalPacketReplayDelay
The packets are replayed with delays as it comes from the replayed file.
Definition Replay.h:67
ReplayMode::Enum replayMode
Replay mode.
Definition Replay.h:105
FilesList files
List of files to be replayed.
Definition Replay.h:91
unsigned int packetReplayDelay
Specifies the time delay (milliseconds) between replayed packets.
Definition Replay.h:99
ReplayListener * listener
Instance to notify about replay events.
Definition Replay.h:94
float playSpeedMultiplier
Replay multiplier. Used only in ReplayMode::NaturalPacketReplayDelay.
Definition Replay.h:102
ReplayOptions(const std::string &filesRoot, const std::string &extension=".log")
Initializes with all the files which are available and stored in a given folder.
Definition Replay.h:115
ReplayOptions()
Initializes instance with default values.
Definition Replay.h:108