OnixS C++ CME Market Data Handler  4.8.0.10
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.
31 typedef
32 FixedPointDecimal
33 <
34  Int64,
35  IntegralConstant<Int8, -9>
36 >
38 
39 
40 /// Null values definition for optional Decimal9 field.
42 {
43  /// Aliases the type whose null value
44  /// traits are exposed by the given class.
45  typedef Decimal9 Value;
46 
47  /// Null value for optional Mantissa field.
48  typedef
51 
52  /// Compares encoded data to NULL.
53  bool
55  const Value& other) const
56  {
57  return (
58  NullMantissa() ==
59  other.mantissa()
60  );
61  }
62 
63  /// Compares encoded data to NULL.
64  bool
66  const Value& other) const
67  {
68  return !(*this == other);
69  }
70 };
71 
72 /// A number representing quantity.
73 ///
74 /// FIX type: Qty.
75 typedef
77 <
78  Int32,
80 >
82 
83 
84 /// Null values definition for optional DecimalQty field.
86 {
87  /// Aliases the type whose null value
88  /// traits are exposed by the given class.
89  typedef DecimalQty Value;
90 
91  /// Null value for optional Mantissa field.
92  typedef
95 
96  /// Compares encoded data to NULL.
97  bool
99  const Value& other) const
100  {
101  return (
102  NullMantissa() ==
103  other.mantissa()
104  );
105  }
106 
107  /// Compares encoded data to NULL.
108  bool
110  const Value& other) const
111  {
112  return !(*this == other);
113  }
114 };
115 
116 /// Decimal.
117 typedef
119 <
120  Int64,
122 >
124 
125 
126 /// Year, Month and Date.
127 ///
128 /// FIX type: MonthYear.
130 {
131 public:
132  /// Size of composite.
133  enum { Size = 5 };
134 
135  /// YYYY.
136  typedef UInt16 Year;
137 
138  /// Null value for optional Year field.
139  typedef
142 
143  /// MM.
144  typedef UInt8 Month;
145 
146  /// Null value for optional Month field.
147  typedef
150 
151  /// DD.
152  typedef UInt8 Day;
153 
154  /// Null value for optional Day field.
155  typedef
158 
159  /// WW.
160  typedef UInt8 Week;
161 
162  /// Null value for optional Week field.
163  typedef
166 
167  /// Default constructor.
168  ///
169  /// Initializes fields with appropriate null values.
171  : year_(NullYear::value()),
172  month_(NullMonth::value()),
173  day_(NullDay::value()),
174  week_(NullWeek::value())
175  {
176  }
177 
178  /// YYYY.
179  Year year() const
180  {
181  return year_;
182  }
183 
184  /// MM.
185  bool
187  Month& value) const
188  {
189  if (NullMonth() == month_) return false;
190  value = month_;
191  return true;
192  }
193 
194  /// DD.
195  bool
197  Day& value) const
198  {
199  if (NullDay() == day_) return false;
200  value = day_;
201  return true;
202  }
203 
204  /// WW.
205  bool
207  Week& value) const
208  {
209  if (NullWeek() == week_) return false;
210  value = week_;
211  return true;
212  }
213 
214 private:
215  Year year_;
216  Month month_;
217  Day day_;
218  Week week_;
219 };
220 
221 
222 /// Null values definition for optional MaturityMonthYear field.
224 {
225  /// Aliases the type whose null value
226  /// traits are exposed by the given class.
228 
229  /// Compares encoded data to NULL.
230  bool
232  const Value& other) const
233  {
234  return (
236  other.year()
237  );
238  }
239 
240  /// Compares encoded data to NULL.
241  bool
243  const Value& other) const
244  {
245  return !(*this == other);
246  }
247 };
248 
249 /// PRICE.
250 typedef
252 <
253  Int64,
255 >
257 
258 
259 /// Null values definition for optional PRICE field.
261 {
262  /// Aliases the type whose null value
263  /// traits are exposed by the given class.
264  typedef PRICE Value;
265 
266  /// Null value for optional Mantissa field.
267  typedef
270 
271  /// Compares encoded data to NULL.
272  bool
274  const Value& other) const
275  {
276  return (
277  NullMantissa() ==
278  other.mantissa()
279  );
280  }
281 
282  /// Compares encoded data to NULL.
283  bool
285  const Value& other) const
286  {
287  return !(*this == other);
288  }
289 };
290 
291 /// Price with constant exponent -9.
292 typedef
294 <
295  Int64,
297 >
299 
300 
301 /// Null values definition for optional PRICE9 field.
303 {
304  /// Aliases the type whose null value
305  /// traits are exposed by the given class.
306  typedef PRICE9 Value;
307 
308  /// Null value for optional Mantissa field.
309  typedef
312 
313  /// Compares encoded data to NULL.
314  bool
316  const Value& other) const
317  {
318  return (
319  NullMantissa() ==
320  other.mantissa()
321  );
322  }
323 
324  /// Compares encoded data to NULL.
325  bool
327  const Value& other) const
328  {
329  return !(*this == other);
330  }
331 };
332 
333 /// Repeating group dimensions.
334 ///
335 /// FIX type: NumInGroup.
337 {
338 public:
339  /// Size of composite.
340  enum { Size = 3 };
341 
342  /// blockLength type.
343  typedef UInt16 BlockLength;
344 
345  /// numInGroup type.
346  typedef UInt8 NumInGroup;
347 
348  /// Default constructor.
349  ///
350  /// Initializes fields with zero values.
352  : blockLength_(0),
353  numInGroup_(0)
354  {
355  }
356 
357  /// blockLength field.
358  BlockLength blockLength() const
359  {
360  return blockLength_;
361  }
362 
363  /// numInGroup field.
364  NumInGroup numInGroup() const
365  {
366  return numInGroup_;
367  }
368 
369 private:
370  BlockLength blockLength_;
371  NumInGroup numInGroup_;
372 };
373 
374 
375 /// 8 Byte aligned repeating group dimensions.
376 ///
377 /// FIX type: NumInGroup.
379 {
380 public:
381  /// Size of composite.
382  enum { Size = 8 };
383 
384  /// Length.
385  typedef UInt16 BlockLength;
386 
387  /// NumInGroup.
388  typedef UInt8 NumInGroup;
389 
390  /// Default constructor.
391  ///
392  /// Initializes fields with zero values.
394  : blockLength_(0),
395  numInGroup_(0)
396  {
397  }
398 
399  /// Length.
400  BlockLength blockLength() const
401  {
402  return blockLength_;
403  }
404 
405  /// NumInGroup.
406  NumInGroup numInGroup() const
407  {
408  return numInGroup_;
409  }
410 
411 private:
412  BlockLength blockLength_;
413  Byte padding1[5];
414  NumInGroup numInGroup_;
415 };
416 
417 
418 /// Repeating group dimensions.
420 {
421 public:
422  /// Size of composite.
423  enum { Size = 4 };
424 
425  /// blockLength type.
426  ///
427  /// FIX type: Length.
428  typedef UInt16 BlockLength;
429 
430  /// numInGroup type.
431  ///
432  /// FIX type: NumInGroup.
433  typedef UInt16 NumInGroup;
434 
435  /// Default constructor.
436  ///
437  /// Initializes fields with zero values.
439  : blockLength_(0),
440  numInGroup_(0)
441  {
442  }
443 
444  /// blockLength field.
445  ///
446  /// FIX type: Length.
447  BlockLength blockLength() const
448  {
449  return blockLength_;
450  }
451 
452  /// numInGroup field.
453  ///
454  /// FIX type: NumInGroup.
455  NumInGroup numInGroup() const
456  {
457  return numInGroup_;
458  }
459 
460 private:
461  BlockLength blockLength_;
462  NumInGroup numInGroup_;
463 };
464 
465 
466 /// Template ID and length of message root.
468 {
469 public:
470  /// Size of composite.
471  enum { Size = 8 };
472 
473  /// blockLength type.
474  typedef UInt16 BlockLength;
475 
476  /// templateId type.
477  typedef UInt16 TemplateId;
478 
479  /// schemaId type.
480  typedef UInt16 SchemaId;
481 
482  /// version type.
483  typedef UInt16 Version;
484 
485  /// Default constructor.
486  ///
487  /// Initializes fields with zero values.
489  : blockLength_(0),
490  templateId_(0),
491  schemaId_(0),
492  version_(0)
493  {
494  }
495 
496  /// blockLength field.
497  BlockLength blockLength() const
498  {
499  return blockLength_;
500  }
501 
502  /// templateId field.
503  TemplateId templateId() const
504  {
505  return templateId_;
506  }
507 
508  /// schemaId field.
509  SchemaId schemaId() const
510  {
511  return schemaId_;
512  }
513 
514  /// version field.
515  Version version() const
516  {
517  return version_;
518  }
519 
520 private:
521  BlockLength blockLength_;
522  TemplateId templateId_;
523  SchemaId schemaId_;
524  Version version_;
525 };
526 
527 
528 ONIXS_CMEMDH_DATA_PACKING_END
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:110
bool operator!=(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:134
Int32 Int32
int32.
Definition: Fields.h:63
IntegralConstant< UInt16, 65535 > NullYear
Null value for optional Year field.
Definition: Composites.h:141
Repeating group dimensions.
Definition: Composites.h:419
UInt8 Byte
Alias for Byte.
Definition: Memory.h:30
UInt16 BlockLength
blockLength type.
Definition: Composites.h:474
FixedPointDecimal< Int64, IntegralConstant< Int8,-7 >> PRICE
PRICE.
Definition: Composites.h:256
Null values definition for optional PRICE9 field.
Definition: Composites.h:302
IntegralConstant< UInt8, 255 > NullDay
Null value for optional Day field.
Definition: Composites.h:157
Null values definition for optional Decimal9 field.
Definition: Composites.h:41
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:358
UInt16 BlockLength
blockLength type.
Definition: Composites.h:343
UInt8 NumInGroup
numInGroup type.
Definition: Composites.h:346
Null values definition for optional MaturityMonthYear field.
Definition: Composites.h:223
IntegralConstant< Int32, 2147483647 > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:94
Null values definition for optional PRICE field.
Definition: Composites.h:260
Null values definition for optional DecimalQty field.
Definition: Composites.h:85
UInt8 UInt8
uInt8.
Definition: Fields.h:197
bool month(Month &value) const
MM.
Definition: Composites.h:186
FixedPointDecimal< Int32, IntegralConstant< Int8,-4 >> DecimalQty
Definition: Composites.h:81
NumInGroup numInGroup() const
NumInGroup.
Definition: Composites.h:406
TemplateId templateId() const
templateId field.
Definition: Composites.h:503
#define ONIXS_CMEMDH_LTWT_STRUCT
Definition: Bootstrap.h:114
bool week(Week &value) const
WW.
Definition: Composites.h:206
BlockLength blockLength() const
Definition: Composites.h:447
FixedPointDecimal< Int64, IntegralConstant< Int8,-7 >> FLOAT
Decimal.
Definition: Composites.h:123
IntegralConstant< UInt8, 255 > NullMonth
Null value for optional Month field.
Definition: Composites.h:149
Version version() const
version field.
Definition: Composites.h:515
UInt8 NumInGroup
NumInGroup.
Definition: Composites.h:388
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168
bool day(Day &value) const
DD.
Definition: Composites.h:196
NumInGroup numInGroup() const
numInGroup field.
Definition: Composites.h:364
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:311
Mantissa mantissa() const
Returns mantissa of given decimal.
Definition: Decimal.h:87
UInt16 TemplateId
templateId type.
Definition: Composites.h:477
UInt16 Version
version type.
Definition: Composites.h:483
IntegralConstant< UInt8, 255 > NullWeek
Null value for optional Week field.
Definition: Composites.h:165
BlockLength blockLength() const
Length.
Definition: Composites.h:400
Template ID and length of message root.
Definition: Composites.h:467
bool operator==(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:116
FixedPointDecimal< Int64, IntegralConstant< Int8,-9 >> PRICE9
Price with constant exponent -9.
Definition: Composites.h:298
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:269
Int8 Int8
int8.
Definition: Fields.h:67
NumInGroup numInGroup() const
Definition: Composites.h:455
UInt16 SchemaId
schemaId type.
Definition: Composites.h:480
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:50
SchemaId schemaId() const
schemaId field.
Definition: Composites.h:509
Integral constant.
Definition: Integral.h:88
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:497
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:172