OnixS C++ CME MDP Conflated UDP Handler 1.1.2
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
28
31
33
35
37(
38 NetFeedListener
39);
40
42(
43 NetFeedConsumer
44);
45
58
61{
62 typedef
63 Atomic<NetFeedState::Enum>
64 AtomicState;
65
66 mutable volatile NetFeedState::Enum state_;
67
68 NetFeedConsumer* consumer_;
69 NetFeedListener* listener_;
70
71 NetFeedLink* link_;
72
73 TimeSpan receiveTimeout_;
74 TimeSpan expirationTime_;
75
76 NetFeedConnection connection_;
77
80
81 NetFeedId id_;
82
83 NetFeed(
84 const NetFeed&);
85
86 NetFeed&
87 operator =(
88 const NetFeed&);
89
90public:
93 : state_(
94 NetFeedState::Disconnected)
95 , consumer_(NULL)
96 , listener_(NULL)
97 , link_(NULL)
98 {
99 }
100
102 {
103 assert(
104 state() ==
106
107 if (link_)
108 link_->release(*this);
109 }
110
112 const NetFeedId& id() const
113 {
114 return id_;
115 }
116
118 void
120 const NetFeedId& id)
121 {
122 id_ = id;
123 }
124
127 {
128 return type_;
129 }
130
132 void
135 {
136 type_ = type;
137 }
138
141 {
142 return role_;
143 }
144
146 void
149 {
150 role_ = role;
151 }
152
155 {
156 return connection_;
157 }
158
160 const
163 {
164 return connection_;
165 }
166
174 const
175 TimeSpan&
177 {
178 return expirationTime_;
179 }
180
188 void
191 {
192 expirationTime_ =
193 TimeSpan(
194 0,
195 0,
197 0);
198 }
199
201 const
202 TimeSpan&
204 {
205 return receiveTimeout_;
206 }
207
209 void
211 UInt32 timeInterval)
212 {
213 receiveTimeout_ =
214 TimeSpan(
215 0,
216 0,
217 timeInterval,
218 0);
219 }
220
223 {
224 return AtomicState::read(state_);
225 }
226
228 void
231 {
232 assert(
233 state() ==
235
236 listener_ = &listener;
237 }
238
242 consumer() const
243 {
244 return consumer_;
245 }
246
248 void
251 {
252 assert(
253 state() ==
255
256 assert(NULL == link_);
257
258 consumer_ = &consumer;
259 }
260
262 void
265 {
266 assert(
267 state() ==
269
270 NetFeedLink* old = link_;
271
272 link_ = &link;
273
274 if (old)
275 old->release(*this);
276 }
277
288 bool
290 UInt32);
291
299 bool
301
307 void
309 const void* message,
310 size_t length,
311 UInt32 timeout)
312 {
313 assert(NULL != link_);
314
315 link_->send
316 (
317 *this,
318 message,
319 length,
320 timeout
321 );
322 }
323};
324
#define ONIXS_CONFLATEDUDP_LTWT_EXPORTED
Definition Bootstrap.h:103
#define ONIXS_CONFLATEDUDP_LTWT_STRUCT
Definition Bootstrap.h:99
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:47
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_EXPORTED_STRUCT_DECL(typeName)
Definition Bootstrap.h:51
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
Network feed connection attributes.
NetFeedConsumer * consumer() const
Definition Feed.h:242
const TimeSpan & expirationTime() const
Definition Feed.h:176
void type(NetFeedType::Enum type)
Assigns feed service type.
Definition Feed.h:133
void expirationTime(UInt32 expirationTime)
Definition Feed.h:189
void role(NetFeedRole::Enum role)
Assigns feed service role.
Definition Feed.h:147
void receiveTimeout(UInt32 timeInterval)
Updates time interval between two packets transmitted.
Definition Feed.h:210
ONIXS_CONFLATEDUDP_EXPORTED bool connect(UInt32)
void id(const NetFeedId &id)
Assigns identifier.
Definition Feed.h:119
const NetFeedConnection & connection() const
Connection attributes (read-only access).
Definition Feed.h:162
void link(NetFeedLink &link)
Associates the given link with the feed.
Definition Feed.h:263
NetFeedRole::Enum role() const
Role in a service (primary, secondary).
Definition Feed.h:140
void consumer(NetFeedConsumer &consumer)
Binds the given consumer to the feed.
Definition Feed.h:249
void sendMessage(const void *message, size_t length, UInt32 timeout)
Definition Feed.h:308
NetFeedConnection & connection()
Connection attributes (overload for modifications).
Definition Feed.h:154
NetFeedState::Enum state() const
Indicates current state.
Definition Feed.h:222
NetFeedType::Enum type() const
Type of service (incremental, instrument, etc).
Definition Feed.h:126
const NetFeedId & id() const
Identifier associated with feed.
Definition Feed.h:112
NetFeed()
Initializes the instance.
Definition Feed.h:92
const TimeSpan & receiveTimeout() const
Maximal time interval between two packets transmitted.
Definition Feed.h:203
ONIXS_CONFLATEDUDP_EXPORTED bool disconnect()
void listener(NetFeedListener &listener)
Binds the given listener to the feed.
Definition Feed.h:229
std::string NetFeedId
The feed identifier.
UInt32 UInt32
uInt32.
Definition Fields.h:261
Defines possible states for the feeds.
Definition Feed.h:48
Enum
Defines possible states for the feeds.
Definition Feed.h:51
Enum
Feed types based on type of market data service.