OnixS C++ CME MDP Premium Market Data Handler  5.8.3
API Documentation
Typification.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/Messages.h>
24 
26 
27 /// Casts SBE-encoded message to given type.
28 template <class Message>
29 inline Message typify(const BinaryMessage& message)
30 {
31  return Message(message.encoded(), message.encodedLength());
32 }
33 
34 /// Casts given binary message according to template/type
35 /// information and processes casted messages by given processor.
36 ///
37 /// Returned value indicates whether message type was successfully
38 /// recognized and pushed to processor for further processing. Unknown
39 /// messages aren't processed and thus false result is returned.
40 template <class Processor>
41 bool processTypified(const BinaryMessage& binary, Processor& processor)
42 {
43  switch (binary.templateId())
44  {
45  case InstrumentDefinitionFixedIncome57::TemplateId:
46  {
47  processor(typify<InstrumentDefinitionFixedIncome57>(binary));
48 
49  return true;
50  }
51 
52  case ChannelReset4::TemplateId:
53  {
54  processor(typify<ChannelReset4>(binary));
55 
56  return true;
57  }
58 
59  case AdminHeartbeat12::TemplateId:
60  {
61  processor(typify<AdminHeartbeat12>(binary));
62 
63  return true;
64  }
65 
66  case AdminLogin15::TemplateId:
67  {
68  processor(typify<AdminLogin15>(binary));
69 
70  return true;
71  }
72 
73  case AdminLogout16::TemplateId:
74  {
75  processor(typify<AdminLogout16>(binary));
76 
77  return true;
78  }
79 
80  case InstrumentDefinitionFuture54::TemplateId:
81  {
82  processor(typify<InstrumentDefinitionFuture54>(binary));
83 
84  return true;
85  }
86 
87  case InstrumentDefinitionSpread56::TemplateId:
88  {
89  processor(typify<InstrumentDefinitionSpread56>(binary));
90 
91  return true;
92  }
93 
94  case SecurityStatus30::TemplateId:
95  {
96  processor(typify<SecurityStatus30>(binary));
97 
98  return true;
99  }
100 
101  case IncrementalRefreshBook46::TemplateId:
102  {
103  processor(typify<IncrementalRefreshBook46>(binary));
104 
105  return true;
106  }
107 
108  case IncrementalRefreshDailyStatistics49::TemplateId:
109  {
110  processor(typify<IncrementalRefreshDailyStatistics49>(binary));
111 
112  return true;
113  }
114 
115  case IncrementalRefreshLimitsBanding50::TemplateId:
116  {
117  processor(typify<IncrementalRefreshLimitsBanding50>(binary));
118 
119  return true;
120  }
121 
122  case IncrementalRefreshSessionStatistics51::TemplateId:
123  {
124  processor(typify<IncrementalRefreshSessionStatistics51>(binary));
125 
126  return true;
127  }
128 
129  case IncrementalRefreshVolume37::TemplateId:
130  {
131  processor(typify<IncrementalRefreshVolume37>(binary));
132 
133  return true;
134  }
135 
136  case SnapshotFullRefresh52::TemplateId:
137  {
138  processor(typify<SnapshotFullRefresh52>(binary));
139 
140  return true;
141  }
142 
143  case QuoteRequest39::TemplateId:
144  {
145  processor(typify<QuoteRequest39>(binary));
146 
147  return true;
148  }
149 
150  case InstrumentDefinitionOption55::TemplateId:
151  {
152  processor(typify<InstrumentDefinitionOption55>(binary));
153 
154  return true;
155  }
156 
157  case IncrementalRefreshTradeSummary48::TemplateId:
158  {
159  processor(typify<IncrementalRefreshTradeSummary48>(binary));
160 
161  return true;
162  }
163 
164  case IncrementalRefreshOrderBook47::TemplateId:
165  {
166  processor(typify<IncrementalRefreshOrderBook47>(binary));
167 
168  return true;
169  }
170 
171  case SnapshotFullRefreshOrderBook53::TemplateId:
172  {
173  processor(typify<SnapshotFullRefreshOrderBook53>(binary));
174 
175  return true;
176  }
177 
178  case AdminLogin408::TemplateId:
179  {
180  processor(typify<AdminLogin408>(binary));
181 
182  return true;
183  }
184 
185  case AdminLogout409::TemplateId:
186  {
187  processor(typify<AdminLogout409>(binary));
188 
189  return true;
190  }
191 
192  case AdminHeartbeat410::TemplateId:
193  {
194  processor(typify<AdminHeartbeat410>(binary));
195 
196  return true;
197  }
198 
199  default:
200  return false;
201  }
202 }
203 
Message typify(const BinaryMessage &message)
Casts SBE-encoded message to given type.
Definition: Typification.h:29
MessageTemplateId templateId() const
Template identifier of message being referenced.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
bool processTypified(const BinaryMessage &binary, Processor &processor)
Casts given binary message according to template/type information and processes casted messages by gi...
Definition: Typification.h:41
Encapsulates services for manipulating SBE-encoded messages.
EncodedLength encodedLength() const
Size of SBE-encoded message.
const void * encoded() const
SBE-encoded message content.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68