OnixS C++ CME MDP Premium Market Data Handler 5.9.0
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
36{
42 virtual Field field(Tag) const = 0;
43};
44
46
50{
53 virtual Field field(const GroupEntrySource&, Tag) const = 0;
54};
55
59{
60 GroupEntrySource binary_;
61 const GroupEntryAccessor* accessor_;
62
63protected:
65
68 GroupEntry(const GroupEntrySource& binary, const GroupEntryAccessor& accessor)
69 : binary_(binary)
70 , accessor_(&accessor)
71 {
72 }
73
74public:
78 : binary_()
79 , accessor_(ONIXS_CMEMDH_NULLPTR)
80 {
81 }
82
85 GroupEntry(const GroupEntry& other)
86 : binary_(other.binary_)
87 , accessor_(other.accessor_)
88 {
89 }
90
93 operator bool() const
94 {
95 return (ONIXS_CMEMDH_NULLPTR != accessor_);
96 }
97
102 {
103 return this->field(tag);
104 }
105
110 {
111 assert(ONIXS_CMEMDH_NULLPTR != accessor_);
112
113 return accessor_->field(binary_, tag);
114 }
115
119 {
120 binary_ = other.binary_;
121 accessor_ = other.accessor_;
122
123 return *this;
124 }
125};
126
128
132{
133 GroupEntriesSource binary_;
134 const GroupEntryAccessor* accessor_;
135
136protected:
138 Group(const GroupEntriesSource& binary, const GroupEntryAccessor& accessor)
139 : binary_(binary)
140 , accessor_(&accessor)
141 {
142 }
143
144public:
147
151 : accessor_(ONIXS_CMEMDH_NULLPTR)
152 {
153 }
154
156 Group(const Group& other)
157 : binary_(other.binary_)
158 , accessor_(other.accessor_)
159 {
160 }
161
164 operator bool() const
165 {
166 return (ONIXS_CMEMDH_NULLPTR != accessor_);
167 }
168
171 Size size() const
172 {
173 return binary_.size();
174 }
175
179 {
180 assert(ONIXS_CMEMDH_NULLPTR != accessor_);
181
182 return GroupEntry(binary_[index], *accessor_);
183 }
184
186 Group& operator=(const Group& other)
187 {
188 binary_ = other.binary_;
189 accessor_ = other.accessor_;
190
191 return *this;
192 }
193};
194
198{
200 virtual StrRef type() const = 0;
201
203 virtual Field field(const BinaryMessage&, Tag) const = 0;
204
206 virtual Group group(const BinaryMessage&, Tag) const = 0;
207
210 virtual void toFix(std::string&, const BinaryMessage&) const = 0;
211};
212
216{
217 BinaryMessage binary_;
218 const MessageAccessor* accessor_;
219
220protected:
222 Message(const BinaryMessage& binary, const MessageAccessor& accessor)
223 : binary_(binary)
224 , accessor_(&accessor)
225 {
226 }
227
228public:
232 : binary_()
233 , accessor_(ONIXS_CMEMDH_NULLPTR)
234 {
235 }
236
238 Message(const Message& other)
239 : binary_(other.binary_)
240 , accessor_(other.accessor_)
241 {
242 }
243
245 operator bool() const
246 {
247 return (ONIXS_CMEMDH_NULLPTR != accessor_);
248 }
249
251 StrRef type() const
252 {
253 assert(ONIXS_CMEMDH_NULLPTR != accessor_);
254
255 return accessor_->type();
256 }
257
268 {
269 return this->field(tag);
270 }
271
282 {
283 assert(ONIXS_CMEMDH_NULLPTR != accessor_);
284
285 return accessor_->field(binary_, tag);
286 }
287
292 Group group(Tag tag) const
293 {
294 assert(ONIXS_CMEMDH_NULLPTR != accessor_);
295
296 return accessor_->group(binary_, tag);
297 }
298
300 void toFix(std::string& str) const
301 {
302 assert(ONIXS_CMEMDH_NULLPTR != accessor_);
303
304 accessor_->toFix(str, binary_);
305 }
306
308 Message& operator=(const Message& other)
309 {
310 binary_ = other.binary_;
311 accessor_ = other.accessor_;
312
313 return *this;
314 }
315};
316
318inline void toStr(std::string& str, const Message& message)
319{
320 message.toFix(str);
321}
322
324inline std::string toStr(const Message& message)
325{
326 std::string str;
327
328 toStr(str, message);
329
330 return str;
331}
332
#define ONIXS_CMEMDHFIX_NAMESPACE_BEGIN
Definition Bootstrap.h:70
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:48
#define ONIXS_CMEMDHFIX_NAMESPACE_END
Definition Bootstrap.h:71
#define ONIXS_CMEMDH_NULLPTR
Definition Compiler.h:178
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
#define ONIXS_CMEMDH_OVERRIDE
Definition Compiler.h:176
Encapsulates operations over SBE-encoded repeating group entries.
Encapsulates operations over SBE-encoded repeating group entry instance.
Encapsulates services for manipulating SBE-encoded messages.
Represents the field in the FIX message.
Definition Field.h:33
Provides FIX-like access to the fields stored in a SBE-encoded repeating group.
Definition Message.h:59
Field field(Tag tag) const override
Returns field by its tag.
Definition Message.h:109
Field operator[](Tag tag) const
Returns field by its tag.
Definition Message.h:101
GroupEntry()
Initializes the instance which refers to nothing and thus represents a null instance.
Definition Message.h:77
GroupEntry & operator=(const GroupEntry &other)
Re-initializes as the copy of the other instance.
Definition Message.h:118
GroupEntry(const GroupEntrySource &binary, const GroupEntryAccessor &accessor)
Full-initialized instances are constructed through descendants.
Definition Message.h:68
GroupEntry(const GroupEntry &other)
Initializes the instance as the copy of the other one.
Definition Message.h:85
Implements a FIX repeating group over the SBE-encoded binary data.
Definition Message.h:132
Group()
Initializes the instance which refers to nothing and thus represent a null instance.
Definition Message.h:150
Group & operator=(const Group &other)
Re-initializes as the copy of the other instance.
Definition Message.h:186
Group(const GroupEntriesSource &binary, const GroupEntryAccessor &accessor)
Initializes the instance over the binary data.
Definition Message.h:138
GroupEntry operator[](Size index) const
Provides access to the group entry by its index in the group.
Definition Message.h:178
GroupEntriesSource::Size Size
Number of repeating group entries.
Definition Message.h:146
Group(const Group &other)
Initializes as the copy of the other instance.
Definition Message.h:156
Size size() const
Number of entries in the repeating group being referred by the given instance.
Definition Message.h:171
Implements FIX-like interface over the SBE-encoded message.
Definition Message.h:216
Field field(Tag tag) const override
Returns a field by its tag.
Definition Message.h:281
Message & operator=(const Message &other)
Re-initializes as the copy of the other instance.
Definition Message.h:308
Field operator[](Tag tag) const
Returns a field by its tag.
Definition Message.h:267
Message(const BinaryMessage &binary, const MessageAccessor &accessor)
Initializes the instance from the SBE-encoded message.
Definition Message.h:222
Group group(Tag tag) const
Accesses a repeating group by its tag.
Definition Message.h:292
StrRef type() const
FIX message type.
Definition Message.h:251
Message(const Message &other)
Initializes as the copy of the other instance.
Definition Message.h:238
void toFix(std::string &str) const
Builds the FIX (tag=value) representation.
Definition Message.h:300
Message()
Initializes the message which refers to nothing and thus being a null-instance.
Definition Message.h:231
Provides efficient way of accessing text-based values without copying content of the text being refer...
Definition String.h:42
UInt32 Tag
The type whose values are used to locate fields in the FIX-like messages.
Definition Tag.h:29
BinaryGroupEntry< MessageSize > GroupEntrySource
Definition Message.h:45
void toStr(std::string &str, const Message &message)
Serializes FIX message into tag=value format.
Definition Message.h:318
BinaryGroupEntries< GroupEntrySource, MessageSize, MessageSize, MessageSize > GroupEntriesSource
Definition Message.h:127
The abstraction of a source of FIX information which provides access to the FIX fields by their tags.
Definition Message.h:36
virtual Field field(Tag) const =0
Returns field by its tag.
Provides FIX-like access to the fields stored in a SBE-encoded repeating group.
Definition Message.h:50
virtual Field field(const GroupEntrySource &, Tag) const =0
Provides FIX-like access to the fields stored in a SBE-encoded repeating group.
Implements FIX-like services for the SBE-encoded message.
Definition Message.h:198
virtual Field field(const BinaryMessage &, Tag) const =0
Returns field value by its tag.
virtual void toFix(std::string &, const BinaryMessage &) const =0
Serializes the given message into the FIX (tag=value) presentation.
virtual Group group(const BinaryMessage &, Tag) const =0
Accesses a repeating group by its tag.
virtual StrRef type() const =0
FIX message type.