OnixS C++ CME iLink 3 Binary Order Entry Handler 1.19.0
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 noexcept
49 {
50 return length_;
51 }
52
54 void length(Length value) noexcept
55 {
56 length_ = value;
57 }
58
61 StrRef varData() const noexcept
62 {
63 return StrRef(reinterpret_cast<const Char*>(this) + Size, length());
64 }
65
67 void varData(StrRef value) noexcept
68 {
69 length(static_cast<Length>(value.size()));
70 if(value.data())
71 std::memcpy(reinterpret_cast<Char*>(this) + Size, value.data(), value.size());
72 }
73
76 Length binarySize() const noexcept
77 {
78 return Size + length();
79 }
80
81private:
82 Length length_;
83};
84
85
90{
91public:
93 enum { Size = 3 };
94
97
100
103 BlockLength blockLength() const noexcept
104 {
105 return blockLength_;
106 }
107
109 void setBlockLength(BlockLength value) noexcept
110 {
111 blockLength_ = value;
112 }
113
116 NumInGroup numInGroup() const noexcept
117 {
118 return numInGroup_;
119 }
120
122 void setNumInGroup(NumInGroup value) noexcept
123 {
124 numInGroup_ = value;
125 }
126
127private:
128 BlockLength blockLength_;
129 NumInGroup numInGroup_;
130};
131
132
135{
136public:
138 enum { Size = 4 };
139
144
149
154 BlockLength blockLength() const noexcept
155 {
156 return blockLength_;
157 }
158
162 void setBlockLength(BlockLength value) noexcept
163 {
164 blockLength_ = value;
165 }
166
171 NumInGroup numInGroup() const noexcept
172 {
173 return numInGroup_;
174 }
175
179 void setNumInGroup(NumInGroup value) noexcept
180 {
181 numInGroup_ = value;
182 }
183
184private:
185 BlockLength blockLength_;
186 NumInGroup numInGroup_;
187};
188
189
192{
193public:
195 enum { Size = 8 };
196
199
202
205
208
211 BlockLength blockLength() const noexcept
212 {
213 return blockLength_;
214 }
215
217 void setBlockLength(BlockLength value) noexcept
218 {
219 blockLength_ = value;
220 }
221
224 TemplateId templateId() const noexcept
225 {
226 return templateId_;
227 }
228
230 void setTemplateId(TemplateId value) noexcept
231 {
232 templateId_ = value;
233 }
234
237 SchemaId schemaId() const noexcept
238 {
239 return schemaId_;
240 }
241
243 void setSchemaId(SchemaId value) noexcept
244 {
245 schemaId_ = value;
246 }
247
250 Version version() const noexcept
251 {
252 return version_;
253 }
254
256 void setVersion(Version value) noexcept
257 {
258 version_ = value;
259 }
260
261private:
262 BlockLength blockLength_;
263 TemplateId templateId_;
264 SchemaId schemaId_;
265 Version version_;
266};
267
268
270
271ONIXS_ILINK3_DATA_PACKING_END
272
274typedef
276<
277 Int32,
278 Int8
279>
281
284{
288
290 typedef
293
294
297 bool operator ==(const Value& other) const noexcept
298 {
299 return (
300 NullMantissa() ==
301 other.mantissa());
302 }
303
306 bool operator !=(const Value& other) const noexcept
307 {
308 return !(*this == other);
309 }
310
312 constexpr
313 operator Value() const noexcept
314 {
315 return Value(NullMantissa(), 0);
316 }
317
319 constexpr
320 Value operator()() const noexcept
321 {
322 return Value(NullMantissa(), 0);
323 }
324
326 constexpr
327 static Value value() noexcept
328 {
329 return Value(NullMantissa(), 0);
330 }
331};
332
335inline
336bool
338 const Decimal32NULL& value) noexcept
339{
340 return NullDecimal32NULL() == value;
341}
342
343
345typedef
347<
348 Int64,
349 Int8
350>
352
355{
359
361 typedef
364
365
368 bool operator ==(const Value& other) const noexcept
369 {
370 return (
371 NullMantissa() ==
372 other.mantissa());
373 }
374
377 bool operator !=(const Value& other) const noexcept
378 {
379 return !(*this == other);
380 }
381
383 constexpr
384 operator Value() const noexcept
385 {
386 return Value(NullMantissa(), 0);
387 }
388
390 constexpr
391 Value operator()() const noexcept
392 {
393 return Value(NullMantissa(), 0);
394 }
395
397 constexpr
398 static Value value() noexcept
399 {
400 return Value(NullMantissa(), 0);
401 }
402};
403
406inline
407bool
409 const Decimal64NULL& value) noexcept
410{
411 return NullDecimal64NULL() == value;
412}
413
414
419{
420public:
422 enum { Size = 5 };
423
425 typedef UInt16 Year;
426
428 typedef
431
433 typedef UInt8 Month;
434
436 typedef
439
441 typedef UInt8 Day;
442
444 typedef
447
449 typedef UInt8 Week;
450
452 typedef
455
459 constexpr
461 : year_(NullYear::value()),
462 month_(NullMonth::value()),
463 day_(NullDay::value()),
464 week_(NullWeek::value())
465 {
466 }
467
469 constexpr
471 Year year,
472 Month month,
473 Day day,
474 Week week) noexcept
475 : year_(year),
476 month_(month),
477 day_(day),
478 week_(week)
479 {
480 }
481
484 std::string
485 toString() const;
486
489 struct MemberTraits
490 {
491 enum { Count = 4 };
492
493 typedef Year FirstArgType;
494
495 typedef Month SecondArgType;
496
497 typedef Day ThirdArgType;
498
499 typedef Week FourthArgType;
500 };
501
503 void serialize(void* addr) const noexcept
504 {
505 assert(addr);
506
507 std::memcpy(addr, &year_, sizeof(year_));
508 addr = advanceByBytes(addr, sizeof(year_));
509
510 std::memcpy(addr, &month_, sizeof(month_));
511 addr = advanceByBytes(addr, sizeof(month_));
512
513 std::memcpy(addr, &day_, sizeof(day_));
514 addr = advanceByBytes(addr, sizeof(day_));
515
516 std::memcpy(addr, &week_, sizeof(week_));
517 }
518
521 Year year() const noexcept
522 {
523 return year_;
524 }
525
527 void setYear(Year value) noexcept
528 {
529 year_ = value;
530 }
531
532 void setYearToNull() noexcept
533 {
534 year_ = NullYear();
535 }
536
539 bool month(Month& value) const noexcept
540 {
541 value = month_;
542 return NullMonth() != month_;
543 }
544
546 void setMonth(Month value) noexcept
547 {
548 month_ = value;
549 }
550
551 void setMonthToNull() noexcept
552 {
553 month_ = NullMonth();
554 }
555
558 bool day(Day& value) const noexcept
559 {
560 value = day_;
561 return NullDay() != day_;
562 }
563
565 void setDay(Day value) noexcept
566 {
567 day_ = value;
568 }
569
570 void setDayToNull() noexcept
571 {
572 day_ = NullDay();
573 }
574
577 bool week(Week& value) const noexcept
578 {
579 value = week_;
580 return NullWeek() != week_;
581 }
582
584 void setWeek(Week value) noexcept
585 {
586 week_ = value;
587 }
588
589 void setWeekToNull() noexcept
590 {
591 week_ = NullWeek();
592 }
593
596 bool
597 operator==(
598 const MaturityMonthYear& other) const noexcept;
599
602 bool
604 const MaturityMonthYear& other) const noexcept
605 {
606 return !(*this == other);
607 }
608
609private:
610 Year year_;
611 Month month_;
612 Day day_;
613 Week week_;
614};
615
616
619{
623
626 bool operator ==(const Value& other) const noexcept
627 {
628 return (
630 other.year());
631 }
632
635 bool operator !=(const Value& other) const noexcept
636 {
637 return !(*this == other);
638 }
639
641 constexpr
642 operator Value() const noexcept
643 {
644 return Value();
645 }
646
648 constexpr
649 Value operator()() const noexcept
650 {
651 return Value();
652 }
653
655 constexpr
656 static Value value() noexcept
657 {
658 return Value();
659 }
660};
661
662inline
663bool
665 const MaturityMonthYear& other) const noexcept
666{
667 if((NullMaturityMonthYear() == *this) &&
668 (NullMaturityMonthYear() == other))
669 return true;
670
671 return
672 (this->year_ == other.year_) &&
673 (this->month_ == other.month_) &&
674 (this->day_ == other.day_) &&
675 (this->week_ == other.week_);
676}
677
679typedef
681<
682 Int64,
683 IntegralConstant<Int8, -9>
684>
686
689{
692 typedef PRICE9 Value;
693
695 typedef
698
699
702 bool operator ==(const Value& other) const noexcept
703 {
704 return (
705 NullMantissa() ==
706 other.mantissa());
707 }
708
711 bool operator !=(const Value& other) const noexcept
712 {
713 return !(*this == other);
714 }
715
717 constexpr
718 operator Value() const noexcept
719 {
720 return Value(NullMantissa());
721 }
722
724 constexpr
725 Value operator()() const noexcept
726 {
727 return Value(NullMantissa());
728 }
729
731 constexpr
732 static Value value() noexcept
733 {
734 return Value(NullMantissa());
735 }
736};
737
740inline bool isNull(const PRICE9& value) noexcept
741{
742 return NullPRICE9() == value;
743}
744
745
#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:147
A real number with a floating exponent.
Definition Decimal.h:39
void setNumInGroup(NumInGroup value) noexcept
Sets the numInGroup field.
Definition Composites.h:179
UInt16 BlockLength
Type alias for the BlockLength.
Definition Composites.h:143
UInt16 NumInGroup
Type alias for the NumInGroup.
Definition Composites.h:148
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition Composites.h:162
Repeating group dimensions.
Definition Composites.h:90
NumInGroup numInGroup() const noexcept
Definition Composites.h:116
void setNumInGroup(NumInGroup value) noexcept
Sets the numInGroup field.
Definition Composites.h:122
UInt8 NumInGroup
Type alias for the NumInGroup.
Definition Composites.h:99
UInt16 BlockLength
Type alias for the BlockLength.
Definition Composites.h:96
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition Composites.h:109
BlockLength blockLength() const noexcept
Definition Composites.h:103
bool week(Week &value) const noexcept
WW.
Definition Composites.h:577
constexpr MaturityMonthYear() noexcept
Default constructor.
Definition Composites.h:460
void setYear(Year value) noexcept
YYYY.
Definition Composites.h:527
IntegralConstant< UInt8, 255 > NullDay
Null value for an optional Day field.
Definition Composites.h:446
IntegralConstant< UInt16, 65535 > NullYear
Null value for an optional Year field.
Definition Composites.h:430
bool operator==(const MaturityMonthYear &other) const noexcept
Compares encoded data.
Definition Composites.h:664
bool month(Month &value) const noexcept
MM.
Definition Composites.h:539
bool operator!=(const MaturityMonthYear &other) const noexcept
Compares encoded data.
Definition Composites.h:603
constexpr MaturityMonthYear(Year year, Month month, Day day, Week week) noexcept
Initializes fields with provided values.
Definition Composites.h:470
bool day(Day &value) const noexcept
DD.
Definition Composites.h:558
void serialize(void *addr) const noexcept
Serializes to a data buffer.
Definition Composites.h:503
IntegralConstant< UInt8, 255 > NullWeek
Null value for an optional Week field.
Definition Composites.h:454
IntegralConstant< UInt8, 255 > NullMonth
Null value for an optional Month field.
Definition Composites.h:438
Template ID and length of message root.
Definition Composites.h:192
void setVersion(Version value) noexcept
Sets the version field.
Definition Composites.h:256
UInt16 SchemaId
Type alias for the SchemaId.
Definition Composites.h:204
UInt16 BlockLength
Type alias for the BlockLength.
Definition Composites.h:198
void setTemplateId(TemplateId value) noexcept
Sets the templateId field.
Definition Composites.h:230
UInt16 TemplateId
Type alias for the TemplateId.
Definition Composites.h:201
void setSchemaId(SchemaId value) noexcept
Sets the schemaId field.
Definition Composites.h:243
void setBlockLength(BlockLength value) noexcept
Sets the blockLength field.
Definition Composites.h:217
BlockLength blockLength() const noexcept
Definition Composites.h:211
UInt16 Version
Type alias for the Version.
Definition Composites.h:207
TemplateId templateId() const noexcept
Definition Composites.h:224
ONIXS_ILINK3_DATA_PACKING_END typedef FloatingPointDecimal< Int32, Int8 > Decimal32NULL
Optional floating point decimal with int32 mantissa and int8 exponent.
Definition Composites.h:280
FloatingPointDecimal< Int64, Int8 > Decimal64NULL
Optional floating point decimal.
Definition Composites.h:351
char Char
Character type alias.
Definition String.h:30
MessageHeader MessageHeaderBuilder
Definition Composites.h:269
std::basic_string_view< Char > StrRef
Definition StrRef.h:46
MessageHeader::SchemaId SchemaId
bool isNull(const Decimal32NULL &value) noexcept
Definition Composites.h:337
FixedPointDecimal< Int64, IntegralConstant< Int8, -9 > > PRICE9
Price with constant exponent -9.
Definition Composites.h:685
StrRef varData() const noexcept
Definition Composites.h:61
Length binarySize() const noexcept
Definition Composites.h:76
void length(Length value) noexcept
Sets the length.
Definition Composites.h:54
void varData(StrRef value) noexcept
Sets the varData field.
Definition Composites.h:67
Length length() const noexcept
Definition Composites.h:48
Null values definition for optional Decimal32NULL field.
Definition Composites.h:284
Decimal32NULL Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:287
IntegralConstant< Int32, 2147483647 > NullMantissa
Null value for an optional Mantissa field.
Definition Composites.h:292
constexpr Value operator()() const noexcept
Definition Composites.h:320
static constexpr Value value() noexcept
Definition Composites.h:327
Null values definition for optional Decimal64NULL field.
Definition Composites.h:355
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for an optional Mantissa field.
Definition Composites.h:363
Decimal64NULL Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:358
constexpr Value operator()() const noexcept
Definition Composites.h:391
static constexpr Value value() noexcept
Definition Composites.h:398
Null values definition for optional MaturityMonthYear field.
Definition Composites.h:619
constexpr Value operator()() const noexcept
Definition Composites.h:649
static constexpr Value value() noexcept
Definition Composites.h:656
MaturityMonthYear Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:622
Null values definition for optional PRICE9 field.
Definition Composites.h:689
IntegralConstant< Int64, 9223372036854775807LL > NullMantissa
Null value for an optional Mantissa field.
Definition Composites.h:697
PRICE9 Value
Aliases the type whose null value traits are exposed by the given class.
Definition Composites.h:692
constexpr Value operator()() const noexcept
Definition Composites.h:725
static constexpr Value value() noexcept
Definition Composites.h:732