OnixS C++ CME iLink 3 Binary Order Entry Handler 1.18.9
API Documentation
Loading...
Searching...
No Matches
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
28
30ONIXS_ILINK3_DATA_PACKING_BEGIN(1)
31
32
35{
36public:
38 enum { Size = 2 };
39
41 typedef UInt16 Length;
42
44 typedef Char VarData;
45
48 Length length() const
50 {
51 return length_;
52 }
53
55 void length(Length value)
57 {
58 length_ = value;
59 }
60
65 {
66 return StrRef(reinterpret_cast<const Char*>(this) + Size, length());
67 }
68
70 void varData(StrRef value)
72 {
73 length(static_cast<Length>(value.size()));
74 if(value.data())
75 std::memcpy(reinterpret_cast<Char*>(this) + Size, value.data(), value.size());
76 }
77
82 {
83 return Size + length();
84 }
85
86private:
87 Length length_;
88};
89
90
95{
96public:
98 enum { Size = 3 };
99
102
105
110 {
111 return blockLength_;
112 }
113
117 {
118 blockLength_ = value;
119 }
120
125 {
126 return numInGroup_;
127 }
128
132 {
133 numInGroup_ = value;
134 }
135
136private:
137 BlockLength blockLength_;
138 NumInGroup numInGroup_;
139};
140
141
144{
145public:
147 enum { Size = 4 };
148
153
158
165 {
166 return blockLength_;
167 }
168
174 {
175 blockLength_ = value;
176 }
177
184 {
185 return numInGroup_;
186 }
187
193 {
194 numInGroup_ = value;
195 }
196
197private:
198 BlockLength blockLength_;
199 NumInGroup numInGroup_;
200};
201
202
205{
206public:
208 enum { Size = 8 };
209
212
215
218
221
226 {
227 return blockLength_;
228 }
229
233 {
234 blockLength_ = value;
235 }
236
241 {
242 return templateId_;
243 }
244
248 {
249 templateId_ = value;
250 }
251
256 {
257 return schemaId_;
258 }
259
263 {
264 schemaId_ = value;
265 }
266
271 {
272 return version_;
273 }
274
276 void setVersion(Version value)
278 {
279 version_ = value;
280 }
281
282private:
283 BlockLength blockLength_;
284 TemplateId templateId_;
285 SchemaId schemaId_;
286 Version version_;
287};
288
289
291
292ONIXS_ILINK3_DATA_PACKING_END
293
295typedef
297<
298 Int32,
299 Int8
300>
302
305{
309
311 typedef
314
315
318 bool operator ==(const Value& other) const
320 {
321 return (
322 NullMantissa() ==
323 other.mantissa());
324 }
325
328 bool operator !=(const Value& other) const
330 {
331 return !(*this == other);
332 }
333
336 operator Value() const
338 {
339 return Value(NullMantissa(), 0);
340 }
341
346 {
347 return Value(NullMantissa(), 0);
348 }
349
352 static Value value()
354 {
355 return Value(NullMantissa(), 0);
356 }
357};
358
361inline
362bool
364 const Decimal32NULL& value)
366{
367 return NullDecimal32NULL() == value;
368}
369
370
372typedef
374<
375 Int64,
376 Int8
377>
379
382{
386
388 typedef
391
392
395 bool operator ==(const Value& other) const
397 {
398 return (
399 NullMantissa() ==
400 other.mantissa());
401 }
402
405 bool operator !=(const Value& other) const
407 {
408 return !(*this == other);
409 }
410
413 operator Value() const
415 {
416 return Value(NullMantissa(), 0);
417 }
418
423 {
424 return Value(NullMantissa(), 0);
425 }
426
429 static Value value()
431 {
432 return Value(NullMantissa(), 0);
433 }
434};
435
438inline
439bool
441 const Decimal64NULL& value)
443{
444 return NullDecimal64NULL() == value;
445}
446
447
452{
453public:
455 enum { Size = 5 };
456
458 typedef UInt16 Year;
459
461 typedef
464
466 typedef UInt8 Month;
467
469 typedef
472
474 typedef UInt8 Day;
475
477 typedef
480
482 typedef UInt8 Week;
483
485 typedef
488
495 : year_(NullYear::value()),
496 month_(NullMonth::value()),
497 day_(NullDay::value()),
498 week_(NullWeek::value())
499 {
500 }
501
505 Year year,
506 Month month,
507 Day day,
508 Week week)
510 : year_(year),
511 month_(month),
512 day_(day),
513 week_(week)
514 {
515 }
516
519 std::string
520 toString() const;
521
524 struct MemberTraits
525 {
526 enum { Count = 4 };
527
528 typedef Year FirstArgType;
529
530 typedef Month SecondArgType;
531
532 typedef Day ThirdArgType;
533
534 typedef Week FourthArgType;
535 };
536
538 void serialize(void* addr) const
540 {
541 assert(addr);
542
543 std::memcpy(addr, &year_, sizeof(year_));
544 addr = advanceByBytes(addr, sizeof(year_));
545
546 std::memcpy(addr, &month_, sizeof(month_));
547 addr = advanceByBytes(addr, sizeof(month_));
548
549 std::memcpy(addr, &day_, sizeof(day_));
550 addr = advanceByBytes(addr, sizeof(day_));
551
552 std::memcpy(addr, &week_, sizeof(week_));
553 }
554
557 Year year() const
559 {
560 return year_;
561 }
562
564 void setYear(Year value)
566 {
567 year_ = value;
568 }
569
572 {
573 year_ = NullYear();
574 }
575
578 bool month(Month& value) const
580 {
581 value = month_;
582 return NullMonth() != month_;
583 }
584
586 void setMonth(Month value)
588 {
589 month_ = value;
590 }
591
594 {
595 month_ = NullMonth();
596 }
597
600 bool day(Day& value) const
602 {
603 value = day_;
604 return NullDay() != day_;
605 }
606
608 void setDay(Day value)
610 {
611 day_ = value;
612 }
613
616 {
617 day_ = NullDay();
618 }
619
622 bool week(Week& value) const
624 {
625 value = week_;
626 return NullWeek() != week_;
627 }
628
630 void setWeek(Week value)
632 {
633 week_ = value;
634 }
635
638 {
639 week_ = NullWeek();
640 }
641
644 bool
645 operator==(
646 const MaturityMonthYear& other) const
648
651 bool
653 const MaturityMonthYear& other) const
655 {
656 return !(*this == other);
657 }
658
659private:
660 Year year_;
661 Month month_;
662 Day day_;
663 Week week_;
664};
665
666
669{
673
676 bool operator ==(const Value& other) const
678 {
679 return (
681 other.year());
682 }
683
686 bool operator !=(const Value& other) const
688 {
689 return !(*this == other);
690 }
691
694 operator Value() const
696 {
697 return Value();
698 }
699
704 {
705 return Value();
706 }
707
710 static Value value()
712 {
713 return Value();
714 }
715};
716
717inline
718bool
720 const MaturityMonthYear& other) const
722{
723 if((NullMaturityMonthYear() == *this) &&
724 (NullMaturityMonthYear() == other))
725 return true;
726
727 return
728 (this->year_ == other.year_) &&
729 (this->month_ == other.month_) &&
730 (this->day_ == other.day_) &&
731 (this->week_ == other.week_);
732}
733
735typedef
737<
738 Int64,
739 IntegralConstant<Int8, -9>
740>
742
745{
748 typedef PRICE9 Value;
749
751 typedef
754
755
758 bool operator ==(const Value& other) const
760 {
761 return (
762 NullMantissa() ==
763 other.mantissa());
764 }
765
768 bool operator !=(const Value& other) const
770 {
771 return !(*this == other);
772 }
773
776 operator Value() const
778 {
779 return Value(NullMantissa());
780 }
781
786 {
787 return Value(NullMantissa());
788 }
789
792 static Value value()
794 {
795 return Value(NullMantissa());
796 }
797};
798
801inline bool isNull(const PRICE9& value)
803{
804 return NullPRICE9() == value;
805}
806
807
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
Definition ABI.h:144
#define ONIXS_ILINK3_LTWT_STRUCT
Definition ABI.h:88
#define ONIXS_ILINK3_LTWT_CLASS
Definition ABI.h:84
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
Definition ABI.h:140
#define ONIXS_ILINK3_NODISCARD
Definition Compiler.h:185
#define ONIXS_ILINK3_CONSTEXPR
Definition Compiler.h:179
#define ONIXS_ILINK3_NOTHROW
Definition Compiler.h:176
A real number with a floating exponent.
Definition Decimal.h:39
void setNumInGroup(NumInGroup value) noexcept
Sets the numInGroup field.
Definition Composites.h:191
UInt16 BlockLength
Type alias for the BlockLength.
Definition Composites.h:152
UInt16 NumInGroup
Type alias for the NumInGroup.
Definition Composites.h:157
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition Composites.h:172
Repeating group dimensions.
Definition Composites.h:95
NumInGroup numInGroup() const noexcept
Definition Composites.h:123
void setNumInGroup(NumInGroup value) noexcept
Sets the numInGroup field.
Definition Composites.h:130
UInt8 NumInGroup
Type alias for the NumInGroup.
Definition Composites.h:104
UInt16 BlockLength
Type alias for the BlockLength.
Definition Composites.h:101
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition Composites.h:115
BlockLength blockLength() const noexcept
Definition Composites.h:108
bool week(Week &value) const noexcept
WW.
Definition Composites.h:622
constexpr MaturityMonthYear() noexcept
Default constructor.
Definition Composites.h:493
void setYear(Year value) noexcept
YYYY.
Definition Composites.h:564
IntegralConstant< UInt8, 255 > NullDay
Null value for an optional Day field.
Definition Composites.h:479
IntegralConstant< UInt16, 65535 > NullYear
Null value for an optional Year field.
Definition Composites.h:463
bool operator==(const MaturityMonthYear &other) const noexcept
Compares encoded data.
Definition Composites.h:719
bool month(Month &value) const noexcept
MM.
Definition Composites.h:578
bool operator!=(const MaturityMonthYear &other) const noexcept
Compares encoded data.
Definition Composites.h:652
constexpr MaturityMonthYear(Year year, Month month, Day day, Week week) noexcept
Initializes fields with provided values.
Definition Composites.h:504
bool day(Day &value) const noexcept
DD.
Definition Composites.h:600
void serialize(void *addr) const noexcept
Serializes to a data buffer.
Definition Composites.h:538
IntegralConstant< UInt8, 255 > NullWeek
Null value for an optional Week field.
Definition Composites.h:487
IntegralConstant< UInt8, 255 > NullMonth
Null value for an optional Month field.
Definition Composites.h:471
Template ID and length of message root.
Definition Composites.h:205
void setVersion(Version value) noexcept
Sets the version field.
Definition Composites.h:276
UInt16 SchemaId
Type alias for the SchemaId.
Definition Composites.h:217
UInt16 BlockLength
Type alias for the BlockLength.
Definition Composites.h:211
void setTemplateId(TemplateId value) noexcept
Sets the templateId field.
Definition Composites.h:246
UInt16 TemplateId
Type alias for the TemplateId.
Definition Composites.h:214
void setSchemaId(SchemaId value) noexcept
Sets the schemaId field.
Definition Composites.h:261
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition Composites.h:231
BlockLength blockLength() const noexcept
Definition Composites.h:224
UInt16 Version
Type alias for the Version.
Definition Composites.h:220
TemplateId templateId() const noexcept
Definition Composites.h:239
ONIXS_ILINK3_DATA_PACKING_END typedef FloatingPointDecimal< Int32, Int8 > Decimal32NULL
Optional floating point decimal with int32 mantissa and int8 exponent.
Definition Composites.h:301
FloatingPointDecimal< Int64, Int8 > Decimal64NULL
Optional floating point decimal.
Definition Composites.h:378
char Char
Character type alias.
Definition String.h:30
MessageHeader MessageHeaderBuilder
Definition Composites.h:290
std::basic_string_view< Char > StrRef
Definition StrRef.h:46
MessageHeader::SchemaId SchemaId
bool isNull(const Decimal32NULL &value) noexcept
Definition Composites.h:363
FixedPointDecimal< Int64, IntegralConstant< Int8, -9 > > PRICE9
Price with constant exponent -9.
Definition Composites.h:741
StrRef varData() const noexcept
Definition Composites.h:63
Length binarySize() const noexcept
Definition Composites.h:80
void length(Length value) noexcept
Sets the length.
Definition Composites.h:55
void varData(StrRef value) noexcept
Sets the varData field.
Definition Composites.h:70
Length length() const noexcept
Definition Composites.h:48
Null values definition for optional Decimal32NULL field.
Definition Composites.h:305
Decimal32NULL Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:308
IntegralConstant< Int32, 2147483647 > NullMantissa
Null value for an optional Mantissa field.
Definition Composites.h:313
constexpr Value operator()() const noexcept
Definition Composites.h:344
static constexpr Value value() noexcept
Definition Composites.h:352
Null values definition for optional Decimal64NULL field.
Definition Composites.h:382
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for an optional Mantissa field.
Definition Composites.h:390
Decimal64NULL Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:385
constexpr Value operator()() const noexcept
Definition Composites.h:421
static constexpr Value value() noexcept
Definition Composites.h:429
Null values definition for optional MaturityMonthYear field.
Definition Composites.h:669
constexpr Value operator()() const noexcept
Definition Composites.h:702
static constexpr Value value() noexcept
Definition Composites.h:710
MaturityMonthYear Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:672
Null values definition for optional PRICE9 field.
Definition Composites.h:745
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for an optional Mantissa field.
Definition Composites.h:753
PRICE9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:748
constexpr Value operator()() const noexcept
Definition Composites.h:784
static constexpr Value value() noexcept
Definition Composites.h:792