OnixS C++ CME MDP Premium Market Data Handler 5.9.0
API Documentation
Loading...
Searching...
No Matches
Feed.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 <cassert>
24#include <string>
25
27#include <OnixS/CME/MDH/Time.h>
28
31
33
35
37
39
52
55{
56public:
59 : state_(NetFeedState::Disconnected)
60 , consumer_(ONIXS_CMEMDH_NULLPTR)
61 , listener_(ONIXS_CMEMDH_NULLPTR)
63 {
64 }
65
67 {
69
70 if (link_)
71 link_->release(*this);
72 }
73
75 const NetFeedId& id() const
76 {
77 return id_;
78 }
79
81 void id(const NetFeedId& id)
82 {
83 id_ = id;
84 }
85
88 {
89 return type_;
90 }
91
94 {
95 type_ = type;
96 }
97
100 {
101 return role_;
102 }
103
106 {
107 role_ = role;
108 }
109
112 {
113 return connection_;
114 }
115
118 {
119 return connection_;
120 }
121
130 {
131 return expirationTime_;
132 }
133
142 {
143 expirationTime_ = TimeSpan(0, 0, expirationTime, 0);
144 }
145
148 {
149 return receiveTimeout_;
150 }
151
153 void receiveTimeout(UInt32 timeInterval)
154 {
155 receiveTimeout_ = TimeSpan(0, 0, timeInterval, 0);
156 }
157
160 {
161 return AtomicState::read(state_);
162 }
163
166 {
168
169 listener_ = &listener;
170 }
171
175 {
176 return consumer_;
177 }
178
181 {
183
184 assert(ONIXS_CMEMDH_NULLPTR == link_);
185
186 consumer_ = &consumer;
187 }
188
191 {
193
194 NetFeedLink* old = link_;
195
196 link_ = &link;
197
198 if (old)
199 old->release(*this);
200 }
201
213
222
228 void sendMessage(const void* message, size_t length, UInt32 timeout)
229 {
230 assert(ONIXS_CMEMDH_NULLPTR != link_);
231
232 link_->send(*this, message, length, timeout);
233 }
234
235private:
236 typedef Atomic<NetFeedState::Enum> AtomicState;
237
238 mutable volatile NetFeedState::Enum state_;
239
240 NetFeedConsumer* consumer_;
241 NetFeedListener* listener_;
242
243 NetFeedLink* link_;
244
245 TimeSpan receiveTimeout_;
246 TimeSpan expirationTime_;
247
248 NetFeedConnection connection_;
249
250 NetFeedType::Enum type_;
251 NetFeedRole::Enum role_;
252
253 NetFeedId id_;
254
255 NetFeed(const NetFeed&);
256
257 NetFeed& operator=(const NetFeed&);
258};
259
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_EXPORTED
Definition Bootstrap.h:47
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:35
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(typeName)
Definition Bootstrap.h:36
#define ONIXS_CMEMDH_NULLPTR
Definition Compiler.h:178
Network feed connection attributes.
Represents an interface through which the Feed Engine pushes market data received for the feeds.
Base attributes of market data feed.
Definition Feed.h:55
NetFeedConsumer * consumer() const
An instance of data consumer associated with the given feed if available.
Definition Feed.h:174
const TimeSpan & expirationTime() const
Life time for the feed.
Definition Feed.h:129
void type(NetFeedType::Enum type)
Assigns feed service type.
Definition Feed.h:93
bool disconnect()
Instructs the feed to stop delivering packets to the associated consumer.
void expirationTime(UInt32 expirationTime)
Defines life time for the feed in seconds.
Definition Feed.h:141
void role(NetFeedRole::Enum role)
Assigns feed service role.
Definition Feed.h:105
void receiveTimeout(UInt32 timeInterval)
Updates time interval between two packets transmitted.
Definition Feed.h:153
void id(const NetFeedId &id)
Assigns identifier.
Definition Feed.h:81
const NetFeedConnection & connection() const
Connection attributes (read-only access).
Definition Feed.h:117
void link(NetFeedLink &link)
Associates the given link with the feed.
Definition Feed.h:190
NetFeedRole::Enum role() const
Role in a service (primary, secondary).
Definition Feed.h:99
bool connect(UInt32)
Bring the given instance to the connected state.
void consumer(NetFeedConsumer &consumer)
Binds the given consumer to the feed.
Definition Feed.h:180
void sendMessage(const void *message, size_t length, UInt32 timeout)
Send the given message to the source from which the feed receives data and delivers to the associated...
Definition Feed.h:228
NetFeedConnection & connection()
Connection attributes (overload for modifications).
Definition Feed.h:111
NetFeedState::Enum state() const
Indicates current state.
Definition Feed.h:159
NetFeedType::Enum type() const
Type of service (incremental, instrument, etc).
Definition Feed.h:87
const NetFeedId & id() const
Identifier associated with feed.
Definition Feed.h:75
NetFeed()
Initializes the instance.
Definition Feed.h:58
const TimeSpan & receiveTimeout() const
Maximal time interval between two packets transmitted.
Definition Feed.h:147
void listener(NetFeedListener &listener)
Binds the given listener to the feed.
Definition Feed.h:165
Represents time interval.
Definition Time.h:105
std::string NetFeedId
The feed identifier.
UInt32 UInt32
uInt32.
Definition Fields.h:202
Collection of the events raised by the NetFeed at various stages of its lifetime.
Enum
List of known feed roles.
Defines possible states for the feeds.
Definition Feed.h:42
Enum
Defines possible states for the feeds.
Definition Feed.h:45
Enum
Feed types based on type of market data service.