OnixS C++ CME MDP Premium Market Data Handler  5.8.9
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 protected:
301  // Alignment tricks.
302  typedef Byte Padding1[5];
303 
304  // Alignment tricks.
305  const void* padding1() const
306  {
307  return padding1_;
308  }
309 
310 private:
311  BlockLength blockLength_;
312  Padding1 padding1_;
313  NumInGroup numInGroup_;
314 };
315 
316 /// Repeating group dimensions.
318 {
319 public:
320  /// Size of composite.
321  enum
322  {
323  Size = 4
324  };
325 
326  /// blockLength type.
327  ///
328  /// FIX type: Length.
330 
331  /// numInGroup type.
332  ///
333  /// FIX type: NumInGroup.
335 
336  /// Default constructor.
337  ///
338  /// Initializes fields with zero values.
340  : blockLength_(0)
341  , numInGroup_(0)
342  {
343  }
344 
345  /// blockLength field.
346  ///
347  /// FIX type: Length.
348  BlockLength blockLength() const
349  {
350  return blockLength_;
351  }
352 
353  /// numInGroup field.
354  ///
355  /// FIX type: NumInGroup.
356  NumInGroup numInGroup() const
357  {
358  return numInGroup_;
359  }
360 
361 private:
362  BlockLength blockLength_;
363  NumInGroup numInGroup_;
364 };
365 
366 /// Template ID and length of message root.
368 {
369 public:
370  /// Size of composite.
371  enum
372  {
373  Size = 8
374  };
375 
376  /// blockLength type.
378 
379  /// templateId type.
381 
382  /// schemaId type.
383  typedef UInt16 SchemaId;
384 
385  /// version type.
386  typedef UInt16 Version;
387 
388  /// Default constructor.
389  ///
390  /// Initializes fields with zero values.
392  : blockLength_(0)
393  , templateId_(0)
394  , schemaId_(0)
395  , version_(0)
396  {
397  }
398 
399  /// blockLength field.
400  BlockLength blockLength() const
401  {
402  return blockLength_;
403  }
404 
405  /// templateId field.
406  TemplateId templateId() const
407  {
408  return templateId_;
409  }
410 
411  /// schemaId field.
412  SchemaId schemaId() const
413  {
414  return schemaId_;
415  }
416 
417  /// version field.
418  Version version() const
419  {
420  return version_;
421  }
422 
423 private:
424  BlockLength blockLength_;
425  TemplateId templateId_;
426  SchemaId schemaId_;
427  Version version_;
428 };
429 
430 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:317
MaturityMonthYear()
Default constructor.
Definition: Composites.h:123
UInt8 Byte
Alias for Byte.
Definition: Memory.h:30
UInt16 BlockLength
blockLength type.
Definition: Composites.h:377
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:391
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:198
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:406
GroupSizeEncoding()
Default constructor.
Definition: Composites.h:339
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:348
IntegralConstant< UInt8, 255 > NullMonth
Null value for optional Month field.
Definition: Composites.h:106
Version version() const
version field.
Definition: Composites.h:418
UInt8 NumInGroup
NumInGroup.
Definition: Composites.h:277
bool operator==(const Value &other) const
Compares encoded data to NULL.
Definition: Composites.h:205
const void * padding1() const
Definition: Composites.h:305
#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:380
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:386
UInt16 NumInGroup
numInGroup type.
Definition: Composites.h:334
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:367
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 optional.
Definition: Fields.h:189
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:356
UInt16 SchemaId
schemaId type.
Definition: Composites.h:383
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:412
Integral constant.
Definition: Integral.h:83
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:400
UInt16 BlockLength
blockLength type.
Definition: Composites.h:329
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68