OnixS C++ CME MDP Conflated TCP Handler  1.3.6
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  /// \private
489  /// Init traits.
490  struct MemberTraits
491  {
492  enum { Count = 4 };
493 
494  typedef Year FirstArgType;
495 
496  typedef Month SecondArgType;
497 
498  typedef Day ThirdArgType;
499 
500  typedef Week FourthArgType;
501  };
502 
503  /// Serializes to a data buffer
504  void serialize(void* addr) const
506  {
507  assert(addr);
508 
509  std::memcpy(addr, &year_, sizeof(year_));
510  addr = advanceByBytes(addr, sizeof(year_));
511 
512  std::memcpy(addr, &month_, sizeof(month_));
513  addr = advanceByBytes(addr, sizeof(month_));
514 
515  std::memcpy(addr, &day_, sizeof(day_));
516  addr = advanceByBytes(addr, sizeof(day_));
517 
518  std::memcpy(addr, &week_, sizeof(week_));
519  }
520 
521  /// YYYY.
523  Year year() const
525  {
526  return year_;
527  }
528 
529  /// YYYY.
530  void setYear(Year value)
532  {
533  year_ = value;
534  }
535 
536  void yearNull()
538  {
539  year_ = NullYear();
540  }
541 
542  /// MM.
544  bool month(Month& value) const
546  {
547  value = month_;
548  return NullMonth() != month_;
549  }
550 
551  /// MM.
552  void setMonth(Month value)
554  {
555  month_ = value;
556  }
557 
558  void monthNull()
560  {
561  month_ = NullMonth();
562  }
563 
564  /// DD.
566  bool day(Day& value) const
568  {
569  value = day_;
570  return NullDay() != day_;
571  }
572 
573  /// DD.
574  void setDay(Day value)
576  {
577  day_ = value;
578  }
579 
580  void dayNull()
582  {
583  day_ = NullDay();
584  }
585 
586  /// WW.
588  bool week(Week& value) const
590  {
591  value = week_;
592  return NullWeek() != week_;
593  }
594 
595  /// WW.
596  void setWeek(Week value)
598  {
599  week_ = value;
600  }
601 
602  void weekNull()
604  {
605  week_ = NullWeek();
606  }
607 
608  /// Compares encoded data
610  bool
611  operator==(
612  const MaturityMonthYear& other) const
614 
615  /// Compares encoded data
617  bool
619  const MaturityMonthYear& other) const
620  ONIXS_CONFLATEDTCP_NOTHROW
621  {
622  return !(*this == other);
623  }
624 
625 private:
626  Year year_;
627  Month month_;
628  Day day_;
629  Week week_;
630 };
631 
632 
633 /// Null values definition for optional MaturityMonthYear field.
635 {
636  /// Aliases the type whose null value
637  /// traits are exposed by the given class.
639 
640  /// Compares encoded data to NULL.
642  bool operator ==(const Value& other) const
644  {
645  return (
647  other.year());
648  }
649 
650  /// Compares encoded data to NULL.
652  bool operator !=(const Value& other) const
654  {
655  return !(*this == other);
656  }
657 
658  /// \return the value of the constant.
660  operator Value() const
662  {
663  return Value();
664  }
665 
666  /// \return the value of the constant.
668  Value operator()() const
670  {
671  return Value();
672  }
673 
674  /// \return the value of the constant.
676  static Value value()
678  {
679  return Value();
680  }
681 };
682 
683 inline
684 bool
686  const MaturityMonthYear& other) const
688 {
689  if((NullMaturityMonthYear() == *this) &&
690  (NullMaturityMonthYear() == other))
691  return true;
692 
693  return
694  (this->year_ == other.year_) &&
695  (this->month_ == other.month_) &&
696  (this->day_ == other.day_) &&
697  (this->week_ == other.week_);
698 }
699 
700 /// Price with constant exponent -9.
701 typedef
703 <
704  Int64,
706 >
708 
709 /// Null values definition for optional PRICE9 field.
711 {
712  /// Aliases the type whose null value
713  /// traits are exposed by the given class.
714  typedef PRICE9 Value;
715 
716  /// Null value for an optional Mantissa field.
717  typedef
720 
721 
722  /// Compares encoded data to NULL.
724  bool operator ==(const Value& other) const
726  {
727  return (
728  NullMantissa() ==
729  other.mantissa());
730  }
731 
732  /// Compares encoded data to NULL.
734  bool operator !=(const Value& other) const
736  {
737  return !(*this == other);
738  }
739 
740  /// \return the value of the constant.
742  operator Value() const
744  {
745  return Value(NullMantissa());
746  }
747 
748  /// \return the value of the constant.
750  Value operator()() const
752  {
753  return Value(NullMantissa());
754  }
755 
756  /// \return the value of the constant.
758  static Value value()
760  {
761  return Value(NullMantissa());
762  }
763 };
764 
765 /// \return whether the given value is Null.
767 inline bool isNull(const PRICE9& value)
769 {
770  return NullPRICE9() == value;
771 }
772 
773 
774 
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
constexpr Value operator()() const noexcept
Definition: Composites.h:81
IntegralConstant< UInt8, 255 > NullWeek
Null value for an optional Week field.
Definition: Composites.h:458
#define ONIXS_CONFLATEDTCP_NOTHROW
Definition: Compiler.h:176
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition: Composites.h:189
BlockLength blockLength() const noexcept
Length.
Definition: Composites.h:233
NumInGroup numInGroup() const noexcept
NumInGroup.
Definition: Composites.h:248
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
Template ID and length of message root.
Definition: Composites.h:330
bool month(Month &value) const noexcept
MM.
Definition: Composites.h:544
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:719
bool operator!=(const MaturityMonthYear &other) const noexcept
Compares encoded data.
Definition: Composites.h:618
UInt16 Version
Type alias for the Version.
Definition: Composites.h:346
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_BEGIN
Definition: ABI.h:147
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:151
static constexpr Value value() noexcept
Definition: Composites.h:758
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:179
void setNumInGroup(NumInGroup value) noexcept
NumInGroup.
Definition: Composites.h:255
UInt16 SchemaId
Type alias for the SchemaId.
Definition: Composites.h:343
#define ONIXS_CONFLATEDTCP_NODISCARD
Definition: Compiler.h:185
Null values definition for optional Decimal9 field.
Definition: Composites.h:41
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:707
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:710
bool operator==(const StrRef &left, const StrRef &right)
Compares instances.
Definition: StrRef.h:261
PRICE9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition: Composites.h:714
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
constexpr Value operator()() const noexcept
Definition: Composites.h:750
#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:638
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 StrRef &left, const StrRef &right)
Compares instances.
Definition: StrRef.h:282
void serialize(void *addr) const noexcept
Serializes to a data buffer.
Definition: Composites.h:504
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:634
bool isNull(const PRICE9 &value) noexcept
Definition: Composites.h:767
UInt16 NumInGroup
Type alias for the NumInGroup.
Definition: Composites.h:283