OnixS C++ CME iLink 3 Binary Order Entry Handler  1.14.0
API Documentation
Messages.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 
23 #include <cassert>
24 #include <stdexcept>
25 
26 #include <OnixS/CME/iLink3/ABI.h>
29 
31 
32 /// Negotiate.
35 : SbeMessage
36 {
37  /// Used template schema.
39 
40  /// This type alias.
42 
43  /// Message template ID from SBE schema.
44  enum { TemplateId = 500 };
45 
46  /// Initializes a blank instance.
48 
49  /// Initializes an instance over the given memory block.
51  void* data,
52  EncodedLength length,
53  SchemaVersion version = Schema::Version)
54  : SbeMessage(data, length, version)
55  {
56  checkVersion<Schema>(version);
57  checkLength(length, version);
58  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
59  reset();
60  }
61 
62  /// Initializes an instance over the given memory block
63  /// With no variable-length fields initialization
64  /// It is assumed that the user does such an initialization manually.
66  void* data,
67  EncodedLength length,
69  SchemaVersion version = Schema::Version)
70  : SbeMessage(data, length, version)
71  {
72  checkVersion<Schema>(version);
73  checkLength(length, version);
74  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
75  resetVariableFields();
76  }
77 
78  /// Creates an instance over the given memory block.
80  void* data,
81  EncodedLength length,
82  NoInit)
83  : SbeMessage(data, length)
84  {
85  checkCompatibility();
86  }
87 
88  /// Creates an instance over the given SBE message.
89  explicit
91  const SbeMessage& message)
92  : SbeMessage(message)
93  {
94  assert(message.valid());
95 
96  checkCompatibility();
97  }
98 
99  /// Creates an instance over the given memory block.
100  /// Performs no checks.
102  void* data,
103  EncodedLength length,
104  NoInit,
105  NoCheck)
107  : SbeMessage(data, length, NoCheck())
108  {
109  assert(schemaId() == Schema::Id);
110  assert(version() >= Schema::MinimalVersion);
111  assert(TemplateId == templateId());
112  }
113 
114  /// Constant value representing type of flow from customer to
115  /// CME.
121  {
122  return constructStrRef("IDEMPOTENT");
123  }
124 
125  /// Constant value representing CME HMAC version.
131  {
132  return constructStrRef("CME-1-SHA-256");
133  }
134 
135  /// Contains the HMAC signature.
139  {
142 
143  return fixedStr<length>(offset);
144  }
145 
146  /// Contains the HMAC signature.
147  ThisType& setHmacSignature(StrRef value)
149  {
152 
153  setFixedStr<length>(offset, value);
154  return *this;
155  }
156 
157  /// Contains the AccessKeyID assigned to this session on this
158  /// port.
162  {
165 
166  return fixedStr<length>(offset);
167  }
168 
169  /// Contains the AccessKeyID assigned to this session on this
170  /// port.
171  ThisType& setAccessKeyId(StrRef value)
173  {
176 
177  setFixedStr<length>(offset, value);
178  return *this;
179  }
180 
181  /// Session Identifier defined as type long (uInt64);
182  /// recommended to use timestamp as number of microseconds
183  /// since epoch (Jan 1, 1970).
185  UInt64 uuId() const
187  {
189 
190  return ordinary<UInt64>(offset);
191  }
192 
193  /// Session Identifier defined as type long (uInt64);
194  /// recommended to use timestamp as number of microseconds
195  /// since epoch (Jan 1, 1970).
196  ThisType& setUuId(UInt64 value)
198  {
200 
201  setOrdinary(offset, value);
202  return *this;
203  }
204 
205  /// Time of request; recommended to use timestamp as number of
206  /// nanoseconds since epoch (Jan 1, 1970).
210  {
212 
213  return ordinary<UInt64>(offset);
214  }
215 
216  /// Time of request; recommended to use timestamp as number of
217  /// nanoseconds since epoch (Jan 1, 1970).
218  ThisType& setRequestTimestamp(UInt64 value)
220  {
222 
223  setOrdinary(offset, value);
224  return *this;
225  }
226 
227  /// Session ID.
229  StrRef session() const
231  {
234 
235  return fixedStr<length>(offset);
236  }
237 
238  /// Session ID.
239  ThisType& setSession(StrRef value)
241  {
244 
245  setFixedStr<length>(offset, value);
246  return *this;
247  }
248 
249  /// Firm ID.
251  StrRef firm() const
253  {
256 
257  return fixedStr<length>(offset);
258  }
259 
260  /// Firm ID.
261  ThisType& setFirm(StrRef value)
263  {
266 
267  setFixedStr<length>(offset, value);
268  return *this;
269  }
270 
271  /// Not used and will be set to 0.
275  {
276  return getVariableLengthField(
277  CredentialsAccess(),
278  *this);
279  }
280 
281  /// Not used and will be set to 0.
282  ThisType& setCredentials(StrRef value)
283  {
284  setVariableLengthField(
285  CredentialsAccess(),
286  value,
287  *this);
288 
289  return *this;
290  }
291 
292  /// Minimal size of message body in bytes.
295  static
300  {
301  return
302  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
303  76;
304  }
305 
306  /// Size of message body in bytes.
311  {
312  return
313  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
314  minimalBlockLength(version);
315  }
316 
317  /// Minimal variable fields size (when variable-length fields are empty).
321  static
325  {
326  return
327  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
328  DATA::Size;
329  }
330 
331  /// Maximal message size.
337  {
338  return
339  SbeMessage::getMaxMessageSize();
340  }
341 
342  /// Reset all variable-length fields if any.
345  {
346  setCredentialsToNull();
347  return *this;
348  }
349 
350  /// Reset all variable-length and optional fields if any.
351  ThisType& reset()
353  {
354  resetVariableFields();
355  return *this;
356  }
357 
358  /// \return class name.
362  static const Char* className()
363  {
364  return "Negotiate500";
365  }
366 
367  /// FIX message type.
371  static StrRef fixType()
373  {
374  return constructStrRef("Negotiate");
375  }
376 
377  /// \return a human-readable presentation.
379  std::string toString() const;
380 
381  /// \return the end of the message.
383  const void* tail() const
385  {
386  return
387  toOpaquePtr(
388  (credentials().end()));
389  }
390 
391  /// \return the size occupied by the message.
395  {
396  return
397  SbeMessage::calculateBinarySize(tail());
398  }
399 
400 private:
401  void checkLength(
402  EncodedLength length, SchemaVersion version) const
403  {
404  const EncodedLength minimalRequiredLength =
405  minimalBlockLength(version) +
406  MessageHeader::Size +
407  getMinimalVariableFieldsSize(version);
408 
409  checkBinaryLength(
410  *this, length, minimalRequiredLength);
411  }
412 
413  /// Checks variable fields consistency.
414  void checkVarLenFields() const
415  {
416  variableLengthFields().
417  checkTail<DATA>();
418  }
419 
420  void checkCompatibility() const
421  {
422  assert(TemplateId == templateId());
423 
424  checkSchema<Schema>(schemaId(), version());
425  checkLength(bufferSize(), version());
426  checkVarLenFields();
427  }
428 
429  /// Access helper.
430  struct CredentialsAccess
431  {
432  DATA& operator()(const Negotiate500& obj) const
434  {
435  return obj.
436  variableLengthFields().
437  head<DATA>();
438  }
439  };
440 
441  /// Reset the field.
442  /// All the following data will be invalidated.
443  ThisType& setCredentialsToNull()
445  {
446  setVariableLengthFieldToNull(
447  CredentialsAccess(),
448  *this);
449 
450  return *this;
451  }
452 };
453 
454 /// NegotiationResponse.
457 : SbeMessage
458 {
459  /// Used template schema.
461 
462  /// This type alias.
464 
465  /// Message template ID from SBE schema.
466  enum { TemplateId = 501 };
467 
468  /// Initializes a blank instance.
470 
471  /// Initializes an instance over the given memory block.
473  void* data,
474  EncodedLength length,
475  SchemaVersion version = Schema::Version)
476  : SbeMessage(data, length, version)
477  {
478  checkVersion<Schema>(version);
479  checkLength(length, version);
480  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
481  reset();
482  }
483 
484  /// Initializes an instance over the given memory block
485  /// With no variable-length fields initialization
486  /// It is assumed that the user does such an initialization manually.
488  void* data,
489  EncodedLength length,
490  NoFieldsInit,
491  SchemaVersion version = Schema::Version)
492  : SbeMessage(data, length, version)
493  {
494  checkVersion<Schema>(version);
495  checkLength(length, version);
496  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
497  resetVariableFields();
498  }
499 
500  /// Creates an instance over the given memory block.
502  void* data,
503  EncodedLength length,
504  NoInit)
505  : SbeMessage(data, length)
506  {
507  checkCompatibility();
508  }
509 
510  /// Creates an instance over the given SBE message.
511  explicit
513  const SbeMessage& message)
514  : SbeMessage(message)
515  {
516  assert(message.valid());
517 
518  checkCompatibility();
519  }
520 
521  /// Creates an instance over the given memory block.
522  /// Performs no checks.
524  void* data,
525  EncodedLength length,
526  NoInit,
527  NoCheck)
529  : SbeMessage(data, length, NoCheck())
530  {
531  assert(schemaId() == Schema::Id);
532  assert(version() >= Schema::MinimalVersion);
533  assert(TemplateId == templateId());
534  }
535 
536  /// Constant value representing type of flow from CME to
537  /// customer.
543  {
544  return constructStrRef("RECOVERABLE");
545  }
546 
547  /// Matches Negotiate.UUID.
549  UInt64 uuId() const
551  {
553 
554  return ordinary<UInt64>(offset);
555  }
556 
557  /// Matches Negotiate.UUID.
558  ThisType& setUuId(UInt64 value)
560  {
562 
563  setOrdinary(offset, value);
564  return *this;
565  }
566 
567  /// Matches Negotiate.RequestTimestamp.
571  {
573 
574  return ordinary<UInt64>(offset);
575  }
576 
577  /// Matches Negotiate.RequestTimestamp.
578  ThisType& setRequestTimestamp(UInt64 value)
580  {
582 
583  setOrdinary(offset, value);
584  return *this;
585  }
586 
587  /// This indicates in how many days the HMAC secret key will
588  /// expire.
592  {
594 
595  return ordinary(value, offset, NullUInt16());
596  }
597 
598  /// This indicates in how many days the HMAC secret key will
599  /// expire.
602  {
604 
605  setOrdinary(offset, value);
606  return *this;
607  }
608 
611  {
613 
614  setOrdinary(offset, NullUInt16());
615  return *this;
616  }
617 
618  /// Indicates whether the connection is primary or backup.
622  {
624 
625  return enumeration<FTI>(value, offset, NullUInt8());
626  }
627 
628  /// Indicates whether the connection is primary or backup.
631  {
633 
634  setEnumeration<FTI>(offset, value);
635  return *this;
636  }
637 
640  {
642 
643  setOrdinary(offset, NullUInt8());
644  return *this;
645  }
646 
647  /// Indicates whether a message was delayed as a result of
648  /// being split among multiple packets (0) or if a message was
649  /// delayed as a result of TCP re-transmission (1) or if a
650  /// complete message was delayed due to a previously submitted
651  /// split or out of order message (2). If absent then the
652  /// message was not delayed and was neither split nor received
653  /// out of order.
655  bool splitMsg(SplitMsg::Enum& value) const
657  {
659 
660  return enumeration<SplitMsg>(value, offset, NullUInt8());
661  }
662 
663  /// Indicates whether a message was delayed as a result of
664  /// being split among multiple packets (0) or if a message was
665  /// delayed as a result of TCP re-transmission (1) or if a
666  /// complete message was delayed due to a previously submitted
667  /// split or out of order message (2). If absent then the
668  /// message was not delayed and was neither split nor received
669  /// out of order.
670  ThisType& setSplitMsg(SplitMsg::Enum value)
672  {
674 
675  setEnumeration<SplitMsg>(offset, value);
676  return *this;
677  }
678 
679  ThisType& setSplitMsgToNull()
681  {
683 
684  setOrdinary(offset, NullUInt8());
685  return *this;
686  }
687 
688  /// Refers to the SeqNum sent in the previous message before
689  /// this one from CME.
693  {
695 
696  return ordinary<UInt32>(offset);
697  }
698 
699  /// Refers to the SeqNum sent in the previous message before
700  /// this one from CME.
701  ThisType& setPreviousSeqNo(UInt32 value)
703  {
705 
706  setOrdinary(offset, value);
707  return *this;
708  }
709 
710  /// Refers to the UUID sent in the previous message before
711  /// this one from CME.
715  {
717 
718  return ordinary<UInt64>(offset);
719  }
720 
721  /// Refers to the UUID sent in the previous message before
722  /// this one from CME.
723  ThisType& setPreviousUUId(UInt64 value)
725  {
727 
728  setOrdinary(offset, value);
729  return *this;
730  }
731 
732  /// Not used and will be set to 0.
736  {
737  return getVariableLengthField(
738  CredentialsAccess(),
739  *this);
740  }
741 
742  /// Not used and will be set to 0.
743  ThisType& setCredentials(StrRef value)
744  {
745  setVariableLengthField(
746  CredentialsAccess(),
747  value,
748  *this);
749 
750  return *this;
751  }
752 
753  /// Minimal size of message body in bytes.
756  static
761  {
762  return
763  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
764  32;
765  }
766 
767  /// Size of message body in bytes.
772  {
773  return
774  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
775  minimalBlockLength(version);
776  }
777 
778  /// Minimal variable fields size (when variable-length fields are empty).
782  static
786  {
787  return
788  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
789  DATA::Size;
790  }
791 
792  /// Maximal message size.
798  {
799  return
800  SbeMessage::getMaxMessageSize();
801  }
802 
803  /// Reset all variable-length fields if any.
806  {
807  setCredentialsToNull();
808  return *this;
809  }
810 
811  /// Reset all variable-length and optional fields if any.
812  ThisType& reset()
814  {
815  setSecretKeySecureIdExpirationToNull();
816  setFaultToleranceIndicatorToNull();
817  setSplitMsgToNull();
818 
819  resetVariableFields();
820  return *this;
821  }
822 
823  /// \return class name.
827  static const Char* className()
828  {
829  return "NegotiationResponse501";
830  }
831 
832  /// FIX message type.
836  static StrRef fixType()
838  {
839  return constructStrRef("NegotiationResponse");
840  }
841 
842  /// \return a human-readable presentation.
844  std::string toString() const;
845 
846  /// \return the end of the message.
848  const void* tail() const
850  {
851  return
852  toOpaquePtr(
853  (credentials().end()));
854  }
855 
856  /// \return the size occupied by the message.
860  {
861  return
862  SbeMessage::calculateBinarySize(tail());
863  }
864 
865 private:
866  void checkLength(
867  EncodedLength length, SchemaVersion version) const
868  {
869  const EncodedLength minimalRequiredLength =
870  minimalBlockLength(version) +
871  MessageHeader::Size +
872  getMinimalVariableFieldsSize(version);
873 
874  checkBinaryLength(
875  *this, length, minimalRequiredLength);
876  }
877 
878  /// Checks variable fields consistency.
879  void checkVarLenFields() const
880  {
881  variableLengthFields().
882  checkTail<DATA>();
883  }
884 
885  void checkCompatibility() const
886  {
887  assert(TemplateId == templateId());
888 
889  checkSchema<Schema>(schemaId(), version());
890  checkLength(bufferSize(), version());
891  checkVarLenFields();
892  }
893 
894  /// Access helper.
895  struct CredentialsAccess
896  {
897  DATA&
898  operator()(
899  const NegotiationResponse501& obj) const
901  {
902  return obj.
903  variableLengthFields().
904  head<DATA>();
905  }
906  };
907 
908  /// Reset the field.
909  /// All the following data will be invalidated.
910  ThisType& setCredentialsToNull()
912  {
913  setVariableLengthFieldToNull(
914  CredentialsAccess(),
915  *this);
916 
917  return *this;
918  }
919 };
920 
921 /// NegotiationReject.
924 : SbeMessage
925 {
926  /// Used template schema.
928 
929  /// This type alias.
931 
932  /// Message template ID from SBE schema.
933  enum { TemplateId = 502 };
934 
935  /// Initializes a blank instance.
937 
938  /// Initializes an instance over the given memory block.
940  void* data,
941  EncodedLength length,
942  SchemaVersion version = Schema::Version)
943  : SbeMessage(data, length, version)
944  {
945  checkVersion<Schema>(version);
946  checkLength(length, version);
947  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
948  reset();
949  }
950 
951  /// Initializes an instance over the given memory block
952  /// With no variable-length fields initialization
953  /// It is assumed that the user does such an initialization manually.
955  void* data,
956  EncodedLength length,
957  NoFieldsInit,
958  SchemaVersion version = Schema::Version)
959  : SbeMessage(data, length, version)
960  {
961  checkVersion<Schema>(version);
962  checkLength(length, version);
963  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
964  resetVariableFields();
965  }
966 
967  /// Creates an instance over the given memory block.
969  void* data,
970  EncodedLength length,
971  NoInit)
972  : SbeMessage(data, length)
973  {
974  checkCompatibility();
975  }
976 
977  /// Creates an instance over the given SBE message.
978  explicit
980  const SbeMessage& message)
981  : SbeMessage(message)
982  {
983  assert(message.valid());
984 
985  checkCompatibility();
986  }
987 
988  /// Creates an instance over the given memory block.
989  /// Performs no checks.
991  void* data,
992  EncodedLength length,
993  NoInit,
994  NoCheck)
996  : SbeMessage(data, length, NoCheck())
997  {
998  assert(schemaId() == Schema::Id);
999  assert(version() >= Schema::MinimalVersion);
1000  assert(TemplateId == templateId());
1001  }
1002 
1003  /// Reject reason details.
1005  bool reason(StrRef& value) const
1007  {
1010 
1011  return fixedStr<length>(value, offset);
1012  }
1013 
1014  /// Reject reason details.
1015  ThisType& setReason(StrRef value)
1017  {
1020 
1021  setFixedStr<length>(offset, value);
1022  return *this;
1023  }
1024 
1025  ThisType& setReasonToNull()
1027  {
1030 
1031  setFixedStr<length>(offset, StrRef());
1032  return *this;
1033  }
1034 
1035  /// Matches Negotiate.UUID.
1037  UInt64 uuId() const
1039  {
1041 
1042  return ordinary<UInt64>(offset);
1043  }
1044 
1045  /// Matches Negotiate.UUID.
1046  ThisType& setUuId(UInt64 value)
1048  {
1050 
1051  setOrdinary(offset, value);
1052  return *this;
1053  }
1054 
1055  /// Matches Negotiate.RequestTimestamp.
1059  {
1061 
1062  return ordinary<UInt64>(offset);
1063  }
1064 
1065  /// Matches Negotiate.RequestTimestamp.
1066  ThisType& setRequestTimestamp(UInt64 value)
1068  {
1070 
1071  setOrdinary(offset, value);
1072  return *this;
1073  }
1074 
1075  /// Error code for reject reason.
1079  {
1081 
1082  return ordinary<UInt16>(offset);
1083  }
1084 
1085  /// Error code for reject reason.
1086  ThisType& setErrorCodes(UInt16 value)
1088  {
1090 
1091  setOrdinary(offset, value);
1092  return *this;
1093  }
1094 
1095  /// Indicates whether the connection is primary or backup.
1099  {
1101 
1102  return enumeration<FTI>(value, offset, NullUInt8());
1103  }
1104 
1105  /// Indicates whether the connection is primary or backup.
1108  {
1110 
1111  setEnumeration<FTI>(offset, value);
1112  return *this;
1113  }
1114 
1117  {
1119 
1120  setOrdinary(offset, NullUInt8());
1121  return *this;
1122  }
1123 
1124  /// Indicates whether a message was delayed as a result of
1125  /// being split among multiple packets (0) or if a message was
1126  /// delayed as a result of TCP re-transmission (1) or if a
1127  /// complete message was delayed due to a previously submitted
1128  /// split or out of order message (2). If absent then the
1129  /// message was not delayed and was neither split nor received
1130  /// out of order.
1132  bool splitMsg(SplitMsg::Enum& value) const
1134  {
1136 
1137  return enumeration<SplitMsg>(value, offset, NullUInt8());
1138  }
1139 
1140  /// Indicates whether a message was delayed as a result of
1141  /// being split among multiple packets (0) or if a message was
1142  /// delayed as a result of TCP re-transmission (1) or if a
1143  /// complete message was delayed due to a previously submitted
1144  /// split or out of order message (2). If absent then the
1145  /// message was not delayed and was neither split nor received
1146  /// out of order.
1147  ThisType& setSplitMsg(SplitMsg::Enum value)
1149  {
1151 
1152  setEnumeration<SplitMsg>(offset, value);
1153  return *this;
1154  }
1155 
1156  ThisType& setSplitMsgToNull()
1158  {
1160 
1161  setOrdinary(offset, NullUInt8());
1162  return *this;
1163  }
1164 
1165  /// Minimal size of message body in bytes.
1168  static
1169  BlockLength
1173  {
1174  return
1175  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
1176  68;
1177  }
1178 
1179  /// Size of message body in bytes.
1184  {
1185  return
1186  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
1187  minimalBlockLength(version);
1188  }
1189 
1190  /// Minimal variable fields size (when variable-length fields are empty).
1194  static
1195  MessageSize
1198  {
1199  return
1200  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
1201  0;
1202  }
1203 
1204  /// Maximal message size.
1210  {
1211  return
1212  static_cast<UInt64>(MessageHeaderBuilder::Size) +
1213  blockLength(Schema::Version);
1214  }
1215 
1216  /// Reset all variable-length fields if any.
1219  {
1220  return *this;
1221  }
1222 
1223  /// Reset all variable-length and optional fields if any.
1224  ThisType& reset()
1226  {
1227  setReasonToNull();
1228  setFaultToleranceIndicatorToNull();
1229  setSplitMsgToNull();
1230 
1231  resetVariableFields();
1232  return *this;
1233  }
1234 
1235  /// \return class name.
1239  static const Char* className()
1240  {
1241  return "NegotiationReject502";
1242  }
1243 
1244  /// FIX message type.
1248  static StrRef fixType()
1250  {
1251  return constructStrRef("NegotiationReject");
1252  }
1253 
1254  /// \return a human-readable presentation.
1256  std::string toString() const;
1257 
1258  /// \return the end of the message.
1260  const void* tail() const
1262  {
1263  return
1264  toOpaquePtr(
1265  advanceByBytes(
1266  binary(),
1267  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
1268  MessageHeader::Size));
1269  }
1270 
1271  /// \return the size occupied by the message.
1275  {
1276  return
1277  SbeMessage::calculateBinarySize(tail());
1278  }
1279 
1280 private:
1281  void checkLength(
1282  EncodedLength length, SchemaVersion version) const
1283  {
1284  const EncodedLength minimalRequiredLength =
1285  minimalBlockLength(version) +
1286  MessageHeader::Size +
1287  getMinimalVariableFieldsSize(version);
1288 
1289  checkBinaryLength(
1290  *this, length, minimalRequiredLength);
1291  }
1292 
1293  void checkCompatibility() const
1294  {
1295  assert(TemplateId == templateId());
1296 
1297  checkSchema<Schema>(schemaId(), version());
1298  checkLength(bufferSize(), version());
1299  }
1300 };
1301 
1302 /// Establish.
1305 : SbeMessage
1306 {
1307  /// Used template schema.
1309 
1310  /// This type alias.
1312 
1313  /// Message template ID from SBE schema.
1314  enum { TemplateId = 503 };
1315 
1316  /// Initializes a blank instance.
1318 
1319  /// Initializes an instance over the given memory block.
1321  void* data,
1322  EncodedLength length,
1323  SchemaVersion version = Schema::Version)
1324  : SbeMessage(data, length, version)
1325  {
1326  checkVersion<Schema>(version);
1327  checkLength(length, version);
1328  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
1329  reset();
1330  }
1331 
1332  /// Initializes an instance over the given memory block
1333  /// With no variable-length fields initialization
1334  /// It is assumed that the user does such an initialization manually.
1336  void* data,
1337  EncodedLength length,
1338  NoFieldsInit,
1339  SchemaVersion version = Schema::Version)
1340  : SbeMessage(data, length, version)
1341  {
1342  checkVersion<Schema>(version);
1343  checkLength(length, version);
1344  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
1345  resetVariableFields();
1346  }
1347 
1348  /// Creates an instance over the given memory block.
1350  void* data,
1351  EncodedLength length,
1352  NoInit)
1353  : SbeMessage(data, length)
1354  {
1355  checkCompatibility();
1356  }
1357 
1358  /// Creates an instance over the given SBE message.
1359  explicit
1361  const SbeMessage& message)
1362  : SbeMessage(message)
1363  {
1364  assert(message.valid());
1365 
1366  checkCompatibility();
1367  }
1368 
1369  /// Creates an instance over the given memory block.
1370  /// Performs no checks.
1372  void* data,
1373  EncodedLength length,
1374  NoInit,
1375  NoCheck)
1377  : SbeMessage(data, length, NoCheck())
1378  {
1379  assert(schemaId() == Schema::Id);
1380  assert(version() >= Schema::MinimalVersion);
1381  assert(TemplateId == templateId());
1382  }
1383 
1384  /// Constant value representing CME HMAC version.
1390  {
1391  return constructStrRef("CME-1-SHA-256");
1392  }
1393 
1394  /// Contains the HMAC signature.
1398  {
1401 
1402  return fixedStr<length>(offset);
1403  }
1404 
1405  /// Contains the HMAC signature.
1406  ThisType& setHmacSignature(StrRef value)
1408  {
1411 
1412  setFixedStr<length>(offset, value);
1413  return *this;
1414  }
1415 
1416  /// Contains the AccessKeyID assigned to this session on this
1417  /// port.
1421  {
1424 
1425  return fixedStr<length>(offset);
1426  }
1427 
1428  /// Contains the AccessKeyID assigned to this session on this
1429  /// port.
1430  ThisType& setAccessKeyId(StrRef value)
1432  {
1435 
1436  setFixedStr<length>(offset, value);
1437  return *this;
1438  }
1439 
1440  /// Provides the name of the application system being used to
1441  /// generate FIX application messages.
1445  {
1448 
1449  return fixedStr<length>(offset);
1450  }
1451 
1452  /// Provides the name of the application system being used to
1453  /// generate FIX application messages.
1454  ThisType& setTradingSystemName(StrRef value)
1456  {
1459 
1460  setFixedStr<length>(offset, value);
1461  return *this;
1462  }
1463 
1464  /// Provides the version of the application system being used
1465  /// to initiate FIX application messages.
1469  {
1472 
1473  return fixedStr<length>(offset);
1474  }
1475 
1476  /// Provides the version of the application system being used
1477  /// to initiate FIX application messages.
1480  {
1483 
1484  setFixedStr<length>(offset, value);
1485  return *this;
1486  }
1487 
1488  /// Provides the vendor of the application system.
1492  {
1495 
1496  return fixedStr<length>(offset);
1497  }
1498 
1499  /// Provides the vendor of the application system.
1502  {
1505 
1506  setFixedStr<length>(offset, value);
1507  return *this;
1508  }
1509 
1510  /// Session Identifier defined as type long (uInt64);
1511  /// recommended to use timestamp as number of microseconds
1512  /// since epoch (Jan 1, 1970).
1514  UInt64 uuId() const
1516  {
1518 
1519  return ordinary<UInt64>(offset);
1520  }
1521 
1522  /// Session Identifier defined as type long (uInt64);
1523  /// recommended to use timestamp as number of microseconds
1524  /// since epoch (Jan 1, 1970).
1525  ThisType& setUuId(UInt64 value)
1527  {
1529 
1530  setOrdinary(offset, value);
1531  return *this;
1532  }
1533 
1534  /// Time of request; recommended to use timestamp as number of
1535  /// nanoseconds since epoch (Jan 1, 1970).
1539  {
1541 
1542  return ordinary<UInt64>(offset);
1543  }
1544 
1545  /// Time of request; recommended to use timestamp as number of
1546  /// nanoseconds since epoch (Jan 1, 1970).
1547  ThisType& setRequestTimestamp(UInt64 value)
1549  {
1551 
1552  setOrdinary(offset, value);
1553  return *this;
1554  }
1555 
1556  /// Next expected message sequence number.
1560  {
1562 
1563  return ordinary<UInt32>(offset);
1564  }
1565 
1566  /// Next expected message sequence number.
1567  ThisType& setNextSeqNo(UInt32 value)
1569  {
1571 
1572  setOrdinary(offset, value);
1573  return *this;
1574  }
1575 
1576  /// Session ID.
1578  StrRef session() const
1580  {
1583 
1584  return fixedStr<length>(offset);
1585  }
1586 
1587  /// Session ID.
1588  ThisType& setSession(StrRef value)
1590  {
1593 
1594  setFixedStr<length>(offset, value);
1595  return *this;
1596  }
1597 
1598  /// Firm ID.
1600  StrRef firm() const
1602  {
1605 
1606  return fixedStr<length>(offset);
1607  }
1608 
1609  /// Firm ID.
1610  ThisType& setFirm(StrRef value)
1612  {
1615 
1616  setFixedStr<length>(offset, value);
1617  return *this;
1618  }
1619 
1620  /// The longest time in milliseconds the customer or CME could
1621  /// remain silent before sending a keep alive message.
1625  {
1627 
1628  return ordinary<UInt16>(offset);
1629  }
1630 
1631  /// The longest time in milliseconds the customer or CME could
1632  /// remain silent before sending a keep alive message.
1633  ThisType& setKeepAliveInterval(UInt16 value)
1635  {
1637 
1638  setOrdinary(offset, value);
1639  return *this;
1640  }
1641 
1642  /// Not used and will be set to 0.
1646  {
1647  return getVariableLengthField(
1648  CredentialsAccess(),
1649  *this);
1650  }
1651 
1652  /// Not used and will be set to 0.
1653  ThisType& setCredentials(StrRef value)
1654  {
1655  setVariableLengthField(
1656  CredentialsAccess(),
1657  value,
1658  *this);
1659 
1660  return *this;
1661  }
1662 
1663  /// Minimal size of message body in bytes.
1666  static
1667  BlockLength
1671  {
1672  return
1673  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
1674  132;
1675  }
1676 
1677  /// Size of message body in bytes.
1682  {
1683  return
1684  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
1685  minimalBlockLength(version);
1686  }
1687 
1688  /// Minimal variable fields size (when variable-length fields are empty).
1692  static
1693  MessageSize
1696  {
1697  return
1698  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
1699  DATA::Size;
1700  }
1701 
1702  /// Maximal message size.
1708  {
1709  return
1710  SbeMessage::getMaxMessageSize();
1711  }
1712 
1713  /// Reset all variable-length fields if any.
1716  {
1717  setCredentialsToNull();
1718  return *this;
1719  }
1720 
1721  /// Reset all variable-length and optional fields if any.
1722  ThisType& reset()
1724  {
1725  resetVariableFields();
1726  return *this;
1727  }
1728 
1729  /// \return class name.
1733  static const Char* className()
1734  {
1735  return "Establish503";
1736  }
1737 
1738  /// FIX message type.
1742  static StrRef fixType()
1744  {
1745  return constructStrRef("Establish");
1746  }
1747 
1748  /// \return a human-readable presentation.
1750  std::string toString() const;
1751 
1752  /// \return the end of the message.
1754  const void* tail() const
1756  {
1757  return
1758  toOpaquePtr(
1759  (credentials().end()));
1760  }
1761 
1762  /// \return the size occupied by the message.
1766  {
1767  return
1768  SbeMessage::calculateBinarySize(tail());
1769  }
1770 
1771 private:
1772  void checkLength(
1773  EncodedLength length, SchemaVersion version) const
1774  {
1775  const EncodedLength minimalRequiredLength =
1776  minimalBlockLength(version) +
1777  MessageHeader::Size +
1778  getMinimalVariableFieldsSize(version);
1779 
1780  checkBinaryLength(
1781  *this, length, minimalRequiredLength);
1782  }
1783 
1784  /// Checks variable fields consistency.
1785  void checkVarLenFields() const
1786  {
1787  variableLengthFields().
1788  checkTail<DATA>();
1789  }
1790 
1791  void checkCompatibility() const
1792  {
1793  assert(TemplateId == templateId());
1794 
1795  checkSchema<Schema>(schemaId(), version());
1796  checkLength(bufferSize(), version());
1797  checkVarLenFields();
1798  }
1799 
1800  /// Access helper.
1801  struct CredentialsAccess
1802  {
1803  DATA& operator()(const Establish503& obj) const
1805  {
1806  return obj.
1807  variableLengthFields().
1808  head<DATA>();
1809  }
1810  };
1811 
1812  /// Reset the field.
1813  /// All the following data will be invalidated.
1814  ThisType& setCredentialsToNull()
1816  {
1817  setVariableLengthFieldToNull(
1818  CredentialsAccess(),
1819  *this);
1820 
1821  return *this;
1822  }
1823 };
1824 
1825 /// EstablishmentAck.
1828 : SbeMessage
1829 {
1830  /// Used template schema.
1832 
1833  /// This type alias.
1835 
1836  /// Message template ID from SBE schema.
1837  enum { TemplateId = 504 };
1838 
1839  /// Initializes a blank instance.
1841 
1842  /// Initializes an instance over the given memory block.
1844  void* data,
1845  EncodedLength length,
1846  SchemaVersion version = Schema::Version)
1847  : SbeMessage(data, length, version)
1848  {
1849  checkVersion<Schema>(version);
1850  checkLength(length, version);
1851  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
1852  reset();
1853  }
1854 
1855  /// Initializes an instance over the given memory block
1856  /// With no variable-length fields initialization
1857  /// It is assumed that the user does such an initialization manually.
1859  void* data,
1860  EncodedLength length,
1861  NoFieldsInit,
1862  SchemaVersion version = Schema::Version)
1863  : SbeMessage(data, length, version)
1864  {
1865  checkVersion<Schema>(version);
1866  checkLength(length, version);
1867  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
1868  resetVariableFields();
1869  }
1870 
1871  /// Creates an instance over the given memory block.
1873  void* data,
1874  EncodedLength length,
1875  NoInit)
1876  : SbeMessage(data, length)
1877  {
1878  checkCompatibility();
1879  }
1880 
1881  /// Creates an instance over the given SBE message.
1882  explicit
1884  const SbeMessage& message)
1885  : SbeMessage(message)
1886  {
1887  assert(message.valid());
1888 
1889  checkCompatibility();
1890  }
1891 
1892  /// Creates an instance over the given memory block.
1893  /// Performs no checks.
1895  void* data,
1896  EncodedLength length,
1897  NoInit,
1898  NoCheck)
1900  : SbeMessage(data, length, NoCheck())
1901  {
1902  assert(schemaId() == Schema::Id);
1903  assert(version() >= Schema::MinimalVersion);
1904  assert(TemplateId == templateId());
1905  }
1906 
1907  /// Matches Establish.UUID.
1909  UInt64 uuId() const
1911  {
1913 
1914  return ordinary<UInt64>(offset);
1915  }
1916 
1917  /// Matches Establish.UUID.
1918  ThisType& setUuId(UInt64 value)
1920  {
1922 
1923  setOrdinary(offset, value);
1924  return *this;
1925  }
1926 
1927  /// Matches Establish.RequestTimestamp.
1931  {
1933 
1934  return ordinary<UInt64>(offset);
1935  }
1936 
1937  /// Matches Establish.RequestTimestamp.
1938  ThisType& setRequestTimestamp(UInt64 value)
1940  {
1942 
1943  setOrdinary(offset, value);
1944  return *this;
1945  }
1946 
1947  /// Next expected message sequence number.
1951  {
1953 
1954  return ordinary<UInt32>(offset);
1955  }
1956 
1957  /// Next expected message sequence number.
1958  ThisType& setNextSeqNo(UInt32 value)
1960  {
1962 
1963  setOrdinary(offset, value);
1964  return *this;
1965  }
1966 
1967  /// Refers to the SeqNum sent in the previous message before
1968  /// this one from CME.
1972  {
1974 
1975  return ordinary<UInt32>(offset);
1976  }
1977 
1978  /// Refers to the SeqNum sent in the previous message before
1979  /// this one from CME.
1980  ThisType& setPreviousSeqNo(UInt32 value)
1982  {
1984 
1985  setOrdinary(offset, value);
1986  return *this;
1987  }
1988 
1989  /// Refers to the UUID sent in the previous message before
1990  /// this one from CME.
1994  {
1996 
1997  return ordinary<UInt64>(offset);
1998  }
1999 
2000  /// Refers to the UUID sent in the previous message before
2001  /// this one from CME.
2002  ThisType& setPreviousUUId(UInt64 value)
2004  {
2006 
2007  setOrdinary(offset, value);
2008  return *this;
2009  }
2010 
2011  /// The longest time in milliseconds the customer or CME could
2012  /// remain silent before sending a keep alive message.
2016  {
2018 
2019  return ordinary<UInt16>(offset);
2020  }
2021 
2022  /// The longest time in milliseconds the customer or CME could
2023  /// remain silent before sending a keep alive message.
2024  ThisType& setKeepAliveInterval(UInt16 value)
2026  {
2028 
2029  setOrdinary(offset, value);
2030  return *this;
2031  }
2032 
2033  /// This indicates in how many days the HMAC secret key will
2034  /// expire.
2038  {
2040 
2041  return ordinary(value, offset, NullUInt16());
2042  }
2043 
2044  /// This indicates in how many days the HMAC secret key will
2045  /// expire.
2048  {
2050 
2051  setOrdinary(offset, value);
2052  return *this;
2053  }
2054 
2057  {
2059 
2060  setOrdinary(offset, NullUInt16());
2061  return *this;
2062  }
2063 
2064  /// Indicates whether the connection is primary or backup.
2068  {
2070 
2071  return enumeration<FTI>(value, offset, NullUInt8());
2072  }
2073 
2074  /// Indicates whether the connection is primary or backup.
2077  {
2079 
2080  setEnumeration<FTI>(offset, value);
2081  return *this;
2082  }
2083 
2086  {
2088 
2089  setOrdinary(offset, NullUInt8());
2090  return *this;
2091  }
2092 
2093  /// Indicates whether a message was delayed as a result of
2094  /// being split among multiple packets (0) or if a message was
2095  /// delayed as a result of TCP re-transmission (1) or if a
2096  /// complete message was delayed due to a previously submitted
2097  /// split or out of order message (2). If absent then the
2098  /// message was not delayed and was neither split nor received
2099  /// out of order.
2101  bool splitMsg(SplitMsg::Enum& value) const
2103  {
2105 
2106  return enumeration<SplitMsg>(value, offset, NullUInt8());
2107  }
2108 
2109  /// Indicates whether a message was delayed as a result of
2110  /// being split among multiple packets (0) or if a message was
2111  /// delayed as a result of TCP re-transmission (1) or if a
2112  /// complete message was delayed due to a previously submitted
2113  /// split or out of order message (2). If absent then the
2114  /// message was not delayed and was neither split nor received
2115  /// out of order.
2116  ThisType& setSplitMsg(SplitMsg::Enum value)
2118  {
2120 
2121  setEnumeration<SplitMsg>(offset, value);
2122  return *this;
2123  }
2124 
2125  ThisType& setSplitMsgToNull()
2127  {
2129 
2130  setOrdinary(offset, NullUInt8());
2131  return *this;
2132  }
2133 
2134  /// Minimal size of message body in bytes.
2137  static
2138  BlockLength
2142  {
2143  return
2144  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2145  38;
2146  }
2147 
2148  /// Size of message body in bytes.
2153  {
2154  return
2155  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2156  minimalBlockLength(version);
2157  }
2158 
2159  /// Minimal variable fields size (when variable-length fields are empty).
2163  static
2164  MessageSize
2167  {
2168  return
2169  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2170  0;
2171  }
2172 
2173  /// Maximal message size.
2179  {
2180  return
2181  static_cast<UInt64>(MessageHeaderBuilder::Size) +
2182  blockLength(Schema::Version);
2183  }
2184 
2185  /// Reset all variable-length fields if any.
2188  {
2189  return *this;
2190  }
2191 
2192  /// Reset all variable-length and optional fields if any.
2193  ThisType& reset()
2195  {
2196  setSecretKeySecureIdExpirationToNull();
2197  setFaultToleranceIndicatorToNull();
2198  setSplitMsgToNull();
2199 
2200  resetVariableFields();
2201  return *this;
2202  }
2203 
2204  /// \return class name.
2208  static const Char* className()
2209  {
2210  return "EstablishmentAck504";
2211  }
2212 
2213  /// FIX message type.
2217  static StrRef fixType()
2219  {
2220  return constructStrRef("EstablishmentAck");
2221  }
2222 
2223  /// \return a human-readable presentation.
2225  std::string toString() const;
2226 
2227  /// \return the end of the message.
2229  const void* tail() const
2231  {
2232  return
2233  toOpaquePtr(
2234  advanceByBytes(
2235  binary(),
2236  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
2237  MessageHeader::Size));
2238  }
2239 
2240  /// \return the size occupied by the message.
2244  {
2245  return
2246  SbeMessage::calculateBinarySize(tail());
2247  }
2248 
2249 private:
2250  void checkLength(
2251  EncodedLength length, SchemaVersion version) const
2252  {
2253  const EncodedLength minimalRequiredLength =
2254  minimalBlockLength(version) +
2255  MessageHeader::Size +
2256  getMinimalVariableFieldsSize(version);
2257 
2258  checkBinaryLength(
2259  *this, length, minimalRequiredLength);
2260  }
2261 
2262  void checkCompatibility() const
2263  {
2264  assert(TemplateId == templateId());
2265 
2266  checkSchema<Schema>(schemaId(), version());
2267  checkLength(bufferSize(), version());
2268  }
2269 };
2270 
2271 /// EstablishmentReject.
2274 : SbeMessage
2275 {
2276  /// Used template schema.
2278 
2279  /// This type alias.
2281 
2282  /// Message template ID from SBE schema.
2283  enum { TemplateId = 505 };
2284 
2285  /// Initializes a blank instance.
2287 
2288  /// Initializes an instance over the given memory block.
2290  void* data,
2291  EncodedLength length,
2292  SchemaVersion version = Schema::Version)
2293  : SbeMessage(data, length, version)
2294  {
2295  checkVersion<Schema>(version);
2296  checkLength(length, version);
2297  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
2298  reset();
2299  }
2300 
2301  /// Initializes an instance over the given memory block
2302  /// With no variable-length fields initialization
2303  /// It is assumed that the user does such an initialization manually.
2305  void* data,
2306  EncodedLength length,
2307  NoFieldsInit,
2308  SchemaVersion version = Schema::Version)
2309  : SbeMessage(data, length, version)
2310  {
2311  checkVersion<Schema>(version);
2312  checkLength(length, version);
2313  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
2314  resetVariableFields();
2315  }
2316 
2317  /// Creates an instance over the given memory block.
2319  void* data,
2320  EncodedLength length,
2321  NoInit)
2322  : SbeMessage(data, length)
2323  {
2324  checkCompatibility();
2325  }
2326 
2327  /// Creates an instance over the given SBE message.
2328  explicit
2330  const SbeMessage& message)
2331  : SbeMessage(message)
2332  {
2333  assert(message.valid());
2334 
2335  checkCompatibility();
2336  }
2337 
2338  /// Creates an instance over the given memory block.
2339  /// Performs no checks.
2341  void* data,
2342  EncodedLength length,
2343  NoInit,
2344  NoCheck)
2346  : SbeMessage(data, length, NoCheck())
2347  {
2348  assert(schemaId() == Schema::Id);
2349  assert(version() >= Schema::MinimalVersion);
2350  assert(TemplateId == templateId());
2351  }
2352 
2353  /// Reject reason details.
2355  bool reason(StrRef& value) const
2357  {
2360 
2361  return fixedStr<length>(value, offset);
2362  }
2363 
2364  /// Reject reason details.
2365  ThisType& setReason(StrRef value)
2367  {
2370 
2371  setFixedStr<length>(offset, value);
2372  return *this;
2373  }
2374 
2375  ThisType& setReasonToNull()
2377  {
2380 
2381  setFixedStr<length>(offset, StrRef());
2382  return *this;
2383  }
2384 
2385  /// Matches Establish.UUID.
2387  UInt64 uuId() const
2389  {
2391 
2392  return ordinary<UInt64>(offset);
2393  }
2394 
2395  /// Matches Establish.UUID.
2396  ThisType& setUuId(UInt64 value)
2398  {
2400 
2401  setOrdinary(offset, value);
2402  return *this;
2403  }
2404 
2405  /// Matches Establish.RequestTimestamp.
2409  {
2411 
2412  return ordinary<UInt64>(offset);
2413  }
2414 
2415  /// Matches Establish.RequestTimestamp.
2416  ThisType& setRequestTimestamp(UInt64 value)
2418  {
2420 
2421  setOrdinary(offset, value);
2422  return *this;
2423  }
2424 
2425  /// Next expected message sequence number.
2429  {
2431 
2432  return ordinary<UInt32>(offset);
2433  }
2434 
2435  /// Next expected message sequence number.
2436  ThisType& setNextSeqNo(UInt32 value)
2438  {
2440 
2441  setOrdinary(offset, value);
2442  return *this;
2443  }
2444 
2445  /// Error code for reject reason.
2449  {
2451 
2452  return ordinary<UInt16>(offset);
2453  }
2454 
2455  /// Error code for reject reason.
2456  ThisType& setErrorCodes(UInt16 value)
2458  {
2460 
2461  setOrdinary(offset, value);
2462  return *this;
2463  }
2464 
2465  /// Indicates whether the connection is primary or backup.
2469  {
2471 
2472  return enumeration<FTI>(value, offset, NullUInt8());
2473  }
2474 
2475  /// Indicates whether the connection is primary or backup.
2478  {
2480 
2481  setEnumeration<FTI>(offset, value);
2482  return *this;
2483  }
2484 
2487  {
2489 
2490  setOrdinary(offset, NullUInt8());
2491  return *this;
2492  }
2493 
2494  /// Indicates whether a message was delayed as a result of
2495  /// being split among multiple packets (0) or if a message was
2496  /// delayed as a result of TCP re-transmission (1) or if a
2497  /// complete message was delayed due to a previously submitted
2498  /// split or out of order message (2). If absent then the
2499  /// message was not delayed and was neither split nor received
2500  /// out of order.
2502  bool splitMsg(SplitMsg::Enum& value) const
2504  {
2506 
2507  return enumeration<SplitMsg>(value, offset, NullUInt8());
2508  }
2509 
2510  /// Indicates whether a message was delayed as a result of
2511  /// being split among multiple packets (0) or if a message was
2512  /// delayed as a result of TCP re-transmission (1) or if a
2513  /// complete message was delayed due to a previously submitted
2514  /// split or out of order message (2). If absent then the
2515  /// message was not delayed and was neither split nor received
2516  /// out of order.
2517  ThisType& setSplitMsg(SplitMsg::Enum value)
2519  {
2521 
2522  setEnumeration<SplitMsg>(offset, value);
2523  return *this;
2524  }
2525 
2526  ThisType& setSplitMsgToNull()
2528  {
2530 
2531  setOrdinary(offset, NullUInt8());
2532  return *this;
2533  }
2534 
2535  /// Minimal size of message body in bytes.
2538  static
2539  BlockLength
2543  {
2544  return
2545  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2546  72;
2547  }
2548 
2549  /// Size of message body in bytes.
2554  {
2555  return
2556  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2557  minimalBlockLength(version);
2558  }
2559 
2560  /// Minimal variable fields size (when variable-length fields are empty).
2564  static
2565  MessageSize
2568  {
2569  return
2570  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2571  0;
2572  }
2573 
2574  /// Maximal message size.
2580  {
2581  return
2582  static_cast<UInt64>(MessageHeaderBuilder::Size) +
2583  blockLength(Schema::Version);
2584  }
2585 
2586  /// Reset all variable-length fields if any.
2589  {
2590  return *this;
2591  }
2592 
2593  /// Reset all variable-length and optional fields if any.
2594  ThisType& reset()
2596  {
2597  setReasonToNull();
2598  setFaultToleranceIndicatorToNull();
2599  setSplitMsgToNull();
2600 
2601  resetVariableFields();
2602  return *this;
2603  }
2604 
2605  /// \return class name.
2609  static const Char* className()
2610  {
2611  return "EstablishmentReject505";
2612  }
2613 
2614  /// FIX message type.
2618  static StrRef fixType()
2620  {
2621  return constructStrRef("EstablishmentReject");
2622  }
2623 
2624  /// \return a human-readable presentation.
2626  std::string toString() const;
2627 
2628  /// \return the end of the message.
2630  const void* tail() const
2632  {
2633  return
2634  toOpaquePtr(
2635  advanceByBytes(
2636  binary(),
2637  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
2638  MessageHeader::Size));
2639  }
2640 
2641  /// \return the size occupied by the message.
2645  {
2646  return
2647  SbeMessage::calculateBinarySize(tail());
2648  }
2649 
2650 private:
2651  void checkLength(
2652  EncodedLength length, SchemaVersion version) const
2653  {
2654  const EncodedLength minimalRequiredLength =
2655  minimalBlockLength(version) +
2656  MessageHeader::Size +
2657  getMinimalVariableFieldsSize(version);
2658 
2659  checkBinaryLength(
2660  *this, length, minimalRequiredLength);
2661  }
2662 
2663  void checkCompatibility() const
2664  {
2665  assert(TemplateId == templateId());
2666 
2667  checkSchema<Schema>(schemaId(), version());
2668  checkLength(bufferSize(), version());
2669  }
2670 };
2671 
2672 /// Sequence.
2675 : SbeMessage
2676 {
2677  /// Used template schema.
2679 
2680  /// This type alias.
2682 
2683  /// Message template ID from SBE schema.
2684  enum { TemplateId = 506 };
2685 
2686  /// Initializes a blank instance.
2688 
2689  /// Initializes an instance over the given memory block.
2691  void* data,
2692  EncodedLength length,
2693  SchemaVersion version = Schema::Version)
2694  : SbeMessage(data, length, version)
2695  {
2696  checkVersion<Schema>(version);
2697  checkLength(length, version);
2698  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
2699  reset();
2700  }
2701 
2702  /// Initializes an instance over the given memory block
2703  /// With no variable-length fields initialization
2704  /// It is assumed that the user does such an initialization manually.
2706  void* data,
2707  EncodedLength length,
2708  NoFieldsInit,
2709  SchemaVersion version = Schema::Version)
2710  : SbeMessage(data, length, version)
2711  {
2712  checkVersion<Schema>(version);
2713  checkLength(length, version);
2714  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
2715  resetVariableFields();
2716  }
2717 
2718  /// Creates an instance over the given memory block.
2720  void* data,
2721  EncodedLength length,
2722  NoInit)
2723  : SbeMessage(data, length)
2724  {
2725  checkCompatibility();
2726  }
2727 
2728  /// Creates an instance over the given SBE message.
2729  explicit
2731  const SbeMessage& message)
2732  : SbeMessage(message)
2733  {
2734  assert(message.valid());
2735 
2736  checkCompatibility();
2737  }
2738 
2739  /// Creates an instance over the given memory block.
2740  /// Performs no checks.
2742  void* data,
2743  EncodedLength length,
2744  NoInit,
2745  NoCheck)
2747  : SbeMessage(data, length, NoCheck())
2748  {
2749  assert(schemaId() == Schema::Id);
2750  assert(version() >= Schema::MinimalVersion);
2751  assert(TemplateId == templateId());
2752  }
2753 
2754  /// Matches Establish.UUID used to establish the connection.
2756  UInt64 uuId() const
2758  {
2760 
2761  return ordinary<UInt64>(offset);
2762  }
2763 
2764  /// Matches Establish.UUID used to establish the connection.
2765  ThisType& setUuId(UInt64 value)
2767  {
2769 
2770  setOrdinary(offset, value);
2771  return *this;
2772  }
2773 
2774  /// Next expected message sequence number.
2778  {
2780 
2781  return ordinary<UInt32>(offset);
2782  }
2783 
2784  /// Next expected message sequence number.
2785  ThisType& setNextSeqNo(UInt32 value)
2787  {
2789 
2790  setOrdinary(offset, value);
2791  return *this;
2792  }
2793 
2794  /// Indicates whether the connection is primary or backup.
2798  {
2800 
2801  return enumeration<FTI>(value, offset, NullUInt8());
2802  }
2803 
2804  /// Indicates whether the connection is primary or backup.
2807  {
2809 
2810  setEnumeration<FTI>(offset, value);
2811  return *this;
2812  }
2813 
2816  {
2818 
2819  setOrdinary(offset, NullUInt8());
2820  return *this;
2821  }
2822 
2823  /// This indicates if the Sequence message being sent by CME
2824  /// is to warn that one keep alive interval has lapsed without
2825  /// any message received from customer (this can also be sent
2826  /// from customer to CME).
2830  {
2832 
2833  return enumeration<KeepAliveLapsed>(offset);
2834  }
2835 
2836  /// This indicates if the Sequence message being sent by CME
2837  /// is to warn that one keep alive interval has lapsed without
2838  /// any message received from customer (this can also be sent
2839  /// from customer to CME).
2840  ThisType&
2842  KeepAliveLapsed::Enum value)
2844  {
2846 
2847  setEnumeration<KeepAliveLapsed>(offset, value);
2848  return *this;
2849  }
2850 
2851  /// Minimal size of message body in bytes.
2854  static
2855  BlockLength
2859  {
2860  return
2861  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2862  14;
2863  }
2864 
2865  /// Size of message body in bytes.
2870  {
2871  return
2872  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2873  minimalBlockLength(version);
2874  }
2875 
2876  /// Minimal variable fields size (when variable-length fields are empty).
2880  static
2881  MessageSize
2884  {
2885  return
2886  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
2887  0;
2888  }
2889 
2890  /// Maximal message size.
2896  {
2897  return
2898  static_cast<UInt64>(MessageHeaderBuilder::Size) +
2899  blockLength(Schema::Version);
2900  }
2901 
2902  /// Reset all variable-length fields if any.
2905  {
2906  return *this;
2907  }
2908 
2909  /// Reset all variable-length and optional fields if any.
2910  ThisType& reset()
2912  {
2913  setFaultToleranceIndicatorToNull();
2914 
2915  resetVariableFields();
2916  return *this;
2917  }
2918 
2919  /// \return class name.
2923  static const Char* className()
2924  {
2925  return "Sequence506";
2926  }
2927 
2928  /// FIX message type.
2932  static StrRef fixType()
2934  {
2935  return constructStrRef("Sequence");
2936  }
2937 
2938  /// \return a human-readable presentation.
2940  std::string toString() const;
2941 
2942  /// \return the end of the message.
2944  const void* tail() const
2946  {
2947  return
2948  toOpaquePtr(
2949  advanceByBytes(
2950  binary(),
2951  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
2952  MessageHeader::Size));
2953  }
2954 
2955  /// \return the size occupied by the message.
2959  {
2960  return
2961  SbeMessage::calculateBinarySize(tail());
2962  }
2963 
2964 private:
2965  void checkLength(
2966  EncodedLength length, SchemaVersion version) const
2967  {
2968  const EncodedLength minimalRequiredLength =
2969  minimalBlockLength(version) +
2970  MessageHeader::Size +
2971  getMinimalVariableFieldsSize(version);
2972 
2973  checkBinaryLength(
2974  *this, length, minimalRequiredLength);
2975  }
2976 
2977  void checkCompatibility() const
2978  {
2979  assert(TemplateId == templateId());
2980 
2981  checkSchema<Schema>(schemaId(), version());
2982  checkLength(bufferSize(), version());
2983  }
2984 };
2985 
2986 /// Terminate.
2989 : SbeMessage
2990 {
2991  /// Used template schema.
2993 
2994  /// This type alias.
2996 
2997  /// Message template ID from SBE schema.
2998  enum { TemplateId = 507 };
2999 
3000  /// Initializes a blank instance.
3002 
3003  /// Initializes an instance over the given memory block.
3005  void* data,
3006  EncodedLength length,
3007  SchemaVersion version = Schema::Version)
3008  : SbeMessage(data, length, version)
3009  {
3010  checkVersion<Schema>(version);
3011  checkLength(length, version);
3012  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
3013  reset();
3014  }
3015 
3016  /// Initializes an instance over the given memory block
3017  /// With no variable-length fields initialization
3018  /// It is assumed that the user does such an initialization manually.
3020  void* data,
3021  EncodedLength length,
3022  NoFieldsInit,
3023  SchemaVersion version = Schema::Version)
3024  : SbeMessage(data, length, version)
3025  {
3026  checkVersion<Schema>(version);
3027  checkLength(length, version);
3028  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
3029  resetVariableFields();
3030  }
3031 
3032  /// Creates an instance over the given memory block.
3034  void* data,
3035  EncodedLength length,
3036  NoInit)
3037  : SbeMessage(data, length)
3038  {
3039  checkCompatibility();
3040  }
3041 
3042  /// Creates an instance over the given SBE message.
3043  explicit
3045  const SbeMessage& message)
3046  : SbeMessage(message)
3047  {
3048  assert(message.valid());
3049 
3050  checkCompatibility();
3051  }
3052 
3053  /// Creates an instance over the given memory block.
3054  /// Performs no checks.
3056  void* data,
3057  EncodedLength length,
3058  NoInit,
3059  NoCheck)
3061  : SbeMessage(data, length, NoCheck())
3062  {
3063  assert(schemaId() == Schema::Id);
3064  assert(version() >= Schema::MinimalVersion);
3065  assert(TemplateId == templateId());
3066  }
3067 
3068  /// Reject reason details.
3070  bool reason(StrRef& value) const
3072  {
3075 
3076  return fixedStr<length>(value, offset);
3077  }
3078 
3079  /// Reject reason details.
3080  ThisType& setReason(StrRef value)
3082  {
3085 
3086  setFixedStr<length>(offset, value);
3087  return *this;
3088  }
3089 
3090  ThisType& setReasonToNull()
3092  {
3095 
3096  setFixedStr<length>(offset, StrRef());
3097  return *this;
3098  }
3099 
3100  /// Matches Establish.UUID used to establish the connection.
3102  UInt64 uuId() const
3104  {
3106 
3107  return ordinary<UInt64>(offset);
3108  }
3109 
3110  /// Matches Establish.UUID used to establish the connection.
3111  ThisType& setUuId(UInt64 value)
3113  {
3115 
3116  setOrdinary(offset, value);
3117  return *this;
3118  }
3119 
3120  /// Time of request; recommended to use timestamp as number of
3121  /// nanoseconds since epoch (Jan 1, 1970).
3125  {
3127 
3128  return ordinary<UInt64>(offset);
3129  }
3130 
3131  /// Time of request; recommended to use timestamp as number of
3132  /// nanoseconds since epoch (Jan 1, 1970).
3133  ThisType& setRequestTimestamp(UInt64 value)
3135  {
3137 
3138  setOrdinary(offset, value);
3139  return *this;
3140  }
3141 
3142  /// Error code for reject reason.
3146  {
3148 
3149  return ordinary<UInt16>(offset);
3150  }
3151 
3152  /// Error code for reject reason.
3153  ThisType& setErrorCodes(UInt16 value)
3155  {
3157 
3158  setOrdinary(offset, value);
3159  return *this;
3160  }
3161 
3162  /// Indicates whether a message was delayed as a result of
3163  /// being split among multiple packets (0) or if a message was
3164  /// delayed as a result of TCP re-transmission (1) or if a
3165  /// complete message was delayed due to a previously submitted
3166  /// split or out of order message (2). If absent then the
3167  /// message was not delayed and was neither split nor received
3168  /// out of order.
3170  bool splitMsg(SplitMsg::Enum& value) const
3172  {
3174 
3175  return enumeration<SplitMsg>(value, offset, NullUInt8());
3176  }
3177 
3178  /// Indicates whether a message was delayed as a result of
3179  /// being split among multiple packets (0) or if a message was
3180  /// delayed as a result of TCP re-transmission (1) or if a
3181  /// complete message was delayed due to a previously submitted
3182  /// split or out of order message (2). If absent then the
3183  /// message was not delayed and was neither split nor received
3184  /// out of order.
3185  ThisType& setSplitMsg(SplitMsg::Enum value)
3187  {
3189 
3190  setEnumeration<SplitMsg>(offset, value);
3191  return *this;
3192  }
3193 
3194  ThisType& setSplitMsgToNull()
3196  {
3198 
3199  setOrdinary(offset, NullUInt8());
3200  return *this;
3201  }
3202 
3203  /// Minimal size of message body in bytes.
3206  static
3207  BlockLength
3211  {
3212  return
3213  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3214  67;
3215  }
3216 
3217  /// Size of message body in bytes.
3222  {
3223  return
3224  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3225  minimalBlockLength(version);
3226  }
3227 
3228  /// Minimal variable fields size (when variable-length fields are empty).
3232  static
3233  MessageSize
3236  {
3237  return
3238  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3239  0;
3240  }
3241 
3242  /// Maximal message size.
3248  {
3249  return
3250  static_cast<UInt64>(MessageHeaderBuilder::Size) +
3251  blockLength(Schema::Version);
3252  }
3253 
3254  /// Reset all variable-length fields if any.
3257  {
3258  return *this;
3259  }
3260 
3261  /// Reset all variable-length and optional fields if any.
3262  ThisType& reset()
3264  {
3265  setReasonToNull();
3266  setSplitMsgToNull();
3267 
3268  resetVariableFields();
3269  return *this;
3270  }
3271 
3272  /// \return class name.
3276  static const Char* className()
3277  {
3278  return "Terminate507";
3279  }
3280 
3281  /// FIX message type.
3285  static StrRef fixType()
3287  {
3288  return constructStrRef("Terminate");
3289  }
3290 
3291  /// \return a human-readable presentation.
3293  std::string toString() const;
3294 
3295  /// \return the end of the message.
3297  const void* tail() const
3299  {
3300  return
3301  toOpaquePtr(
3302  advanceByBytes(
3303  binary(),
3304  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
3305  MessageHeader::Size));
3306  }
3307 
3308  /// \return the size occupied by the message.
3312  {
3313  return
3314  SbeMessage::calculateBinarySize(tail());
3315  }
3316 
3317 private:
3318  void checkLength(
3319  EncodedLength length, SchemaVersion version) const
3320  {
3321  const EncodedLength minimalRequiredLength =
3322  minimalBlockLength(version) +
3323  MessageHeader::Size +
3324  getMinimalVariableFieldsSize(version);
3325 
3326  checkBinaryLength(
3327  *this, length, minimalRequiredLength);
3328  }
3329 
3330  void checkCompatibility() const
3331  {
3332  assert(TemplateId == templateId());
3333 
3334  checkSchema<Schema>(schemaId(), version());
3335  checkLength(bufferSize(), version());
3336  }
3337 };
3338 
3339 /// RetransmitRequest.
3342 : SbeMessage
3343 {
3344  /// Used template schema.
3346 
3347  /// This type alias.
3349 
3350  /// Message template ID from SBE schema.
3351  enum { TemplateId = 508 };
3352 
3353  /// Initializes a blank instance.
3355 
3356  /// Initializes an instance over the given memory block.
3358  void* data,
3359  EncodedLength length,
3360  SchemaVersion version = Schema::Version)
3361  : SbeMessage(data, length, version)
3362  {
3363  checkVersion<Schema>(version);
3364  checkLength(length, version);
3365  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
3366  reset();
3367  }
3368 
3369  /// Initializes an instance over the given memory block
3370  /// With no variable-length fields initialization
3371  /// It is assumed that the user does such an initialization manually.
3373  void* data,
3374  EncodedLength length,
3375  NoFieldsInit,
3376  SchemaVersion version = Schema::Version)
3377  : SbeMessage(data, length, version)
3378  {
3379  checkVersion<Schema>(version);
3380  checkLength(length, version);
3381  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
3382  resetVariableFields();
3383  }
3384 
3385  /// Creates an instance over the given memory block.
3387  void* data,
3388  EncodedLength length,
3389  NoInit)
3390  : SbeMessage(data, length)
3391  {
3392  checkCompatibility();
3393  }
3394 
3395  /// Creates an instance over the given SBE message.
3396  explicit
3398  const SbeMessage& message)
3399  : SbeMessage(message)
3400  {
3401  assert(message.valid());
3402 
3403  checkCompatibility();
3404  }
3405 
3406  /// Creates an instance over the given memory block.
3407  /// Performs no checks.
3409  void* data,
3410  EncodedLength length,
3411  NoInit,
3412  NoCheck)
3414  : SbeMessage(data, length, NoCheck())
3415  {
3416  assert(schemaId() == Schema::Id);
3417  assert(version() >= Schema::MinimalVersion);
3418  assert(TemplateId == templateId());
3419  }
3420 
3421  /// Matches Establish.UUID.
3423  UInt64 uuId() const
3425  {
3427 
3428  return ordinary<UInt64>(offset);
3429  }
3430 
3431  /// Matches Establish.UUID.
3432  ThisType& setUuId(UInt64 value)
3434  {
3436 
3437  setOrdinary(offset, value);
3438  return *this;
3439  }
3440 
3441  /// If RetransmitRequest is for a previous UUID then put that
3442  /// here otherwise put default null value.
3444  bool lastUUId(UInt64& value) const
3446  {
3448 
3449  return ordinary(value, offset, NullUInt64());
3450  }
3451 
3452  /// If RetransmitRequest is for a previous UUID then put that
3453  /// here otherwise put default null value.
3454  ThisType& setLastUUId(UInt64 value)
3456  {
3458 
3459  setOrdinary(offset, value);
3460  return *this;
3461  }
3462 
3463  ThisType& setLastUUIdToNull()
3465  {
3467 
3468  setOrdinary(offset, NullUInt64());
3469  return *this;
3470  }
3471 
3472  /// Time of request; recommended to use timestamp as number of
3473  /// nanoseconds since epoch (Jan 1, 1970).
3477  {
3479 
3480  return ordinary<UInt64>(offset);
3481  }
3482 
3483  /// Time of request; recommended to use timestamp as number of
3484  /// nanoseconds since epoch (Jan 1, 1970).
3485  ThisType& setRequestTimestamp(UInt64 value)
3487  {
3489 
3490  setOrdinary(offset, value);
3491  return *this;
3492  }
3493 
3494  /// Sequence number of the first business message requested.
3495  /// This should not be greater than the latest sequence number
3496  /// from CME.
3500  {
3502 
3503  return ordinary<UInt32>(offset);
3504  }
3505 
3506  /// Sequence number of the first business message requested.
3507  /// This should not be greater than the latest sequence number
3508  /// from CME.
3509  ThisType& setFromSeqNo(UInt32 value)
3511  {
3513 
3514  setOrdinary(offset, value);
3515  return *this;
3516  }
3517 
3518  /// Count of business messages requested.
3522  {
3524 
3525  return ordinary<UInt16>(offset);
3526  }
3527 
3528  /// Count of business messages requested.
3529  ThisType& setMsgCount(UInt16 value)
3531  {
3533 
3534  setOrdinary(offset, value);
3535  return *this;
3536  }
3537 
3538  /// Minimal size of message body in bytes.
3541  static
3542  BlockLength
3546  {
3547  return
3548  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3549  30;
3550  }
3551 
3552  /// Size of message body in bytes.
3557  {
3558  return
3559  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3560  minimalBlockLength(version);
3561  }
3562 
3563  /// Minimal variable fields size (when variable-length fields are empty).
3567  static
3568  MessageSize
3571  {
3572  return
3573  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3574  0;
3575  }
3576 
3577  /// Maximal message size.
3583  {
3584  return
3585  static_cast<UInt64>(MessageHeaderBuilder::Size) +
3586  blockLength(Schema::Version);
3587  }
3588 
3589  /// Reset all variable-length fields if any.
3592  {
3593  return *this;
3594  }
3595 
3596  /// Reset all variable-length and optional fields if any.
3597  ThisType& reset()
3599  {
3600  setLastUUIdToNull();
3601 
3602  resetVariableFields();
3603  return *this;
3604  }
3605 
3606  /// \return class name.
3610  static const Char* className()
3611  {
3612  return "RetransmitRequest508";
3613  }
3614 
3615  /// FIX message type.
3619  static StrRef fixType()
3621  {
3622  return constructStrRef("RetransmitRequest");
3623  }
3624 
3625  /// \return a human-readable presentation.
3627  std::string toString() const;
3628 
3629  /// \return the end of the message.
3631  const void* tail() const
3633  {
3634  return
3635  toOpaquePtr(
3636  advanceByBytes(
3637  binary(),
3638  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
3639  MessageHeader::Size));
3640  }
3641 
3642  /// \return the size occupied by the message.
3646  {
3647  return
3648  SbeMessage::calculateBinarySize(tail());
3649  }
3650 
3651 private:
3652  void checkLength(
3653  EncodedLength length, SchemaVersion version) const
3654  {
3655  const EncodedLength minimalRequiredLength =
3656  minimalBlockLength(version) +
3657  MessageHeader::Size +
3658  getMinimalVariableFieldsSize(version);
3659 
3660  checkBinaryLength(
3661  *this, length, minimalRequiredLength);
3662  }
3663 
3664  void checkCompatibility() const
3665  {
3666  assert(TemplateId == templateId());
3667 
3668  checkSchema<Schema>(schemaId(), version());
3669  checkLength(bufferSize(), version());
3670  }
3671 };
3672 
3673 /// Retransmission.
3676 : SbeMessage
3677 {
3678  /// Used template schema.
3680 
3681  /// This type alias.
3683 
3684  /// Message template ID from SBE schema.
3685  enum { TemplateId = 509 };
3686 
3687  /// Initializes a blank instance.
3689 
3690  /// Initializes an instance over the given memory block.
3692  void* data,
3693  EncodedLength length,
3694  SchemaVersion version = Schema::Version)
3695  : SbeMessage(data, length, version)
3696  {
3697  checkVersion<Schema>(version);
3698  checkLength(length, version);
3699  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
3700  reset();
3701  }
3702 
3703  /// Initializes an instance over the given memory block
3704  /// With no variable-length fields initialization
3705  /// It is assumed that the user does such an initialization manually.
3707  void* data,
3708  EncodedLength length,
3709  NoFieldsInit,
3710  SchemaVersion version = Schema::Version)
3711  : SbeMessage(data, length, version)
3712  {
3713  checkVersion<Schema>(version);
3714  checkLength(length, version);
3715  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
3716  resetVariableFields();
3717  }
3718 
3719  /// Creates an instance over the given memory block.
3721  void* data,
3722  EncodedLength length,
3723  NoInit)
3724  : SbeMessage(data, length)
3725  {
3726  checkCompatibility();
3727  }
3728 
3729  /// Creates an instance over the given SBE message.
3730  explicit
3732  const SbeMessage& message)
3733  : SbeMessage(message)
3734  {
3735  assert(message.valid());
3736 
3737  checkCompatibility();
3738  }
3739 
3740  /// Creates an instance over the given memory block.
3741  /// Performs no checks.
3743  void* data,
3744  EncodedLength length,
3745  NoInit,
3746  NoCheck)
3748  : SbeMessage(data, length, NoCheck())
3749  {
3750  assert(schemaId() == Schema::Id);
3751  assert(version() >= Schema::MinimalVersion);
3752  assert(TemplateId == templateId());
3753  }
3754 
3755  /// Matches RetransmitRequest.UUID.
3757  UInt64 uuId() const
3759  {
3761 
3762  return ordinary<UInt64>(offset);
3763  }
3764 
3765  /// Matches RetransmitRequest.UUID.
3766  ThisType& setUuId(UInt64 value)
3768  {
3770 
3771  setOrdinary(offset, value);
3772  return *this;
3773  }
3774 
3775  /// Matches RetransmitRequest.LastUUID.
3777  bool lastUUId(UInt64& value) const
3779  {
3781 
3782  return ordinary(value, offset, NullUInt64());
3783  }
3784 
3785  /// Matches RetransmitRequest.LastUUID.
3786  ThisType& setLastUUId(UInt64 value)
3788  {
3790 
3791  setOrdinary(offset, value);
3792  return *this;
3793  }
3794 
3795  ThisType& setLastUUIdToNull()
3797  {
3799 
3800  setOrdinary(offset, NullUInt64());
3801  return *this;
3802  }
3803 
3804  /// Matches RetransmitRequest.RequestTimestamp.
3808  {
3810 
3811  return ordinary<UInt64>(offset);
3812  }
3813 
3814  /// Matches RetransmitRequest.RequestTimestamp.
3815  ThisType& setRequestTimestamp(UInt64 value)
3817  {
3819 
3820  setOrdinary(offset, value);
3821  return *this;
3822  }
3823 
3824  /// Matches RetransmitRequest.FromSeqNo.
3828  {
3830 
3831  return ordinary<UInt32>(offset);
3832  }
3833 
3834  /// Matches RetransmitRequest.FromSeqNo.
3835  ThisType& setFromSeqNo(UInt32 value)
3837  {
3839 
3840  setOrdinary(offset, value);
3841  return *this;
3842  }
3843 
3844  /// Matches RetransmitRequest.MsgCount.
3848  {
3850 
3851  return ordinary<UInt16>(offset);
3852  }
3853 
3854  /// Matches RetransmitRequest.MsgCount.
3855  ThisType& setMsgCount(UInt16 value)
3857  {
3859 
3860  setOrdinary(offset, value);
3861  return *this;
3862  }
3863 
3864  /// Indicates whether a message was delayed as a result of
3865  /// being split among multiple packets (0) or if a message was
3866  /// delayed as a result of TCP re-transmission (1) or if a
3867  /// complete message was delayed due to a previously submitted
3868  /// split or out of order message (2). If absent then the
3869  /// message was not delayed and was neither split nor received
3870  /// out of order.
3872  bool splitMsg(SplitMsg::Enum& value) const
3874  {
3876 
3877  return enumeration<SplitMsg>(value, offset, NullUInt8());
3878  }
3879 
3880  /// Indicates whether a message was delayed as a result of
3881  /// being split among multiple packets (0) or if a message was
3882  /// delayed as a result of TCP re-transmission (1) or if a
3883  /// complete message was delayed due to a previously submitted
3884  /// split or out of order message (2). If absent then the
3885  /// message was not delayed and was neither split nor received
3886  /// out of order.
3887  ThisType& setSplitMsg(SplitMsg::Enum value)
3889  {
3891 
3892  setEnumeration<SplitMsg>(offset, value);
3893  return *this;
3894  }
3895 
3896  ThisType& setSplitMsgToNull()
3898  {
3900 
3901  setOrdinary(offset, NullUInt8());
3902  return *this;
3903  }
3904 
3905  /// Minimal size of message body in bytes.
3908  static
3909  BlockLength
3913  {
3914  return
3915  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3916  31;
3917  }
3918 
3919  /// Size of message body in bytes.
3924  {
3925  return
3926  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3927  minimalBlockLength(version);
3928  }
3929 
3930  /// Minimal variable fields size (when variable-length fields are empty).
3934  static
3935  MessageSize
3938  {
3939  return
3940  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
3941  0;
3942  }
3943 
3944  /// Maximal message size.
3950  {
3951  return
3952  static_cast<UInt64>(MessageHeaderBuilder::Size) +
3953  blockLength(Schema::Version);
3954  }
3955 
3956  /// Reset all variable-length fields if any.
3959  {
3960  return *this;
3961  }
3962 
3963  /// Reset all variable-length and optional fields if any.
3964  ThisType& reset()
3966  {
3967  setLastUUIdToNull();
3968  setSplitMsgToNull();
3969 
3970  resetVariableFields();
3971  return *this;
3972  }
3973 
3974  /// \return class name.
3978  static const Char* className()
3979  {
3980  return "Retransmission509";
3981  }
3982 
3983  /// FIX message type.
3987  static StrRef fixType()
3989  {
3990  return constructStrRef("Retransmission");
3991  }
3992 
3993  /// \return a human-readable presentation.
3995  std::string toString() const;
3996 
3997  /// \return the end of the message.
3999  const void* tail() const
4001  {
4002  return
4003  toOpaquePtr(
4004  advanceByBytes(
4005  binary(),
4006  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
4007  MessageHeader::Size));
4008  }
4009 
4010  /// \return the size occupied by the message.
4014  {
4015  return
4016  SbeMessage::calculateBinarySize(tail());
4017  }
4018 
4019 private:
4020  void checkLength(
4021  EncodedLength length, SchemaVersion version) const
4022  {
4023  const EncodedLength minimalRequiredLength =
4024  minimalBlockLength(version) +
4025  MessageHeader::Size +
4026  getMinimalVariableFieldsSize(version);
4027 
4028  checkBinaryLength(
4029  *this, length, minimalRequiredLength);
4030  }
4031 
4032  void checkCompatibility() const
4033  {
4034  assert(TemplateId == templateId());
4035 
4036  checkSchema<Schema>(schemaId(), version());
4037  checkLength(bufferSize(), version());
4038  }
4039 };
4040 
4041 /// RetransmitReject.
4044 : SbeMessage
4045 {
4046  /// Used template schema.
4048 
4049  /// This type alias.
4051 
4052  /// Message template ID from SBE schema.
4053  enum { TemplateId = 510 };
4054 
4055  /// Initializes a blank instance.
4057 
4058  /// Initializes an instance over the given memory block.
4060  void* data,
4061  EncodedLength length,
4062  SchemaVersion version = Schema::Version)
4063  : SbeMessage(data, length, version)
4064  {
4065  checkVersion<Schema>(version);
4066  checkLength(length, version);
4067  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
4068  reset();
4069  }
4070 
4071  /// Initializes an instance over the given memory block
4072  /// With no variable-length fields initialization
4073  /// It is assumed that the user does such an initialization manually.
4075  void* data,
4076  EncodedLength length,
4077  NoFieldsInit,
4078  SchemaVersion version = Schema::Version)
4079  : SbeMessage(data, length, version)
4080  {
4081  checkVersion<Schema>(version);
4082  checkLength(length, version);
4083  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
4084  resetVariableFields();
4085  }
4086 
4087  /// Creates an instance over the given memory block.
4089  void* data,
4090  EncodedLength length,
4091  NoInit)
4092  : SbeMessage(data, length)
4093  {
4094  checkCompatibility();
4095  }
4096 
4097  /// Creates an instance over the given SBE message.
4098  explicit
4100  const SbeMessage& message)
4101  : SbeMessage(message)
4102  {
4103  assert(message.valid());
4104 
4105  checkCompatibility();
4106  }
4107 
4108  /// Creates an instance over the given memory block.
4109  /// Performs no checks.
4111  void* data,
4112  EncodedLength length,
4113  NoInit,
4114  NoCheck)
4116  : SbeMessage(data, length, NoCheck())
4117  {
4118  assert(schemaId() == Schema::Id);
4119  assert(version() >= Schema::MinimalVersion);
4120  assert(TemplateId == templateId());
4121  }
4122 
4123  /// Reject reason details.
4125  bool reason(StrRef& value) const
4127  {
4130 
4131  return fixedStr<length>(value, offset);
4132  }
4133 
4134  /// Reject reason details.
4135  ThisType& setReason(StrRef value)
4137  {
4140 
4141  setFixedStr<length>(offset, value);
4142  return *this;
4143  }
4144 
4145  ThisType& setReasonToNull()
4147  {
4150 
4151  setFixedStr<length>(offset, StrRef());
4152  return *this;
4153  }
4154 
4155  /// Matches RetransmitRequest.UUID.
4157  UInt64 uuId() const
4159  {
4161 
4162  return ordinary<UInt64>(offset);
4163  }
4164 
4165  /// Matches RetransmitRequest.UUID.
4166  ThisType& setUuId(UInt64 value)
4168  {
4170 
4171  setOrdinary(offset, value);
4172  return *this;
4173  }
4174 
4175  /// Matches RetransmitRequest.LastUUID.
4177  bool lastUUId(UInt64& value) const
4179  {
4181 
4182  return ordinary(value, offset, NullUInt64());
4183  }
4184 
4185  /// Matches RetransmitRequest.LastUUID.
4186  ThisType& setLastUUId(UInt64 value)
4188  {
4190 
4191  setOrdinary(offset, value);
4192  return *this;
4193  }
4194 
4195  ThisType& setLastUUIdToNull()
4197  {
4199 
4200  setOrdinary(offset, NullUInt64());
4201  return *this;
4202  }
4203 
4204  /// Matches RetransmitRequest.RequestTimestamp.
4208  {
4210 
4211  return ordinary<UInt64>(offset);
4212  }
4213 
4214  /// Matches RetransmitRequest.RequestTimestamp.
4215  ThisType& setRequestTimestamp(UInt64 value)
4217  {
4219 
4220  setOrdinary(offset, value);
4221  return *this;
4222  }
4223 
4224  /// Error code for reject reason.
4228  {
4230 
4231  return ordinary<UInt16>(offset);
4232  }
4233 
4234  /// Error code for reject reason.
4235  ThisType& setErrorCodes(UInt16 value)
4237  {
4239 
4240  setOrdinary(offset, value);
4241  return *this;
4242  }
4243 
4244  /// Indicates whether a message was delayed as a result of
4245  /// being split among multiple packets (0) or if a message was
4246  /// delayed as a result of TCP re-transmission (1) or if a
4247  /// complete message was delayed due to a previously submitted
4248  /// split or out of order message (2). If absent then the
4249  /// message was not delayed and was neither split nor received
4250  /// out of order.
4252  bool splitMsg(SplitMsg::Enum& value) const
4254  {
4256 
4257  return enumeration<SplitMsg>(value, offset, NullUInt8());
4258  }
4259 
4260  /// Indicates whether a message was delayed as a result of
4261  /// being split among multiple packets (0) or if a message was
4262  /// delayed as a result of TCP re-transmission (1) or if a
4263  /// complete message was delayed due to a previously submitted
4264  /// split or out of order message (2). If absent then the
4265  /// message was not delayed and was neither split nor received
4266  /// out of order.
4267  ThisType& setSplitMsg(SplitMsg::Enum value)
4269  {
4271 
4272  setEnumeration<SplitMsg>(offset, value);
4273  return *this;
4274  }
4275 
4276  ThisType& setSplitMsgToNull()
4278  {
4280 
4281  setOrdinary(offset, NullUInt8());
4282  return *this;
4283  }
4284 
4285  /// Minimal size of message body in bytes.
4288  static
4289  BlockLength
4293  {
4294  return
4295  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
4296  75;
4297  }
4298 
4299  /// Size of message body in bytes.
4304  {
4305  return
4306  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
4307  minimalBlockLength(version);
4308  }
4309 
4310  /// Minimal variable fields size (when variable-length fields are empty).
4314  static
4315  MessageSize
4318  {
4319  return
4320  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
4321  0;
4322  }
4323 
4324  /// Maximal message size.
4330  {
4331  return
4332  static_cast<UInt64>(MessageHeaderBuilder::Size) +
4333  blockLength(Schema::Version);
4334  }
4335 
4336  /// Reset all variable-length fields if any.
4339  {
4340  return *this;
4341  }
4342 
4343  /// Reset all variable-length and optional fields if any.
4344  ThisType& reset()
4346  {
4347  setReasonToNull();
4348  setLastUUIdToNull();
4349  setSplitMsgToNull();
4350 
4351  resetVariableFields();
4352  return *this;
4353  }
4354 
4355  /// \return class name.
4359  static const Char* className()
4360  {
4361  return "RetransmitReject510";
4362  }
4363 
4364  /// FIX message type.
4368  static StrRef fixType()
4370  {
4371  return constructStrRef("RetransmitReject");
4372  }
4373 
4374  /// \return a human-readable presentation.
4376  std::string toString() const;
4377 
4378  /// \return the end of the message.
4380  const void* tail() const
4382  {
4383  return
4384  toOpaquePtr(
4385  advanceByBytes(
4386  binary(),
4387  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
4388  MessageHeader::Size));
4389  }
4390 
4391  /// \return the size occupied by the message.
4395  {
4396  return
4397  SbeMessage::calculateBinarySize(tail());
4398  }
4399 
4400 private:
4401  void checkLength(
4402  EncodedLength length, SchemaVersion version) const
4403  {
4404  const EncodedLength minimalRequiredLength =
4405  minimalBlockLength(version) +
4406  MessageHeader::Size +
4407  getMinimalVariableFieldsSize(version);
4408 
4409  checkBinaryLength(
4410  *this, length, minimalRequiredLength);
4411  }
4412 
4413  void checkCompatibility() const
4414  {
4415  assert(TemplateId == templateId());
4416 
4417  checkSchema<Schema>(schemaId(), version());
4418  checkLength(bufferSize(), version());
4419  }
4420 };
4421 
4422 /// NotApplied.
4425 : SbeMessage
4426 {
4427  /// Used template schema.
4429 
4430  /// This type alias.
4432 
4433  /// Message template ID from SBE schema.
4434  enum { TemplateId = 513 };
4435 
4436  /// Initializes a blank instance.
4438 
4439  /// Initializes an instance over the given memory block.
4441  void* data,
4442  EncodedLength length,
4443  SchemaVersion version = Schema::Version)
4444  : SbeMessage(data, length, version)
4445  {
4446  checkVersion<Schema>(version);
4447  checkLength(length, version);
4448  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
4449  reset();
4450  }
4451 
4452  /// Initializes an instance over the given memory block
4453  /// With no variable-length fields initialization
4454  /// It is assumed that the user does such an initialization manually.
4456  void* data,
4457  EncodedLength length,
4458  NoFieldsInit,
4459  SchemaVersion version = Schema::Version)
4460  : SbeMessage(data, length, version)
4461  {
4462  checkVersion<Schema>(version);
4463  checkLength(length, version);
4464  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
4465  resetVariableFields();
4466  }
4467 
4468  /// Creates an instance over the given memory block.
4470  void* data,
4471  EncodedLength length,
4472  NoInit)
4473  : SbeMessage(data, length)
4474  {
4475  checkCompatibility();
4476  }
4477 
4478  /// Creates an instance over the given SBE message.
4479  explicit
4481  const SbeMessage& message)
4482  : SbeMessage(message)
4483  {
4484  assert(message.valid());
4485 
4486  checkCompatibility();
4487  }
4488 
4489  /// Creates an instance over the given memory block.
4490  /// Performs no checks.
4492  void* data,
4493  EncodedLength length,
4494  NoInit,
4495  NoCheck)
4497  : SbeMessage(data, length, NoCheck())
4498  {
4499  assert(schemaId() == Schema::Id);
4500  assert(version() >= Schema::MinimalVersion);
4501  assert(TemplateId == templateId());
4502  }
4503 
4504  /// Matches Establish.UUID.
4506  UInt64 uuId() const
4508  {
4510 
4511  return ordinary<UInt64>(offset);
4512  }
4513 
4514  /// Matches Establish.UUID.
4515  ThisType& setUuId(UInt64 value)
4517  {
4519 
4520  setOrdinary(offset, value);
4521  return *this;
4522  }
4523 
4524  /// First not applied sequence number.
4528  {
4530 
4531  return ordinary<UInt32>(offset);
4532  }
4533 
4534  /// First not applied sequence number.
4535  ThisType& setFromSeqNo(UInt32 value)
4537  {
4539 
4540  setOrdinary(offset, value);
4541  return *this;
4542  }
4543 
4544  /// Count of how many messages have not been applied.
4548  {
4550 
4551  return ordinary<UInt32>(offset);
4552  }
4553 
4554  /// Count of how many messages have not been applied.
4555  ThisType& setMsgCount(UInt32 value)
4557  {
4559 
4560  setOrdinary(offset, value);
4561  return *this;
4562  }
4563 
4564  /// Indicates whether a message was delayed as a result of
4565  /// being split among multiple packets (0) or if a message was
4566  /// delayed as a result of TCP re-transmission (1) or if a
4567  /// complete message was delayed due to a previously submitted
4568  /// split or out of order message (2). If absent then the
4569  /// message was not delayed and was neither split nor received
4570  /// out of order. This is applicable only to the incoming
4571  /// message which triggers the gap detection and is not
4572  /// reflective of whether any message sent earlier as part of
4573  /// that sequence gap and not received by CME was delayed or
4574  /// not.
4576  bool splitMsg(SplitMsg::Enum& value) const
4578  {
4580 
4581  return enumeration<SplitMsg>(value, offset, NullUInt8());
4582  }
4583 
4584  /// Indicates whether a message was delayed as a result of
4585  /// being split among multiple packets (0) or if a message was
4586  /// delayed as a result of TCP re-transmission (1) or if a
4587  /// complete message was delayed due to a previously submitted
4588  /// split or out of order message (2). If absent then the
4589  /// message was not delayed and was neither split nor received
4590  /// out of order. This is applicable only to the incoming
4591  /// message which triggers the gap detection and is not
4592  /// reflective of whether any message sent earlier as part of
4593  /// that sequence gap and not received by CME was delayed or
4594  /// not.
4595  ThisType& setSplitMsg(SplitMsg::Enum value)
4597  {
4599 
4600  setEnumeration<SplitMsg>(offset, value);
4601  return *this;
4602  }
4603 
4604  ThisType& setSplitMsgToNull()
4606  {
4608 
4609  setOrdinary(offset, NullUInt8());
4610  return *this;
4611  }
4612 
4613  /// Minimal size of message body in bytes.
4616  static
4617  BlockLength
4621  {
4622  return
4623  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
4624  17;
4625  }
4626 
4627  /// Size of message body in bytes.
4632  {
4633  return
4634  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
4635  minimalBlockLength(version);
4636  }
4637 
4638  /// Minimal variable fields size (when variable-length fields are empty).
4642  static
4643  MessageSize
4646  {
4647  return
4648  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
4649  0;
4650  }
4651 
4652  /// Maximal message size.
4658  {
4659  return
4660  static_cast<UInt64>(MessageHeaderBuilder::Size) +
4661  blockLength(Schema::Version);
4662  }
4663 
4664  /// Reset all variable-length fields if any.
4667  {
4668  return *this;
4669  }
4670 
4671  /// Reset all variable-length and optional fields if any.
4672  ThisType& reset()
4674  {
4675  setSplitMsgToNull();
4676 
4677  resetVariableFields();
4678  return *this;
4679  }
4680 
4681  /// \return class name.
4685  static const Char* className()
4686  {
4687  return "NotApplied513";
4688  }
4689 
4690  /// FIX message type.
4694  static StrRef fixType()
4696  {
4697  return constructStrRef("NotApplied");
4698  }
4699 
4700  /// \return a human-readable presentation.
4702  std::string toString() const;
4703 
4704  /// \return the end of the message.
4706  const void* tail() const
4708  {
4709  return
4710  toOpaquePtr(
4711  advanceByBytes(
4712  binary(),
4713  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
4714  MessageHeader::Size));
4715  }
4716 
4717  /// \return the size occupied by the message.
4721  {
4722  return
4723  SbeMessage::calculateBinarySize(tail());
4724  }
4725 
4726 private:
4727  void checkLength(
4728  EncodedLength length, SchemaVersion version) const
4729  {
4730  const EncodedLength minimalRequiredLength =
4731  minimalBlockLength(version) +
4732  MessageHeader::Size +
4733  getMinimalVariableFieldsSize(version);
4734 
4735  checkBinaryLength(
4736  *this, length, minimalRequiredLength);
4737  }
4738 
4739  void checkCompatibility() const
4740  {
4741  assert(TemplateId == templateId());
4742 
4743  checkSchema<Schema>(schemaId(), version());
4744  checkLength(bufferSize(), version());
4745  }
4746 };
4747 
4748 /// NewOrderSingle.
4751 : SbeMessage
4752 {
4753  /// Used template schema.
4755 
4756  /// This type alias.
4758 
4759  /// Message template ID from SBE schema.
4760  enum { TemplateId = 514 };
4761 
4762  /// Initializes a blank instance.
4764 
4765  /// Initializes an instance over the given memory block.
4767  void* data,
4768  EncodedLength length,
4769  SchemaVersion version = Schema::Version)
4770  : SbeMessage(data, length, version)
4771  {
4772  checkVersion<Schema>(version);
4773  checkLength(length, version);
4774  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
4775  reset();
4776  }
4777 
4778  /// Initializes an instance over the given memory block
4779  /// With no variable-length fields initialization
4780  /// It is assumed that the user does such an initialization manually.
4782  void* data,
4783  EncodedLength length,
4784  NoFieldsInit,
4785  SchemaVersion version = Schema::Version)
4786  : SbeMessage(data, length, version)
4787  {
4788  checkVersion<Schema>(version);
4789  checkLength(length, version);
4790  init(TemplateId, minimalBlockLength(version), blockLength(version), Schema::Id);
4791  resetVariableFields();
4792  }
4793 
4794  /// Creates an instance over the given memory block.
4796  void* data,
4797  EncodedLength length,
4798  NoInit)
4799  : SbeMessage(data, length)
4800  {
4801  checkCompatibility();
4802  }
4803 
4804  /// Creates an instance over the given SBE message.
4805  explicit
4807  const SbeMessage& message)
4808  : SbeMessage(message)
4809  {
4810  assert(message.valid());
4811 
4812  checkCompatibility();
4813  }
4814 
4815  /// Creates an instance over the given memory block.
4816  /// Performs no checks.
4818  void* data,
4819  EncodedLength length,
4820  NoInit,
4821  NoCheck)
4823  : SbeMessage(data, length, NoCheck())
4824  {
4825  assert(schemaId() == Schema::Id);
4826  assert(version() >= Schema::MinimalVersion);
4827  assert(TemplateId == templateId());
4828  }
4829 
4830  /// Price per share or contract. Conditionally required if the
4831  /// order type requires a price (not market orders).
4833  bool price(PRICE9& value) const
4835  {
4837 
4838  return decimal(value, offset, NullPRICE9());
4839  }
4840 
4841  /// Price per share or contract. Conditionally required if the
4842  /// order type requires a price (not market orders).
4843  ThisType& setPrice(PRICE9 value)
4845  {
4847 
4848  setOrdinary(offset, value);
4849  return *this;
4850  }
4851 
4852  ThisType& setPriceToNull()
4854  {
4856 
4857  setOrdinary(offset, NullPRICE9());
4858  return *this;
4859  }
4860 
4861  /// Number of shares or contracts ordered.
4865  {
4867 
4868  return ordinary<UInt32>(offset);
4869  }
4870 
4871  /// Number of shares or contracts ordered.
4872  ThisType& setOrderQty(UInt32 value)
4874  {
4876 
4877  setOrdinary(offset, value);
4878  return *this;
4879  }
4880 
4881  /// Security ID as defined by CME. For the security ID list,
4882  /// see the security definition messages.
4886  {
4888 
4889  return ordinary<Int32>(offset);
4890  }
4891 
4892  /// Security ID as defined by CME. For the security ID list,
4893  /// see the security definition messages.
4894  ThisType& setSecurityId(Int32 value)
4896  {
4898 
4899  setOrdinary(offset, value);
4900  return *this;
4901  }
4902 
4903  /// Side of order.
4907  {
4909 
4910  return enumeration<SideReq>(offset);
4911  }
4912 
4913  /// Side of order.
4914  ThisType& setSide(SideReq::Enum value)
4916  {
4918 
4919  setEnumeration<SideReq>(offset, value);
4920  return *this;
4921  }
4922 
4923  /// Sequence number as assigned to message.
4925  UInt32 seqNum() const
4927  {
4929 
4930  return ordinary<UInt32>(offset);
4931  }
4932 
4933  /// Sequence number as assigned to message.
4934  ThisType& setSeqNum(UInt32 value)
4936  {
4938 
4939  setOrdinary(offset, value);
4940  return *this;
4941  }
4942 
4943  /// Operator ID. Should be unique per Firm ID. Assigned value
4944  /// used to identify specific message originator. Represents
4945  /// last individual or team in charge of the system which
4946  /// modifies the order before submission to the Globex
4947  /// platform, or if not modified from initiator (party
4948  /// role=118), last individual or team in charge of the
4949  /// system, which submit the order to the Globex platform.
4953  {
4956 
4957  return fixedStr<length>(offset);
4958  }
4959 
4960  /// Operator ID. Should be unique per Firm ID. Assigned value
4961  /// used to identify specific message originator. Represents
4962  /// last individual or team in charge of the system which
4963  /// modifies the order before submission to the Globex
4964  /// platform, or if not modified from initiator (party
4965  /// role=118), last individual or team in charge of the
4966  /// system, which submit the order to the Globex platform.
4967  ThisType& setSenderId(StrRef value)
4969  {
4972 
4973  setFixedStr<length>(offset, value);
4974  return *this;
4975  }
4976 
4977  /// Unique identifier for Order as assigned by the buy-side
4978  /// (institution, broker, intermediary etc.). Uniqueness must
4979  /// be guaranteed within a single trading day. Firms,
4980  /// particularly those which electronically submit multi-day
4981  /// orders, trade globally or throughout market close periods,
4982  /// should ensure uniqueness across days, for example by
4983  /// embedding a date within the ClOrdID field.
4985  StrRef clOrdId() const
4987  {
4990 
4991  return fixedStr<length>(offset);
4992  }
4993 
4994  /// Unique identifier for Order as assigned by the buy-side
4995  /// (institution, broker, intermediary etc.). Uniqueness must
4996  /// be guaranteed within a single trading day. Firms,
4997  /// particularly those which electronically submit multi-day
4998  /// orders, trade globally or throughout market close periods,
4999  /// should ensure uniqueness across days, for example by
5000  /// embedding a date within the ClOrdID field.
5001  ThisType& setClOrdId(StrRef value)
5003  {
5006 
5007  setFixedStr<length>(offset, value);
5008  return *this;
5009  }
5010 
5011  /// Refers to the ID of the related
5012  /// PartyDetailsDefinitionRequest message which will logically
5013  /// be tied to this message.
5017  {
5019 
5020  return ordinary<UInt64>(offset);
5021  }
5022 
5023  /// Refers to the ID of the related
5024  /// PartyDetailsDefinitionRequest message which will logically
5025  /// be tied to this message.
5028  {
5030 
5031  setOrdinary(offset, value);
5032  return *this;
5033  }
5034 
5035  /// Use OrderRequestID to identify a request to enter, modify
5036  /// or delete an order and echo the value on the
5037  /// ExecutionReport representing the response.
5041  {
5043 
5044  return ordinary<UInt64>(offset);
5045  }
5046 
5047  /// Use OrderRequestID to identify a request to enter, modify
5048  /// or delete an order and echo the value on the
5049  /// ExecutionReport representing the response.
5050  ThisType& setOrderRequestId(UInt64 value)
5052  {
5054 
5055  setOrdinary(offset, value);
5056  return *this;
5057  }
5058 
5059  /// Time when the message is sent. 64-bit integer expressing
5060  /// the number of nano seconds since midnight January 1, 1970.
5064  {
5066 
5067  return ordinary<UInt64>(offset);
5068  }
5069 
5070  /// Time when the message is sent. 64-bit integer expressing
5071  /// the number of nano seconds since midnight January 1, 1970.
5072  ThisType& setSendingTimeEpoch(UInt64 value)
5074  {
5076 
5077  setOrdinary(offset, value);
5078  return *this;
5079  }
5080 
5081  /// The stop price of a stop protect or stop limit order.
5082  /// (Conditionally required if OrdType = 3 or 4).
5084  bool stopPx(PRICE9& value) const
5086  {
5088 
5089  return decimal(value, offset, NullPRICE9());
5090  }
5091 
5092  /// The stop price of a stop protect or stop limit order.
5093  /// (Conditionally required if OrdType = 3 or 4).
5094  ThisType& setStopPx(PRICE9 value)
5096  {
5098 
5099  setOrdinary(offset, value);
5100  return *this;
5101  }
5102 
5103  ThisType& setStopPxToNull()
5105  {
5107 
5108  setOrdinary(offset, NullPRICE9());
5109  return *this;
5110  }
5111 
5112  /// Text describing sender's location (i.e. geopraphic
5113  /// location and/or desk).
5117  {
5120 
5121  return fixedStr<length>(offset);
5122  }
5123 
5124  /// Text describing sender's location (i.e. geopraphic
5125  /// location and/or desk).
5126  ThisType& setLocation(StrRef value)
5128  {
5131 
5132  setFixedStr<length>(offset, value);
5133  return *this;
5134  }
5135 
5136  /// Minimum quantity of an order to be executed.
5138  bool minQty(UInt32& value) const
5140  {
5142 
5143  return ordinary(value, offset, NullUInt32());
5144  }
5145 
5146  /// Minimum quantity of an order to be executed.
5147  ThisType& setMinQty(UInt32 value)
5149  {
5151 
5152  setOrdinary(offset, value);
5153  return *this;
5154  }
5155 
5156  ThisType& setMinQtyToNull()
5158  {
5160 
5161  setOrdinary(offset, NullUInt32());
5162  return *this;
5163  }
5164 
5165  /// The quantity to be displayed . Required for iceberg
5166  /// orders. On orders specifies the qty to be displayed, on
5167  /// execution reports the currently displayed quantity.
5169  bool displayQty(UInt32& value) const
5171  {
5173 
5174  return ordinary(value, offset, NullUInt32());
5175  }
5176 
5177  /// The quantity to be displayed . Required for iceberg
5178  /// orders. On orders specifies the qty to be displayed, on
5179  /// execution reports the currently displayed quantity.
5180  ThisType& setDisplayQty(UInt32 value)
5182  {
5184 
5185  setOrdinary(offset, value);
5186  return *this;
5187  }
5188 
5191  {
5193 
5194  setOrdinary(offset, NullUInt32());
5195  return *this;
5196  }
5197 
5198  /// Date of order expiration (last day the order can trade),
5199  /// always expressed in terms of the local market date.
5200  /// Applicable only to GTD orders which expire at the end of
5201  /// the trading session specified. This has to be a future or
5202  /// current session date and cannot be in the past.
5204  bool expireDate(Timestamp& value) const
5206  {
5207  typedef LocalMktDate FieldValue;
5208 
5210 
5211  FieldValue fieldValue;
5212 
5213  if (ordinary(fieldValue, offset, NullLocalMktDate()))
5214  {
5215  value = localMktDateToTimestamp(fieldValue);
5216  return true;
5217  }
5218  return false;
5219  }
5220 
5221  /// Date of order expiration (last day the order can trade),
5222  /// always expressed in terms of the local market date.
5223  /// Applicable only to GTD orders which expire at the end of
5224  /// the trading session specified. This has to be a future or
5225  /// current session date and cannot be in the past.
5226  ThisType& setExpireDate(Timestamp value)
5228  {
5230 
5231  setOrdinary(offset, timestampToLocalMktDate(value));
5232  return *this;
5233  }
5234 
5237  {
5239 
5240  setOrdinary(offset, NullLocalMktDate());
5241  return *this;
5242  }
5243 
5244  /// Order type.
5248  {
5250 
5251  return enumeration<OrderTypeReq>(offset);
5252  }
5253 
5254  /// Order type.
5257  {
5259 
5260  setEnumeration<OrderTypeReq>(offset, value);
5261  return *this;
5262  }
5263 
5264  /// Specifies how long the order remains in effect.
5266  bool timeInForce(TimeInForce::Enum& value) const
5268  {
5270 
5271  return enumeration<TimeInForce>(value, offset, NullUInt8());
5272  }
5273 
5274  /// Specifies how long the order remains in effect.
5277  {
5279 
5280  setEnumeration<TimeInForce>(offset, value);
5281  return *this;
5282  }
5283 
5286  {
5288 
5289  setOrdinary(offset, NullUInt8());
5290  return *this;
5291  }
5292 
5293  /// Indicates if the order was initially received manually (as
5294  /// opposed to electronically).
5298  {
5300 
5301  return enumeration<ManualOrdIndReq>(offset);
5302  }
5303 
5304  /// Indicates if the order was initially received manually (as
5305  /// opposed to electronically).
5306  ThisType&
5308  ManualOrdIndReq::Enum value)
5310  {
5312 
5313  setEnumeration<ManualOrdIndReq>(offset, value);
5314  return *this;
5315  }
5316 
5317  /// Instructions for order handling on exchange. Since more
5318  /// than one instruction is applicable to an order, this field
5319  /// can represent those using a bitset.
5323  {
5325 
5326  return ordinary<ExecInst>(offset);
5327  }
5328 
5329  /// Instructions for order handling on exchange. Since more
5330  /// than one instruction is applicable to an order, this field
5331  /// can represent those using a bitset.
5332  ThisType& setExecInst(ExecInst value)
5334  {
5336 
5337  setOrdinary(offset, value);
5338  return *this;
5339  }
5340 
5341  /// Identifies whether the order should be treated as passive
5342  /// (will not match when entered) or aggressive (could match
5343  /// when entered); default behavior when absent is aggressive.
5345  bool executionMode(ExecMode::Enum& value) const
5347  {
5349 
5350  return enumeration<ExecMode>(value, offset, NullCharNULL());
5351  }
5352 
5353  /// Identifies whether the order should be treated as passive
5354  /// (will not match when entered) or aggressive (could match
5355  /// when entered); default behavior when absent is aggressive.
5358  {
5360 
5361  setEnumeration<ExecMode>(offset, value);
5362  return *this;
5363  }
5364 
5367  {
5369 
5370  setOrdinary(offset, NullCharNULL());
5371  return *this;
5372  }
5373 
5374  /// Field added to capture if an order was submitted for
5375  /// market making obligation or not. Applicable only for EU
5376  /// BrokerTec and EBS MiFID regulated instruments.
5380  {
5382 
5383  return enumeration<BooleanNULL>(value, offset, NullUInt8());
5384  }
5385 
5386  /// Field added to capture if an order was submitted for
5387  /// market making obligation or not. Applicable only for EU
5388  /// BrokerTec and EBS MiFID regulated instruments.
5391  {
5393 
5394  setEnumeration<BooleanNULL>(offset, value);
5395  return *this;
5396  }
5397 
5400  {
5402 
5403  setOrdinary(offset, NullUInt8());
5404  return *this;
5405  }
5406 
5407  /// Boolean: flags a managed order.
5409  bool managedOrder(BooleanNULL::Enum& value) const
5411  {
5413 
5414  return enumeration<BooleanNULL>(value, offset, NullUInt8());
5415  }
5416 
5417  /// Boolean: flags a managed order.
5420  {
5422 
5423  setEnumeration<BooleanNULL>(offset, value);
5424  return *this;
5425  }
5426 
5429  {
5431 
5432  setOrdinary(offset, NullUInt8());
5433  return *this;
5434  }
5435 
5436  /// Indicates the type of short sale. Will not be used for Buy
5437  /// orders but Sell orders should have this tag populated for
5438  /// MiFID.
5440  bool
5442  ShortSaleType::Enum& value) const
5444  {
5446 
5447  return enumeration<ShortSaleType>(value, offset, NullEnumNULL());
5448  }
5449 
5450  /// Indicates the type of short sale. Will not be used for Buy
5451  /// orders but Sell orders should have this tag populated for
5452  /// MiFID.
5453  ThisType&
5455  ShortSaleType::Enum value)
5457  {
5459 
5460  setEnumeration<ShortSaleType>(offset, value);
5461  return *this;
5462  }
5463 
5466  {
5468 
5469  setOrdinary(offset, NullEnumNULL());
5470  return *this;
5471  }
5472 
5473  /// The presence of DiscretionPrice on an order indicates that
5474  /// the trader wishes to display one price but will accept
5475  /// trades at another price.
5477  bool discretionPrice(PRICE9& value) const
5479  {
5481 
5482  return decimal(value, offset, NullPRICE9());
5483  }
5484 
5485  /// The presence of DiscretionPrice on an order indicates that
5486  /// the trader wishes to display one price but will accept
5487  /// trades at another price.
5488  ThisType& setDiscretionPrice(PRICE9 value)
5490  {
5492 
5493  setOrdinary(offset, value);
5494  return *this;
5495  }
5496 
5499  {
5501 
5502  setOrdinary(offset, NullPRICE9());
5503  return *this;
5504  }
5505 
5506  /// This field specifies the highest (for a buy) or lowest
5507  /// (for a sell) price at which the order may trade. This
5508  /// price must be better than the limit price and should be
5509  /// multiple of reservation price tick.
5511  bool reservationPrice(PRICE9& value) const
5513  {
5516 
5517  return decimal(value, offset, NullPRICE9(), since);
5518  }
5519 
5520  /// This field specifies the highest (for a buy) or lowest
5521  /// (for a sell) price at which the order may trade. This
5522  /// price must be better than the limit price and should be
5523  /// multiple of reservation price tick.
5524  ThisType& setReservationPrice(PRICE9 value)
5525  {
5528 
5529  setOrdinary(offset, value, since);
5530  return *this;
5531  }
5532 
5534  {
5537 
5538  setOrdinary(offset, NullPRICE9(), since);
5539  return *this;
5540  }
5541 
5542  /// Minimal size of message body in bytes.
5547  {
5548  return
5549  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
5550  (version >= 8)
5551  ? 132
5552  : 124;
5553  }
5554 
5555  /// Size of message body in bytes.
5560  {
5561  return
5562  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
5563  minimalBlockLength(version);
5564  }
5565 
5566  /// Minimal variable fields size (when variable-length fields are empty).
5570  static
5571  MessageSize
5574  {
5575  return
5576  ONIXS_ILINK3_ASSERT(version >= Schema::MinimalVersion),
5577  0;
5578  }
5579 
5580  /// Maximal message size.
5586  {
5587  return
5588  static_cast<UInt64>(MessageHeaderBuilder::Size) +
5589  blockLength(Schema::Version);
5590  }
5591 
5592  /// Reset all variable-length fields if any.
5595  {
5596  return *this;
5597  }
5598 
5599  /// Reset all variable-length and optional fields if any.
5600  ThisType& reset()
5602  {
5603  setPriceToNull();
5604  setStopPxToNull();
5605  setMinQtyToNull();
5606  setDisplayQtyToNull();
5607  setExpireDateToNull();
5608  setTimeInForceToNull();
5609  setExecutionModeToNull();
5610  setLiquidityFlagToNull();
5611  setManagedOrderToNull();
5612  setShortSaleTypeToNull();
5613  setDiscretionPriceToNull();
5614 
5615  if (version() >= 8)
5616  {
5617  setReservationPriceToNull();
5618  }
5619 
5620  resetVariableFields();
5621  return *this;
5622  }
5623 
5624  /// \return class name.
5628  static const Char* className()
5629  {
5630  return "NewOrderSingle514";
5631  }
5632 
5633  /// FIX message type.
5637  static StrRef fixType()
5639  {
5640  return constructStrRef("D");
5641  }
5642 
5643  /// \return a human-readable presentation.
5645  std::string toString() const;
5646 
5647  /// \return the end of the message.
5649  const void* tail() const
5651  {
5652  return
5653  toOpaquePtr(
5654  advanceByBytes(
5655  binary(),
5656  static_cast<ptrdiff_t>(SbeMessage::blockLength()) +
5657  MessageHeader::Size));
5658  }
5659 
5660  /// \return the size occupied by the message.
5664  {
5665  return
5666  SbeMessage::calculateBinarySize(tail());
5667  }
5668 
5669 private:
5670  void checkLength(
5671  EncodedLength length, SchemaVersion version) const
5672  {
5673  const EncodedLength minimalRequiredLength =
5674  minimalBlockLength(version) +
5675  MessageHeader::Size +
5676  getMinimalVariableFieldsSize(version);
5677 
5678  checkBinaryLength(
5679  *this, length, minimalRequiredLength);
5680  }
5681 
5682  void checkCompatibility() const
5683  {
5684  assert(TemplateId == templateId());
5685 
5686  checkSchema<Schema>(schemaId(), version());
5687  checkLength(bufferSize(), version());
5688  }
5689 };
5690 
5691 /// OrderCancelReplaceRequest.
5694 : SbeMessage
5695 {
5696  /// Used template schema.
5698 
5699  /// This type alias.