OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
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 #include <OnixS/SgxTitan/MarketData/Itch/Bootstrap.h>
23 
24 #include <vector>
25 #include <string>
26 
27 ONIXS_SGXTITAN_ITCH_NAMESPACE_BEGIN
28 
29 /// Ordered list of logs to be replayed.
30 typedef std::vector<std::string> HandlerLogs;
31 
32 /// Read-write iterator over ordered list of logs to be replayed.
33 typedef std::vector<std::string>::iterator HandlerLogsEntry;
34 
35 /// Listening interface for log replay-related events.
36 class ONIXS_SGXTITAN_ITCH_API ReplayListener
37 {
38  public:
39  /// Is called once error occurs while replaying logs.
40  virtual void onReplayError (const std::string& errorDescription) = 0;
41 
42  /// Is called once all the logs are replayed.
43  virtual void onReplayFinished() = 0;
44 
45  protected:
46  /// Deletion is not supposed
47  /// through interface of this class.
48  virtual ~ReplayListener();
49 };
50 
51 /// Gathers log files logs which are stored in a given folder.
52 void ONIXS_SGXTITAN_ITCH_API gatherLogs(HandlerLogs* gatheredLogs, const std::string& root);
53 
54 /// Defines ONIXS_SGXTITAN_ITCH_API which affect logs replay.
56 {
57  /// List of instruments logs to be replayed.
58  /// Must be stored in 'oldest to recent' order.
60 
61  /// Instance to notify about replay events.
63 
64  /// Specifies the time delay (milliseconds) between replayed packets.
65  ///
66  /// @note Ability to control log replay rate. The default value is 0 milliseconds.
67  unsigned int packetReplayDelay;
68 
69  /// Initializes instance with default values.
71  : listener(ONIXS_SGXTITAN_ITCH_NULLPTR)
72  , packetReplayDelay(0)
73  {
74  }
75 
76  /// Initializes with all the logs which are available
77  /// and are stored in a given folder.
78  explicit
79  ReplayOptions(const std::string& logsRoot)
80  : listener(ONIXS_SGXTITAN_ITCH_NULLPTR)
81  , packetReplayDelay(0)
82  {
83  gatherLogs(&logs, logsRoot);
84  }
85 };
86 
87 ONIXS_SGXTITAN_ITCH_NAMESPACE_END
std::vector< std::string >::iterator HandlerLogsEntry
Read-write iterator over ordered list of logs to be replayed.
Definition: Replay.h:33
ReplayOptions()
Initializes instance with default values.
Definition: Replay.h:70
ReplayListener * listener
Instance to notify about replay events.
Definition: Replay.h:62
Listening interface for log replay-related events.
Definition: Replay.h:36
void ONIXS_SGXTITAN_ITCH_API gatherLogs(HandlerLogs *gatheredLogs, const std::string &root)
Gathers log files logs which are stored in a given folder.
Definition: Replay.cpp:34
Defines ONIXS_SGXTITAN_ITCH_API which affect logs replay.
Definition: Replay.h:55
ReplayOptions(const std::string &logsRoot)
Definition: Replay.h:79
std::vector< std::string > HandlerLogs
Ordered list of logs to be replayed.
Definition: Replay.h:30