OnixS C++ CME MDP Premium Market Data Handler  5.9.0
API Documentation
Composites.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/Memory.h>
24 #include <OnixS/CME/MDH/Decimal.h>
25 #include <OnixS/CME/MDH/Fields.h>
26 
28 ONIXS_CMEMDH_DATA_PACKING_BEGIN(1)
29 
30 /// Decimal with constant exponent -9.
32 
33 /// Null values definition for optional Decimal9 field.
35 {
36  /// Aliases the type whose null value
37  /// traits are exposed by the given class.
38  typedef Decimal9 Value;
39 
40  /// Null value for optional Mantissa field.
42 
43  /// Compares encoded data to NULL.
44  bool operator==(const Value& other) const
45  {
46  return (NullMantissa() == other.mantissa());
47  }
48 
49  /// Compares encoded data to NULL.
50  bool operator!=(const Value& other) const
51  {
52  return !(*this == other);
53  }
54 };
55 
56 /// A number representing quantity.
57 ///
58 /// FIX type: Qty.
60 
61 /// Null values definition for optional DecimalQty field.
63 {
64  /// Aliases the type whose null value
65  /// traits are exposed by the given class.
66  typedef DecimalQty Value;
67 
68  /// Null value for optional Mantissa field.
70 
71  /// Compares encoded data to NULL.
72  bool operator==(const Value& other) const
73  {
74  return (NullMantissa() == other.mantissa());
75  }
76 
77  /// Compares encoded data to NULL.
78  bool operator!=(const Value& other) const
79  {
80  return !(*this == other);
81  }
82 };
83 
84 /// Year, Month and Date.
85 ///
86 /// FIX type: MonthYear.
88 {
89 public:
90  /// Size of composite.
91  enum
92  {
93  Size = 5
94  };
95 
96  /// YYYY.
97  typedef UInt16 Year;
98 
99  /// Null value for optional Year field.
101 
102  /// MM.
103  typedef UInt8 Month;
104 
105  /// Null value for optional Month field.
107 
108  /// DD.
109  typedef UInt8 Day;
110 
111  /// Null value for optional Day field.
113 
114  /// WW.
115  typedef UInt8 Week;
116 
117  /// Null value for optional Week field.
119 
120  /// Default constructor.
121  ///
122  /// Initializes fields with appropriate null values.
124  : year_(NullYear::value())
125  , month_(NullMonth::value())
126  , day_(NullDay::value())
127  , week_(NullWeek::value())
128  {
129  }
130 
131  /// YYYY.
132  Year year() const
133  {
134  return year_;
135  }
136 
137  /// MM.
138  bool month(Month& value) const
139  {
140  if (NullMonth() == month_)
141  return false;
142  value = month_;
143  return true;
144  }
145 
146  /// DD.
147  bool day(Day& value) const
148  {
149  if (NullDay() == day_)
150  return false;
151  value = day_;
152  return true;
153  }
154 
155  /// WW.
156  bool week(Week& value) const
157  {
158  if (NullWeek() == week_)
159  return false;
160  value = week_;
161  return true;
162  }
163 
164 private:
165  Year year_;
166  Month month_;
167  Day day_;
168  Week week_;
169 };
170 
171 /// Null values definition for optional MaturityMonthYear field.
173 {
174  /// Aliases the type whose null value
175  /// traits are exposed by the given class.
177 
178  /// Compares encoded data to NULL.
179  bool operator==(const Value& other) const
180  {
181  return (MaturityMonthYear::NullYear() == other.year());
182  }
183 
184  /// Compares encoded data to NULL.
185  bool operator!=(const Value& other) const
186  {
187  return !(*this == other);
188  }
189 };
190 
191 /// Price with constant exponent -9.
193 
194 /// Null values definition for optional PRICE9 field.
196 {
197  /// Aliases the type whose null value
198  /// traits are exposed by the given class.
199  typedef PRICE9 Value;
200 
201  /// Null value for optional Mantissa field.
203 
204  /// Compares encoded data to NULL.
205  bool operator==(const Value& other) const
206  {
207  return (NullMantissa() == other.mantissa());
208  }
209 
210  /// Compares encoded data to NULL.
211  bool operator!=(const Value& other) const
212  {
213  return !(*this == other);
214  }
215 };
216 
217 /// Repeating group dimensions.
218 ///
219 /// FIX type: NumInGroup.
221 {
222 public:
223  /// Size of composite.
224  enum
225  {
226  Size = 3
227  };
228 
229  /// blockLength type.
231 
232  /// numInGroup type.
233  typedef UInt8 NumInGroup;
234 
235  /// Default constructor.
236  ///
237  /// Initializes fields with zero values.
239  : blockLength_(0)
240  , numInGroup_(0)
241  {
242  }
243 
244  /// blockLength field.
245  BlockLength blockLength() const
246  {
247  return blockLength_;
248  }
249 
250  /// numInGroup field.
251  NumInGroup numInGroup() const
252  {
253  return numInGroup_;
254  }
255 
256 private:
257  BlockLength blockLength_;
258  NumInGroup numInGroup_;
259 };
260 
261 /// 8 Byte aligned repeating group dimensions.
262 ///
263 /// FIX type: NumInGroup.
265 {
266 public:
267  /// Size of composite.
268  enum
269  {
270  Size = 8
271  };
272 
273  /// Length.
275 
276  /// NumInGroup.
277  typedef UInt8 NumInGroup;
278 
279  /// Default constructor.
280  ///
281  /// Initializes fields with zero values.
283  : blockLength_(0)
284  , numInGroup_(0)
285  {
286  }
287 
288  /// Length.
289  BlockLength blockLength() const
290  {
291  return blockLength_;
292  }
293 
294  /// NumInGroup.
295  NumInGroup numInGroup() const
296  {
297  return numInGroup_;
298  }
299 
300 private:
301  BlockLength blockLength_;
302  ONIXS_CMEMDH_PADDING(5);
303  NumInGroup numInGroup_;
304 };
305 
306 /// Repeating group dimensions.
308 {
309 public:
310  /// Size of composite.
311  enum
312  {
313  Size = 4
314  };
315 
316  /// blockLength type.
317  ///
318  /// FIX type: Length.
320 
321  /// numInGroup type.
322  ///
323  /// FIX type: NumInGroup.
325 
326  /// Default constructor.
327  ///
328  /// Initializes fields with zero values.
330  : blockLength_(0)
331  , numInGroup_(0)
332  {
333  }
334 
335  /// blockLength field.
336  ///
337  /// FIX type: Length.
338  BlockLength blockLength() const
339  {
340  return blockLength_;
341  }
342 
343  /// numInGroup field.
344  ///
345  /// FIX type: NumInGroup.
346  NumInGroup numInGroup() const
347  {
348  return numInGroup_;
349  }
350 
351 private:
352  BlockLength blockLength_;
353  NumInGroup numInGroup_;
354 };
355 
356 /// Template ID and length of message root.
358 {
359 public:
360  /// Size of composite.
361  enum
362  {
363  Size = 8
364  };
365 
366  /// blockLength type.
368 
369  /// templateId type.
371 
372  /// schemaId type.
373  typedef UInt16 SchemaId;
374 
375  /// version type.
376  typedef UInt16 Version;
377 
378  /// Default constructor.
379  ///
380  /// Initializes fields with zero values.
382  : blockLength_(0)
383  , templateId_(0)
384  , schemaId_(0)
385  , version_(0)
386  {
387  }
388 
389  /// blockLength field.
390  BlockLength blockLength() const
391  {
392  return blockLength_;
393  }
394 
395  /// templateId field.
396  TemplateId templateId() const
397  {
398  return templateId_;
399  }
400 
401  /// schemaId field.
402  SchemaId schemaId() const
403  {
404  return schemaId_;
405  }
406 
407  /// version field.
408  Version version() const
409  {
410  return version_;
411  }
412 
413 private:
414  BlockLength blockLength_;
415  TemplateId templateId_;
416  SchemaId schemaId_;
417  Version version_;
418 };
419 
420 ONIXS_CMEMDH_DATA_PACKING_END
Int32 Int32
int32.
Definition: Fields.h:60
bool operator!=(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:185
IntegralConstant< UInt16, 65535 > NullYear
Null value for optional Year field.
Definition: Composites.h:100
Repeating group dimensions.
Definition: Composites.h:307
MaturityMonthYear()
Default constructor.
Definition: Composites.h:123
UInt16 BlockLength
blockLength type.
Definition: Composites.h:367
GroupSize8Byte()
Default constructor.
Definition: Composites.h:282
Null values definition for optional PRICE9 field.
Definition: Composites.h:195
IntegralConstant< UInt8, 255 > NullDay
Null value for optional Day field.
Definition: Composites.h:112
Null values definition for optional Decimal9 field.
Definition: Composites.h:34
MessageHeader()
Default constructor.
Definition: Composites.h:381
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:245
bool operator==(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:72
UInt16 BlockLength
blockLength type.
Definition: Composites.h:230
Represents real number with constant exponent.
Definition: Decimal.h:37
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
MaturityMonthYear Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:176
UInt8 NumInGroup
numInGroup type.
Definition: Composites.h:233
Null values definition for optional MaturityMonthYear field.
Definition: Composites.h:172
IntegralConstant< Int32, 2147483647 > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:69
FixedPointDecimal< Int64, IntegralConstant< Int8,-9 > > PRICE9
Price with constant exponent -9.
Definition: Composites.h:192
Null values definition for optional DecimalQty field.
Definition: Composites.h:62
UInt8 UInt8
uInt8.
Definition: Fields.h:208
bool month(Month &value) const
MM.
Definition: Composites.h:138
bool operator==(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:179
NumInGroup numInGroup() const
NumInGroup.
Definition: Composites.h:295
bool value(Number &number, const MultiContainer &container, Tag tag)
Finds a tag-value entry in the given collection by the given tag and returns its value component tran...
PRICE9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:199
Year, Month and Date.
Definition: Composites.h:87
TemplateId templateId() const
templateId field.
Definition: Composites.h:396
GroupSizeEncoding()
Default constructor.
Definition: Composites.h:329
DecimalQty Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:66
bool week(Week &value) const
WW.
Definition: Composites.h:156
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:338
IntegralConstant< UInt8, 255 > NullMonth
Null value for optional Month field.
Definition: Composites.h:106
Version version() const
version field.
Definition: Composites.h:408
UInt8 NumInGroup
NumInGroup.
Definition: Composites.h:277
bool operator==(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:205
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
bool day(Day &value) const
DD.
Definition: Composites.h:147
NumInGroup numInGroup() const
numInGroup field.
Definition: Composites.h:251
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:202
bool operator!=(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:50
Mantissa mantissa() const
Returns mantissa of given decimal.
Definition: Decimal.h:71
UInt16 TemplateId
templateId type.
Definition: Composites.h:370
8 Byte aligned repeating group dimensions.
Definition: Composites.h:264
bool operator!=(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:78
UInt16 Version
version type.
Definition: Composites.h:376
UInt16 NumInGroup
numInGroup type.
Definition: Composites.h:324
IntegralConstant< UInt8, 255 > NullWeek
Null value for optional Week field.
Definition: Composites.h:118
BlockLength blockLength() const
Length.
Definition: Composites.h:289
Template ID and length of message root.
Definition: Composites.h:357
FixedPointDecimal< Int32, IntegralConstant< Int8,-4 > > DecimalQty
A number representing quantity.
Definition: Composites.h:59
GroupSize()
Default constructor.
Definition: Composites.h:238
bool operator!=(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:211
UInt16 UInt16
uInt16.
Definition: Fields.h:199
Repeating group dimensions.
Definition: Composites.h:220
bool operator==(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:44
Int8 Int8
int8.
Definition: Fields.h:63
NumInGroup numInGroup() const
numInGroup field.
Definition: Composites.h:346
UInt16 SchemaId
schemaId type.
Definition: Composites.h:373
Decimal9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:38
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:41
SchemaId schemaId() const
schemaId field.
Definition: Composites.h:402
Integral constant.
Definition: Integral.h:83
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:390
UInt16 BlockLength
blockLength type.
Definition: Composites.h:319
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68