OnixS C++ CME MDP Conflated TCP Handler  1.1.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 
24 
27 
29 ONIXS_CONFLATEDTCP_DATA_PACKING_BEGIN(1)
30 
31 /// Decimal with constant exponent -9.
32 typedef
34 <
35  Int64,
37 >
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 an optional Mantissa field.
48  typedef
51 
52 
53  /// Compares encoded data to NULL.
55  bool operator ==(const Value& other) const
57  {
58  return (
59  NullMantissa() ==
60  other.mantissa());
61  }
62 
63  /// Compares encoded data to NULL.
65  bool operator !=(const Value& other) const
67  {
68  return !(*this == other);
69  }
70 
71  /// \return the value of the constant.
73  operator Value() const
75  {
76  return Value(NullMantissa());
77  }
78 
79  /// \return the value of the constant.
81  Value operator()() const
83  {
84  return Value(NullMantissa());
85  }
86 
87  /// \return the value of the constant.
89  static Value value()
91  {
92  return Value(NullMantissa());
93  }
94 };
95 
96 
97 /// A number representing quantity.
98 ///
99 /// FIX type: Qty.
100 typedef
102 <
103  Int32,
105 >
107 
108 /// Null values definition for optional DecimalQty field.
110 {
111  /// Aliases the type whose null value
112  /// traits are exposed by the given class.
113  typedef DecimalQty Value;
114 
115  /// Null value for an optional Mantissa field.
116  typedef
119 
120 
121  /// Compares encoded data to NULL.
123  bool operator ==(const Value& other) const
125  {
126  return (
127  NullMantissa() ==
128  other.mantissa());
129  }
130 
131  /// Compares encoded data to NULL.
133  bool operator !=(const Value& other) const
135  {
136  return !(*this == other);
137  }
138 
139  /// \return the value of the constant.
141  operator Value() const
143  {
144  return Value(NullMantissa());
145  }
146 
147  /// \return the value of the constant.
149  Value operator()() const
151  {
152  return Value(NullMantissa());
153  }
154 
155  /// \return the value of the constant.
157  static Value value()
159  {
160  return Value(NullMantissa());
161  }
162 };
163 
164 
165 /// Repeating group dimensions.
166 ///
167 /// FIX type: NumInGroup.
169 {
170 public:
171  /// Size of the composite.
172  enum { Size = 3 };
173 
174  /// Type alias for the `BlockLength`.
176 
177  /// Type alias for the `NumInGroup`.
178  typedef UInt8 NumInGroup;
179 
180  /// \return the `blockLength` field.
182  BlockLength blockLength() const
184  {
185  return blockLength_;
186  }
187 
188  /// Sets the `blockLength` field.
189  void setBlockLength(BlockLength value)
191  {
192  blockLength_ = value;
193  }
194 
195  /// \return the `numInGroup` field.
197  NumInGroup numInGroup() const
199  {
200  return numInGroup_;
201  }
202 
203  /// Sets the `numInGroup` field.
204  void setNumInGroup(NumInGroup value)
206  {
207  numInGroup_ = value;
208  }
209 
210 private:
211  BlockLength blockLength_;
212  NumInGroup numInGroup_;
213 };
214 
215 
216 /// 8 Byte aligned repeating group dimensions.
217 ///
218 /// FIX type: NumInGroup.
220 {
221 public:
222  /// Size of the composite.
223  enum { Size = 8 };
224 
225  /// Length.
227 
228  /// NumInGroup.
229  typedef UInt8 NumInGroup;
230 
231  /// Length.
233  BlockLength blockLength() const
235  {
236  return blockLength_;
237  }
238 
239  /// Length.
240  void setBlockLength(BlockLength value)
242  {
243  blockLength_ = value;
244  }
245 
246  /// NumInGroup.
248  NumInGroup numInGroup() const
250  {
251  return numInGroup_;
252  }
253 
254  /// NumInGroup.
255  void setNumInGroup(NumInGroup value)
257  {
258  numInGroup_ = value;
259  }
260 
261 private:
262  BlockLength blockLength_;
263  ONIXS_CONFLATEDTCP_PADDING(5);
264  NumInGroup numInGroup_;
265 };
266 
267 
268 /// Repeating group dimensions.
270 {
271 public:
272  /// Size of the composite.
273  enum { Size = 4 };
274 
275  /// Type alias for the `BlockLength`.
276  ///
277  /// FIX type: Length.
279 
280  /// Type alias for the `NumInGroup`.
281  ///
282  /// FIX type: NumInGroup.
284 
285  /// \return the `blockLength` field.
286  ///
287  /// FIX type: Length.
289  BlockLength blockLength() const
291  {
292  return blockLength_;
293  }
294 
295  /// Sets the `blockLength` field.
296  ///
297  /// FIX type: Length.
298  void setBlockLength(BlockLength value)
300  {
301  blockLength_ = value;
302  }
303 
304  /// \return the `numInGroup` field.
305  ///
306  /// FIX type: NumInGroup.
308  NumInGroup numInGroup() const
310  {
311  return numInGroup_;
312  }
313 
314  /// Sets the `numInGroup` field.
315  ///
316  /// FIX type: NumInGroup.
317  void setNumInGroup(NumInGroup value)
319  {
320  numInGroup_ = value;
321  }
322 
323 private:
324  BlockLength blockLength_;
325  NumInGroup numInGroup_;
326 };
327 
328 
329 /// Template ID and length of message root.
331 {
332 public:
333  /// Size of the composite.
334  enum { Size = 8 };
335 
336  /// Type alias for the `BlockLength`.
338 
339  /// Type alias for the `TemplateId`.
341 
342  /// Type alias for the `SchemaId`.
343  typedef UInt16 SchemaId;
344 
345  /// Type alias for the `Version`.
346  typedef UInt16 Version;
347 
348  /// \return the `blockLength` field.
350  BlockLength blockLength() const
352  {
353  return blockLength_;
354  }
355 
356  /// Sets the `blockLength` field.
357  void setBlockLength(BlockLength value)
359  {
360  blockLength_ = value;
361  }
362 
363  /// \return the `templateId` field.
365  TemplateId templateId() const
367  {
368  return templateId_;
369  }
370 
371  /// Sets the `templateId` field.
372  void setTemplateId(TemplateId value)
374  {
375  templateId_ = value;
376  }
377 
378  /// \return the `schemaId` field.
380  SchemaId schemaId() const
382  {
383  return schemaId_;
384  }
385 
386  /// Sets the `schemaId` field.
387  void setSchemaId(SchemaId value)
389  {
390  schemaId_ = value;
391  }
392 
393  /// \return the `version` field.
395  Version version() const
397  {
398  return version_;
399  }
400 
401  /// Sets the `version` field.
402  void setVersion(Version value)
404  {
405  version_ = value;
406  }
407 
408 private:
409  BlockLength blockLength_;
410  TemplateId templateId_;
411  SchemaId schemaId_;
412  Version version_;
413 };
414 
415 
416 
417 ONIXS_CONFLATEDTCP_DATA_PACKING_END
418 
419 /// Year, Month and Date.
420 ///
421 /// FIX type: MonthYear.
423 {
424 public:
425  /// Size of the composite.
426  enum { Size = 5 };
427 
428  /// YYYY.
429  typedef UInt16 Year;
430 
431  /// Null value for an optional Year field.
432  typedef
435 
436  /// MM.
437  typedef UInt8 Month;
438 
439  /// Null value for an optional Month field.
440  typedef
443 
444  /// DD.
445  typedef UInt8 Day;
446 
447  /// Null value for an optional Day field.
448  typedef
451 
452  /// WW.
453  typedef UInt8 Week;
454 
455  /// Null value for an optional Week field.
456  typedef
459 
460  /// Default constructor.
461  ///
462  /// Initializes fields with appropriate null values.
466  : year_(NullYear::value()),
467  month_(NullMonth::value()),
468  day_(NullDay::value()),
469  week_(NullWeek::value())
470  {
471  }
472 
473  /// Initializes fields with provided values
476  Year year,
477  Month month,
478  Day day,
479  Week week)
481  : year_(year),
482  month_(month),
483  day_(day),
484  week_(week)
485  {
486  }
487 
488  /// \return a human-readable presentation.
490  std::string
491  toString() const;
492 
493  /// \private
494  /// Init traits.
495  struct MemberTraits
496  {
497  enum { Count = 4 };
498 
499  typedef Year FirstArgType;
500 
501  typedef Month SecondArgType;
502 
503  typedef Day ThirdArgType;
504 
505  typedef Week FourthArgType;
506  };
507 
508  /// Serializes to a data buffer
509  void serialize(void* addr) const
511  {
512  assert(addr);
513 
514  std::memcpy(addr, &year_, sizeof(year_));
515  addr = advanceByBytes(addr, sizeof(year_));
516 
517  std::memcpy(addr, &month_, sizeof(month_));
518  addr = advanceByBytes(addr, sizeof(month_));
519 
520  std::memcpy(addr, &day_, sizeof(day_));
521  addr = advanceByBytes(addr, sizeof(day_));
522 
523  std::memcpy(addr, &week_, sizeof(week_));
524  }
525 
526  /// YYYY.
528  Year year() const
530  {
531  return year_;
532  }
533 
534  /// YYYY.
535  void setYear(Year value)
537  {
538  year_ = value;
539  }
540 
541  void yearNull()
543  {
544  year_ = NullYear();
545  }
546 
547  /// MM.
549  bool month(Month& value) const
551  {
552  value = month_;
553  return NullMonth() != month_;
554  }
555 
556  /// MM.
557  void setMonth(Month value)
559  {
560  month_ = value;
561  }
562 
563  void monthNull()
565  {
566  month_ = NullMonth();
567  }
568 
569  /// DD.
571  bool day(Day& value) const
573  {
574  value = day_;
575  return NullDay() != day_;
576  }
577 
578  /// DD.
579  void setDay(Day value)
581  {
582  day_ = value;
583  }
584 
585  void dayNull()
587  {
588  day_ = NullDay();
589  }
590 
591  /// WW.
593  bool week(Week& value) const
595  {
596  value = week_;
597  return NullWeek() != week_;
598  }
599 
600  /// WW.
601  void setWeek(Week value)
603  {
604  week_ = value;
605  }
606 
607  void weekNull()
609  {
610  week_ = NullWeek();
611  }
612 
613  /// Compares encoded data
615  bool
616  operator==(
617  const MaturityMonthYear& other) const
619 
620  /// Compares encoded data
622  bool
624  const MaturityMonthYear& other) const
625  ONIXS_CONFLATEDTCP_NOTHROW
626  {
627  return !(*this == other);
628  }
629 
630 private:
631  Year year_;
632  Month month_;
633  Day day_;
634  Week week_;
635 };
636 
637 
638 /// Null values definition for optional MaturityMonthYear field.
640 {
641  /// Aliases the type whose null value
642  /// traits are exposed by the given class.
644 
645  /// Compares encoded data to NULL.
647  bool operator ==(const Value& other) const
649  {
650  return (
652  other.year());
653  }
654 
655  /// Compares encoded data to NULL.
657  bool operator !=(const Value& other) const
659  {
660  return !(*this == other);
661  }
662 
663  /// \return the value of the constant.
665  operator Value() const
667  {
668  return Value();
669  }
670 
671  /// \return the value of the constant.
673  Value operator()() const
675  {
676  return Value();
677  }
678 
679  /// \return the value of the constant.
681  static Value value()
683  {
684  return Value();
685  }
686 };
687 
688 
689 inline
690 bool
692  const MaturityMonthYear& other) const
694 {
695  if((NullMaturityMonthYear() == *this) &&
696  (NullMaturityMonthYear() == other))
697  return true;
698 
699  return
700  (this->year_ == other.year_) &&
701  (this->month_ == other.month_) &&
702  (this->day_ == other.day_) &&
703  (this->week_ == other.week_);
704 }
705 
706 
707 /// Price with constant exponent -9.
708 typedef
710 <
711  Int64,
713 >
715 
716 /// Null values definition for optional PRICE9 field.
718 {
719  /// Aliases the type whose null value
720  /// traits are exposed by the given class.
721  typedef PRICE9 Value;
722 
723  /// Null value for an optional Mantissa field.
724  typedef
727 
728 
729  /// Compares encoded data to NULL.
731  bool operator ==(const Value& other) const
733  {
734  return (
735  NullMantissa() ==
736  other.mantissa());
737  }
738 
739  /// Compares encoded data to NULL.
741  bool operator !=(const Value& other) const
743  {
744  return !(*this == other);
745  }
746 
747  /// \return the value of the constant.
749  operator Value() const
751  {
752  return Value(NullMantissa());
753  }
754 
755  /// \return the value of the constant.
757  Value operator()() const
759  {
760  return Value(NullMantissa());
761  }
762 
763  /// \return the value of the constant.
765  static Value value()
767  {
768  return Value(NullMantissa());
769  }
770 };
771 
772 /// \return whether the given value is Null.
774 inline bool isNull(const PRICE9& value)
776 {
777  return NullPRICE9() == value;
778 }
779 
780 
781 
void setTemplateId(TemplateId value) noexcept
Sets the templateId field.
Definition: Composites.h:372
UInt16 BlockLength
Type alias for the BlockLength.
Definition: Composites.h:278
IntegralConstant< UInt16, 65535 > NullYear
Null value for an optional Year field.
Definition: Composites.h:434
IntegralConstant< UInt8, 255 > NullWeek
Null value for an optional Week field.
Definition: Composites.h:458
#define ONIXS_CONFLATEDTCP_NOTHROW
Definition: Compiler.h:193
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition: Composites.h:189
DecimalQty Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:113
IntegralConstant< Int32, 2147483647 > NullMantissa
Null value for an optional Mantissa field.
Definition: Composites.h:118
constexpr Value operator()() const noexcept
Definition: Composites.h:81
Template ID and length of message root.
Definition: Composites.h:330
bool operator!=(const MaturityMonthYear &other) const noexcept
Compares encoded data.
Definition: Composites.h:623
bool operator==(const TimeSpan &left, const TimeSpan &right) noexcept
Compares Timespans.
Definition: Time.h:349
UInt16 BlockLength
Type alias for the BlockLength.
Definition: Composites.h:337
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for an optional Mantissa field.
Definition: Composites.h:726
bool month(Month &value) const noexcept
MM.
Definition: Composites.h:549
NumInGroup numInGroup() const noexcept
NumInGroup.
Definition: Composites.h:248
UInt16 Version
Type alias for the Version.
Definition: Composites.h:346
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_BEGIN
Definition: ABI.h:148
UInt16 TemplateId
Type alias for the TemplateId.
Definition: Composites.h:340
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition: Composites.h:357
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_END
Definition: ABI.h:152
static constexpr Value value() noexcept
Definition: Composites.h:765
void setBlockLength(BlockLength value) noexcept
Length.
Definition: Composites.h:240
UInt16 BlockLength
Type alias for the BlockLength.
Definition: Composites.h:175
void setSchemaId(SchemaId value) noexcept
Sets the schemaId field.
Definition: Composites.h:387
8 Byte aligned repeating group dimensions.
Definition: Composites.h:219
#define ONIXS_CONFLATEDTCP_CONSTEXPR
Definition: Compiler.h:196
void setNumInGroup(NumInGroup value) noexcept
NumInGroup.
Definition: Composites.h:255
UInt16 SchemaId
Type alias for the SchemaId.
Definition: Composites.h:343
BlockLength blockLength() const noexcept
Length.
Definition: Composites.h:233
#define ONIXS_CONFLATEDTCP_NODISCARD
Definition: Compiler.h:202
Null values definition for optional Decimal9 field.
Definition: Composites.h:41
constexpr Value operator()() const noexcept
Definition: Composites.h:757
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition: Composites.h:298
FixedPointDecimal< Int64, IntegralConstant< Int8,-9 >> PRICE9
Price with constant exponent -9.
Definition: Composites.h:714
UInt8 NumInGroup
Type alias for the NumInGroup.
Definition: Composites.h:178
void setVersion(Version value) noexcept
Sets the version field.
Definition: Composites.h:402
void setNumInGroup(NumInGroup value) noexcept
Sets the numInGroup field.
Definition: Composites.h:204
Null values definition for optional PRICE9 field.
Definition: Composites.h:717
void serialize(void *addr) const noexcept
Serializes to a data buffer.
Definition: Composites.h:509
PRICE9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:721
Null values definition for optional DecimalQty field.
Definition: Composites.h:109
IntegralConstant< UInt8, 255 > NullMonth
Null value for an optional Month field.
Definition: Composites.h:442
#define ONIXS_CONFLATEDTCP_LTWT_CLASS
Definition: ABI.h:84
constexpr MaturityMonthYear(Year year, Month month, Day day, Week week) noexcept
Initializes fields with provided values.
Definition: Composites.h:475
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for an optional Mantissa field.
Definition: Composites.h:50
MaturityMonthYear Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:643
IntegralConstant< UInt8, 255 > NullDay
Null value for an optional Day field.
Definition: Composites.h:450
void setNumInGroup(NumInGroup value) noexcept
Sets the numInGroup field.
Definition: Composites.h:317
bool operator!=(const TimeSpan &left, const TimeSpan &right) noexcept
Compares Timespans.
Definition: Time.h:356
Decimal9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:45
#define ONIXS_CONFLATEDTCP_LTWT_STRUCT
Definition: ABI.h:88
constexpr MaturityMonthYear() noexcept
Default constructor.
Definition: Composites.h:464
static constexpr Value value() noexcept
Definition: Composites.h:89
FixedPointDecimal< Int32, IntegralConstant< Int8,-4 >> DecimalQty
A number representing quantity.
Definition: Composites.h:106
Null values definition for optional MaturityMonthYear field.
Definition: Composites.h:639
bool isNull(const PRICE9 &value) noexcept
Definition: Composites.h:774
UInt16 NumInGroup
Type alias for the NumInGroup.
Definition: Composites.h:283