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