OnixS C++ CME Market Data Handler  5.4.0
API documentation
FeedConsumer.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <OnixS/CME/MDH/String.h>
24 
26 
27 // A bit of forward declarations.
28 
31 
32 /// Represents an interface through which the
33 /// Feed Engine pushes market data received for
34 /// the feeds.
36 {
38  const NetFeedConsumer&);
39 
41  operator =(
42  const NetFeedConsumer&);
43 
44 protected:
45  /// Protected construction for descendants.
47  {
48  }
49 
50  /// Lifetime of the instance is not maintained
51  /// through the interface of the given class.
52  virtual ~NetFeedConsumer()
53  {
54  }
55 
56 public:
57  /// Tries to gain access to the given consumer.
58  ///
59  /// Before invoking any other member, the consumer
60  /// must be successfully acquired. This is because
61  /// the consumer may be busy while handling the other
62  /// event from the other source.
63  virtual
64  bool
65  tryAcquire() = 0;
66 
67  /// Releases previously acquired consumer.
68  virtual
69  void
70  release() = 0;
71 
72  /// Invoked by the feed engine machinery
73  /// when a packet is received for the feed
74  /// associated with the given consumer.
75  ///
76  /// The given member must be invoked only when
77  /// the consumer was already successfully acquired.
78  virtual
79  void
80  onPacket(
81  const NetPacket&) = 0;
82 
83  /// Invoked by the feed engine machinery
84  /// when any packet wasn't received for the
85  /// feed associated with the given consumer
86  /// for a predefined amount of time.
87  ///
88  /// The given member must be invoked only when
89  /// the consumer was already successfully acquired.
90  virtual
91  void
92  onTimeout(
93  const NetFeed&) = 0;
94 
95  /// Invoked by the feed engine machinery
96  /// when the feed associated with the given
97  /// consumer has reached its expiration time.
98  /// The expiration time for the feed is defined
99  /// by the 'expirationTime' member.
100  ///
101  /// The given member must be invoked only when
102  /// the consumer was already successfully acquired.
103  virtual
104  void
105  onExpiration(
106  const NetFeed&) = 0;
107 
108  /// Invoked by the feed engine machinery when
109  /// it experienced an issue while receiving data
110  /// for the feed associated with the given consumer.
111  ///
112  /// The given member must be invoked only when
113  /// the consumer was already successfully acquired.
114  virtual
115  void
116  onFailure(
117  const NetFeed&,
118  const Char*) = 0;
119 };
120 
char Char
Character type alias.
Definition: String.h:36
Base attributes of market data feed.
Definition: Feed.h:60
#define ONIXS_CMEMDH_EXPORTED_CLASS
Definition: Bootstrap.h:54
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:106
NetFeedConsumer()
Protected construction for descendants.
Definition: FeedConsumer.h:46
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156