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