OnixS C++ CME MDP Conflated UDP Handler  1.1.2
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 
26 
28 ONIXS_CONFLATEDUDP_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 /// Year, Month and Date.
117 ///
118 /// FIX type: MonthYear.
120 {
121 public:
122  /// Size of composite.
123  enum { Size = 5 };
124 
125  /// YYYY.
126  typedef UInt16 Year;
127 
128  /// Null value for optional Year field.
129  typedef
132 
133  /// MM.
134  typedef UInt8 Month;
135 
136  /// Null value for optional Month field.
137  typedef
140 
141  /// DD.
142  typedef UInt8 Day;
143 
144  /// Null value for optional Day field.
145  typedef
148 
149  /// WW.
150  typedef UInt8 Week;
151 
152  /// Null value for optional Week field.
153  typedef
156 
157  /// Default constructor.
158  ///
159  /// Initializes fields with appropriate null values.
161  : year_(NullYear::value()),
162  month_(NullMonth::value()),
163  day_(NullDay::value()),
164  week_(NullWeek::value())
165  {
166  }
167 
168  /// YYYY.
169  Year year() const
170  {
171  return year_;
172  }
173 
174  /// MM.
175  bool
177  Month& value) const
178  {
179  if (NullMonth() == month_) return false;
180  value = month_;
181  return true;
182  }
183 
184  /// DD.
185  bool
187  Day& value) const
188  {
189  if (NullDay() == day_) return false;
190  value = day_;
191  return true;
192  }
193 
194  /// WW.
195  bool
197  Week& value) const
198  {
199  if (NullWeek() == week_) return false;
200  value = week_;
201  return true;
202  }
203 
204 private:
205  Year year_;
206  Month month_;
207  Day day_;
208  Week week_;
209 };
210 
211 
212 /// Null values definition for optional MaturityMonthYear field.
214 {
215  /// Aliases the type whose null value
216  /// traits are exposed by the given class.
218 
219  /// Compares encoded data to NULL.
220  bool
222  const Value& other) const
223  {
224  return (
226  other.year()
227  );
228  }
229 
230  /// Compares encoded data to NULL.
231  bool
233  const Value& other) const
234  {
235  return !(*this == other);
236  }
237 };
238 
239 /// Price with constant exponent -9.
240 typedef
242 <
243  Int64,
245 >
247 
248 
249 /// Null values definition for optional PRICE9 field.
251 {
252  /// Aliases the type whose null value
253  /// traits are exposed by the given class.
254  typedef PRICE9 Value;
255 
256  /// Null value for optional Mantissa field.
257  typedef
260 
261  /// Compares encoded data to NULL.
262  bool
264  const Value& other) const
265  {
266  return (
267  NullMantissa() ==
268  other.mantissa()
269  );
270  }
271 
272  /// Compares encoded data to NULL.
273  bool
275  const Value& other) const
276  {
277  return !(*this == other);
278  }
279 };
280 
281 /// Repeating group dimensions.
282 ///
283 /// FIX type: NumInGroup.
285 {
286 public:
287  /// Size of composite.
288  enum { Size = 3 };
289 
290  /// blockLength type.
292 
293  /// numInGroup type.
294  typedef UInt8 NumInGroup;
295 
296  /// Default constructor.
297  ///
298  /// Initializes fields with zero values.
300  : blockLength_(0),
301  numInGroup_(0)
302  {
303  }
304 
305  /// blockLength field.
306  BlockLength blockLength() const
307  {
308  return blockLength_;
309  }
310 
311  /// numInGroup field.
312  NumInGroup numInGroup() const
313  {
314  return numInGroup_;
315  }
316 
317 private:
318  BlockLength blockLength_;
319  NumInGroup numInGroup_;
320 };
321 
322 
323 /// 8 Byte aligned repeating group dimensions.
324 ///
325 /// FIX type: NumInGroup.
327 {
328 public:
329  /// Size of composite.
330  enum { Size = 8 };
331 
332  /// Length.
334 
335  /// NumInGroup.
336  typedef UInt8 NumInGroup;
337 
338  /// Default constructor.
339  ///
340  /// Initializes fields with zero values.
342  : blockLength_(0),
343  numInGroup_(0)
344  {
345  }
346 
347  /// Length.
348  BlockLength blockLength() const
349  {
350  return blockLength_;
351  }
352 
353  /// NumInGroup.
354  NumInGroup numInGroup() const
355  {
356  return numInGroup_;
357  }
358 
359 protected:
360  // Alignment tricks.
361  typedef Byte Padding1[5];
362 
363  // Alignment tricks.
364  const void* padding1() const
365  {
366  return padding1_;
367  }
368 
369 private:
370  BlockLength blockLength_;
371  Padding1 padding1_;
372  NumInGroup numInGroup_;
373 };
374 
375 
376 /// Repeating group dimensions.
378 {
379 public:
380  /// Size of composite.
381  enum { Size = 4 };
382 
383  /// blockLength type.
384  ///
385  /// FIX type: Length.
387 
388  /// numInGroup type.
389  ///
390  /// FIX type: NumInGroup.
392 
393  /// Default constructor.
394  ///
395  /// Initializes fields with zero values.
397  : blockLength_(0),
398  numInGroup_(0)
399  {
400  }
401 
402  /// blockLength field.
403  ///
404  /// FIX type: Length.
405  BlockLength blockLength() const
406  {
407  return blockLength_;
408  }
409 
410  /// numInGroup field.
411  ///
412  /// FIX type: NumInGroup.
413  NumInGroup numInGroup() const
414  {
415  return numInGroup_;
416  }
417 
418 private:
419  BlockLength blockLength_;
420  NumInGroup numInGroup_;
421 };
422 
423 
424 /// Template ID and length of message root.
426 {
427 public:
428  /// Size of composite.
429  enum { Size = 8 };
430 
431  /// blockLength type.
433 
434  /// templateId type.
436 
437  /// schemaId type.
438  typedef UInt16 SchemaId;
439 
440  /// version type.
441  typedef UInt16 Version;
442 
443  /// Default constructor.
444  ///
445  /// Initializes fields with zero values.
447  : blockLength_(0),
448  templateId_(0),
449  schemaId_(0),
450  version_(0)
451  {
452  }
453 
454  /// blockLength field.
455  BlockLength blockLength() const
456  {
457  return blockLength_;
458  }
459 
460  /// templateId field.
461  TemplateId templateId() const
462  {
463  return templateId_;
464  }
465 
466  /// schemaId field.
467  SchemaId schemaId() const
468  {
469  return schemaId_;
470  }
471 
472  /// version field.
473  Version version() const
474  {
475  return version_;
476  }
477 
478 private:
479  BlockLength blockLength_;
480  TemplateId templateId_;
481  SchemaId schemaId_;
482  Version version_;
483 };
484 
485 
486 ONIXS_CONFLATEDUDP_DATA_PACKING_END
IntegralConstant< Int32, 2147483647 > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:94
Null values definition for optional MaturityMonthYear field.
Definition: Composites.h:213
UInt16 BlockLength
blockLength type.
Definition: Composites.h:432
NumInGroup numInGroup() const
NumInGroup.
Definition: Composites.h:354
Mantissa mantissa() const
Returns mantissa of given decimal.
Definition: Decimal.h:80
Repeating group dimensions.
Definition: Composites.h:377
Int32 Int32
int32.
Definition: Fields.h:69
IntegralConstant< UInt8, 255 > NullWeek
Null value for optional Week field.
Definition: Composites.h:155
Null values definition for optional Decimal9 field.
Definition: Composites.h:41
BlockLength blockLength() const
Length.
Definition: Composites.h:348
UInt16 TemplateId
templateId type.
Definition: Composites.h:435
SchemaId schemaId() const
schemaId field.
Definition: Composites.h:467
Null values definition for optional PRICE9 field.
Definition: Composites.h:250
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:455
IntegralConstant< UInt16, 65535 > NullYear
Null value for optional Year field.
Definition: Composites.h:131
FixedPointDecimal< Int32, IntegralConstant< Int8,-4 >> DecimalQty
Definition: Composites.h:81
Null values definition for optional DecimalQty field.
Definition: Composites.h:85
bool week(Week &value) const
WW.
Definition: Composites.h:196
UInt8 Byte
Alias for Byte.
Definition: Memory.h:30
#define ONIXS_CONFLATEDUDP_LTWT_STRUCT
Definition: Bootstrap.h:99
bool day(Day &value) const
DD.
Definition: Composites.h:186
Version version() const
version field.
Definition: Composites.h:473
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:259
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for optional Mantissa field.
Definition: Composites.h:50
UInt16 BlockLength
blockLength type.
Definition: Composites.h:291
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition: Bootstrap.h:157
UInt16 UInt16
uInt16.
Definition: Fields.h:257
TemplateId templateId() const
templateId field.
Definition: Composites.h:461
UInt8 UInt8
uInt8.
Definition: Fields.h:269
bool value(Number &number, const MultiContainer &container, Tag tag)
BlockLength blockLength() const
blockLength field.
Definition: Composites.h:306
Template ID and length of message root.
Definition: Composites.h:425
IntegralConstant< UInt8, 255 > NullMonth
Null value for optional Month field.
Definition: Composites.h:139
FixedPointDecimal< Int64, IntegralConstant< Int8,-9 >> PRICE9
Price with constant exponent -9.
Definition: Composites.h:246
bool operator!=(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:121
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition: Bootstrap.h:95
bool operator==(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:99
bool month(Month &value) const
MM.
Definition: Composites.h:176
IntegralConstant< UInt8, 255 > NullDay
Null value for optional Day field.
Definition: Composites.h:147
UInt8 NumInGroup
numInGroup type.
Definition: Composites.h:294
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition: Bootstrap.h:153
NumInGroup numInGroup() const
numInGroup field.
Definition: Composites.h:312