OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
Message.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 <cstdlib>
24
26
29
31
44
45typedef
48
53{
56 virtual
57 Field
59 const GroupEntrySource&,
60 Tag) const = 0;
61};
62
66GroupEntry : public FieldSet
67{
68 GroupEntrySource binary_;
69 const GroupEntryAccessor* accessor_;
70
71protected:
72 friend
74 (
75 Group
76 );
77
81 const GroupEntrySource& binary,
82 const GroupEntryAccessor& accessor)
83 : binary_(binary)
84 , accessor_(&accessor)
85 {
86 }
87
88public:
92 : binary_()
93 , accessor_(NULL)
94 {
95 }
96
100 const GroupEntry& other)
101 : binary_(other.binary_)
102 , accessor_(other.accessor_)
103 {
104 }
105
108 operator bool() const
109 {
110 return (NULL != accessor_);
111 }
112
116 Field operator [](Tag tag) const
117 {
118 return this->field(tag);
119 }
120
124 Field field(Tag tag) const
125 {
126 assert(NULL != accessor_);
127
128 return accessor_->field(binary_, tag);
129 }
130
133 GroupEntry&
134 operator =(
135 const GroupEntry& other)
136 {
137 binary_ = other.binary_;
138 accessor_ = other.accessor_;
139
140 return *this;
141 }
142};
143
144typedef
146<
147 GroupEntrySource,
151>
153
157{
158 GroupEntriesSource binary_;
159 const GroupEntryAccessor* accessor_;
160
161protected:
164 const GroupEntriesSource& binary,
165 const GroupEntryAccessor& accessor)
166 : binary_(binary)
167 , accessor_(&accessor)
168 {
169 }
170
171public:
173 typedef
176
180 : accessor_(NULL)
181 {
182 }
183
186 const Group& other)
187 : binary_(other.binary_)
188 , accessor_(other.accessor_)
189 {
190 }
191
194 operator bool() const
195 {
196 return (NULL != accessor_);
197 }
198
201 Size size() const
202 {
203 return binary_.size();
204 }
205
209 operator [](
210 Size index) const
211 {
212 assert(NULL != accessor_);
213
214 return
216 binary_[index],
217 *accessor_);
218 }
219
221 Group&
222 operator =(
223 const Group& other)
224 {
225 binary_ = other.binary_;
226 accessor_ = other.accessor_;
227
228 return *this;
229 }
230};
231
236{
238 virtual
239 StrRef
240 type() const = 0;
241
243 virtual
244 Field
246 const BinaryMessage&,
247 Tag) const = 0;
248
250 virtual
251 Group
253 const BinaryMessage&,
254 Tag) const = 0;
255
258 virtual
259 void
261 std::string&,
262 const BinaryMessage&) const = 0;
263};
264
268Message : public FieldSet
269{
270 BinaryMessage binary_;
271 const MessageAccessor* accessor_;
272
273protected:
276 const BinaryMessage& binary,
277 const MessageAccessor& accessor)
278 : binary_(binary), accessor_(&accessor)
279 {
280 }
281
282public:
286 : binary_()
287 , accessor_(NULL)
288 {
289 }
290
293 const Message& other)
294 : binary_(other.binary_)
295 , accessor_(other.accessor_)
296 {
297 }
298
300 operator bool() const
301 {
302 return (NULL != accessor_);
303 }
304
306 StrRef type() const
307 {
308 assert(NULL != accessor_);
309
310 return accessor_->type();
311 }
312
322 Field operator [](Tag tag) const
323 {
324 return this->field(tag);
325 }
326
336 Field field(Tag tag) const
337 {
338 assert(NULL != accessor_);
339
340 return accessor_->field(binary_, tag);
341 }
342
347 Group group(Tag tag) const
348 {
349 assert(NULL != accessor_);
350
351 return accessor_->group(binary_, tag);
352 }
353
355 void
357 std::string& str) const
358 {
359 assert(NULL != accessor_);
360
361 accessor_->toFix(str, binary_);
362 }
363
365 Message&
366 operator =(
367 const Message& other)
368 {
369 binary_ = other.binary_;
370 accessor_ = other.accessor_;
371
372 return *this;
373 }
374};
375
377inline
378void
380 std::string& str,
381 const Message& message)
382{
383 message.toFix(str);
384}
385
387inline
388std::string
390 const Message& message)
391{
392 std::string str;
393
394 toStr(str, message);
395
396 return str;
397}
398
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDPFIX_NAMESPACE_BEGIN
Definition Bootstrap.h:161
#define ONIXS_CONFLATEDUDPFIX_NAMESPACE_END
Definition Bootstrap.h:165
#define ONIXS_CONFLATEDUDP_EXPORTED_STRUCT
Definition Bootstrap.h:59
#define ONIXS_CONFLATEDUDP_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:107
Encapsulates operations over SBE-encoded repeating group entries.
Encapsulates services for manipulating SBE-encoded messages.
GroupEntry(const GroupEntrySource &binary, const GroupEntryAccessor &accessor)
Definition Message.h:80
GroupEntry(const GroupEntry &other)
Definition Message.h:99
Group(const GroupEntriesSource &binary, const GroupEntryAccessor &accessor)
Initializes the instance over the binary data.
Definition Message.h:163
GroupEntriesSource::Size Size
Number of repeating group entries.
Definition Message.h:175
Group(const Group &other)
Initializes as the copy of the other instance.
Definition Message.h:185
Message(const BinaryMessage &binary, const MessageAccessor &accessor)
Initializes the instance from the SBE-encoded message.
Definition Message.h:275
StrRef type() const
FIX message type.
Definition Message.h:306
Message(const Message &other)
Initializes as the copy of the other instance.
Definition Message.h:292
void toFix(std::string &str) const
Builds the FIX (tag=value) representation.
Definition Message.h:356
BinaryGroupEntry< MessageSize > GroupEntrySource
Definition Message.h:47
void toStr(std::string &str, const Message &message)
Serializes FIX message into tag=value format.
Definition Message.h:379
BinaryGroupEntries< GroupEntrySource, MessageSize, MessageSize, MessageSize > GroupEntriesSource
Definition Message.h:152
UInt16 MessageSize
Aliases message length type.
virtual Field field(Tag) const =0
virtual Field field(const GroupEntrySource &, Tag) const =0
virtual Field field(const BinaryMessage &, Tag) const =0
Returns field value by its tag.
virtual void toFix(std::string &, const BinaryMessage &) const =0
virtual Group group(const BinaryMessage &, Tag) const =0
Accesses a repeating group by its tag.
virtual StrRef type() const =0
FIX message type.