fix8  version 1.4.0
Open Source C++ FIX Framework
field.hpp
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------------------
2 /*
3 
4 Fix8 is released under the GNU LESSER GENERAL PUBLIC LICENSE Version 3.
5 
6 Fix8 Open Source FIX Engine.
7 Copyright (C) 2010-16 David L. Dight <fix@fix8.org>
8 
9 Fix8 is free software: you can redistribute it and / or modify it under the terms of the
10 GNU Lesser General Public License as published by the Free Software Foundation, either
11 version 3 of the License, or (at your option) any later version.
12 
13 Fix8 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
14 even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16 You should have received a copy of the GNU Lesser General Public License along with Fix8.
17 If not, see <http://www.gnu.org/licenses/>.
18 
19 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO
20 THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
21 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
22 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO
24 THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
25 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
26 
27 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT
28 HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED
29 ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
30 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
31 NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
32 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
33 HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
34 
35 */
36 //-------------------------------------------------------------------------------------------------
37 #ifndef FIX8_FIELD_HPP_
38 #define FIX8_FIELD_HPP_
39 
40 #include <Poco/Timestamp.h>
41 #include <Poco/DateTime.h>
42 
43 //-------------------------------------------------------------------------------------------------
44 namespace FIX8 {
45 
46 //-------------------------------------------------------------------------------------------------
47 // Misc consts
48 const size_t MAX_MSGTYPE_FIELD_LEN(32);
49 const size_t HEADER_CALC_OFFSET(32);
50 
51 //-------------------------------------------------------------------------------------------------
53 
54 template<unsigned field> struct EnumType {};
55 
56 //-------------------------------------------------------------------------------------------------
58 struct RealmBase
59 {
61 
62  const void *_range;
65  const int _sz;
66  const char * const *_descriptions;
67 
68  RealmBase(const void *range, RealmType dtype, FieldTrait::FieldType ftype, int sz, const char * const *descriptions)
69  : _range(range), _dtype(dtype), _ftype(ftype), _sz(sz), _descriptions(descriptions) {}
70 
75  template<typename T>
76  bool is_valid(const T& what) const
77  {
78  const T *rng(static_cast<const T*>(_range));
79  return _dtype == dt_set ? std::binary_search(rng, rng + _sz, what) : *rng <= what && what <= *(rng + 1);
80  }
81 
86  template<typename T>
87  const T& get_rlm_val(const int idx) const { return *(static_cast<const T*>(_range) + idx); }
88 
93  template<typename T>
94  int get_rlm_idx(const T& what) const
95  {
96  if (_dtype == dt_set)
97  {
98  const T *rng(static_cast<const T*>(_range)), *res(std::lower_bound(rng, rng + _sz, what));
99  return res != rng + _sz ? res - rng : -1;
100  }
101  return 0;
102  }
103 
109  template<typename T>
110  std::ostream& _print(std::ostream& os, int idx) const { return os << *((static_cast<const T *>(_range) + idx)); }
111 
116  std::ostream& print(std::ostream& os, int idx) const
117  {
118  return FieldTrait::is_int(_ftype) ? _print<int>(os, idx)
119  : FieldTrait::is_char(_ftype) ? _print<char>(os, idx)
120  : FieldTrait::is_float(_ftype) ? _print<fp_type>(os, idx)
121  : FieldTrait::is_string(_ftype) ? _print<f8String>(os, idx) : os;
122  }
123 };
124 
125 //-------------------------------------------------------------------------------------------------
128 {
129  const unsigned short _fnum;
130 
131 protected:
132  const RealmBase *_rlm;
133 
134 public:
138  BaseField(unsigned short fnum, const RealmBase *rlm=nullptr) : _fnum(fnum), _rlm(rlm) {}
139 
141  virtual ~BaseField() {}
142 
145  unsigned short get_tag() const { return _fnum; }
146 
150  virtual std::ostream& print(std::ostream& os) const = 0;
151 
155  virtual size_t print(char *to) const = 0;
156 
159  virtual FieldTrait::FieldType get_underlying_type() const = 0;
160 
163  virtual BaseField *copy() = 0;
164 
167  virtual int get_rlm_idx() const { return -1; }
168 
172  template<typename T>
173  T& from() { return *static_cast<T*>(this); }
174 
178  template<typename T>
179  const T *as() const { return static_cast<T*>(this); }
180 
184  size_t encode(std::ostream& os) const
185  {
186  const std::ios::pos_type where(os.tellp());
187  os << _fnum << default_assignment_separator << *this << default_field_separator;
188  return os.tellp() - where;
189  }
190 
194  size_t encode(char *to) const
195  {
196  const char *cur_ptr(to);
197  to += itoa(_fnum, to, 10);
199  to += print(to);
200  *to++ = default_field_separator;
201  return to - cur_ptr;
202  }
203 
205 
207  bool same_base(const BaseField& that) const { return that._fnum == _fnum; }
208 
210 
212  virtual bool operator==(const BaseField& that) const = 0;
213 
215 
217  virtual bool operator<(const BaseField& that) const = 0;
218 
220 
222  virtual bool operator>(const BaseField& that) const = 0;
223 
225 
227  bool operator!=(const BaseField& that) const { return !(*this == that); }
228 
230 
232  bool operator<=(const BaseField& that) const { return *this < that || *this == that; }
233 
235 
237  bool operator>=(const BaseField& that) const { return *this > that || *this == that; }
238 
241  const RealmBase *get_realm() const { return _rlm; }
242 
247  friend std::ostream& operator<<(std::ostream& os, const BaseField& what) { return what.print(os); }
248  friend class MessageBase;
249 };
250 
251 //-------------------------------------------------------------------------------------------------
253 
255 template<typename T, unsigned short field>
256 class Field : public BaseField
257 {
258  Field() = delete;
259  Field(const Field&) = delete;
260  Field& operator=(const Field&) = delete;
261  Field(const f8String&, const RealmBase *) = delete;
262 };
263 
264 //-------------------------------------------------------------------------------------------------
266 
267 template<unsigned short field>
268 class Field<int, field> : public BaseField
269 {
270 protected:
271  int _value;
273 
274 public:
276  static unsigned short get_field_id() { return field; }
277 
279  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
280 
282  Field () : BaseField(field), _value() {}
283 
285  /* \param from field to copy */
286  Field (const Field& from) : BaseField(field), _value(from._value) {}
287 
291  Field (const int val, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(val) {}
292 
296  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(fast_atoi<int>(from.c_str())) {}
297 
301  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(fast_atoi<int>(from)) {}
302 
304 
306  Field& operator=(const Field& that)
307  {
308  if (this != &that)
309  _value = that._value;
310  return *this;
311  }
312 
314  virtual ~Field() {}
315 
317 
319  bool operator==(const BaseField& that) const
320  { return same_base(that) && static_cast<const Field<int, field>&>(that)._value == _value; }
321 
323 
325  bool operator<(const BaseField& that) const
326  { return same_base(that) && _value < static_cast<const Field<int, field>&>(that)._value; }
327 
329 
331  bool operator>(const BaseField& that) const
332  { return same_base(that) && _value > static_cast<const Field<int, field>&>(that)._value; }
333 
336  bool is_valid() const { return _rlm ? _rlm->is_valid(_value) : true; }
337 
340  int get_rlm_idx() const { return _rlm ? _rlm->get_rlm_idx(_value) : -1; }
341 
344  const int& get() const { return _value; }
345 
348  const int& operator()() const { return _value; }
349 
353  const int& set(const int& from) { return _value = from; }
354 
358  const int& set_from_raw(const f8String& from) { return _value = fast_atoi<int>(from.c_str()); }
359 
362  Field *copy() { return new Field(*this); }
363 
367  std::ostream& print(std::ostream& os) const { return os << _value; }
368 
372  size_t print(char *to) const { return itoa(_value, to, 10); }
373 };
374 
375 //-------------------------------------------------------------------------------------------------
377 
378 template<unsigned short field>
379 class Field<char *, field> : public BaseField
380 {
381 protected:
382  const char *_value;
384 
385 public:
387  static unsigned short get_field_id() { return field; }
388 
390  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
391 
393  Field () : BaseField(field) {}
394 
396  /* \param from field to copy */
397  Field (const Field& from) : BaseField(field), _value(from._value) {}
398 
402  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(from) {}
403 
405  virtual ~Field() {}
406 
408 
410  Field& operator=(const Field& that)
411  {
412  if (this != &that)
413  _value = that._value;
414  return *this;
415  }
416 
418 
420  bool operator==(const char *that) const { return ::strcmp(_value, that) == 0; }
421 
423 
425  bool operator!=(const char *that) const { return ::strcmp(_value, that); }
426 
428 
430  bool operator==(const BaseField& that) const
431  { return same_base(that) && ::strcmp(static_cast<const Field<char *, field>&>(that)._value, _value) == 0; }
432 
434 
436  virtual bool operator<(const BaseField& that) const
437  { return same_base(that) && ::strcmp(_value, static_cast<const Field<char *, field>&>(that)._value) < 0; }
438 
440 
442  virtual bool operator>(const BaseField& that) const
443  { return same_base(that) && ::strcmp(_value, static_cast<const Field<char *, field>&>(that)._value) > 0; }
444 
447  bool is_valid() const { return _rlm ? _rlm->is_valid(_value) : true; }
448 
451  int get_rlm_idx() const { return _rlm ? _rlm->get_rlm_idx(_value) : -1; }
452 
455  const char *get() const { return _value; }
456 
459  const char *operator()() const { return _value; }
460 
464  const char *set(const char *from) { return _value = from; }
465 
469  const char *set_from_raw(const char *from) { return _value = from; }
470 
473  Field *copy() { return new Field(*this); }
474 
478  std::ostream& print(std::ostream& os) const { return os << _value; }
479 
483  size_t print(char *to) const { ::strcpy(to, _value); return ::strlen(_value); }
484 };
485 
486 //-------------------------------------------------------------------------------------------------
488 
489 template<unsigned short field>
490 class Field<f8String, field> : public BaseField
491 {
492 protected:
495 
496 public:
498  static unsigned short get_field_id() { return field; }
499 
501  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
502 
504  Field () : BaseField(field) {}
505 
507  /* \param from field to copy */
508  Field (const Field& from) : BaseField(field), _value(from._value) {}
509 
513  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(from) {}
514 
518  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(from) {}
519 
521  virtual ~Field() {}
522 
524 
526  Field& operator=(const Field& that)
527  {
528  if (this != &that)
529  _value = that._value;
530  return *this;
531  }
532 
534 
536  bool operator==(const BaseField& that) const
537  { return same_base(that) && static_cast<const Field<f8String, field>&>(that)._value == _value; }
538 
540 
542  virtual bool operator<(const BaseField& that) const
543  { return same_base(that) && _value < static_cast<const Field<f8String, field>&>(that)._value; }
544 
546 
548  virtual bool operator>(const BaseField& that) const
549  { return same_base(that) && _value > static_cast<const Field<f8String, field>&>(that)._value; }
550 
553  bool is_valid() const { return _rlm ? _rlm->is_valid(_value) : true; }
554 
557  int get_rlm_idx() const { return _rlm ? _rlm->get_rlm_idx(_value) : -1; }
558 
561  const f8String& get() const { return _value; }
562 
565  const f8String& operator()() const { return _value; }
566 
570  const f8String& set(const f8String& from) { return _value = from; }
571 
575  const f8String& set_from_raw(const f8String& from) { return _value = from; }
576 
579  Field *copy() { return new Field(*this); }
580 
584  std::ostream& print(std::ostream& os) const { return os << _value; }
585 
589  size_t print(char *to) const { return _value.copy(to, _value.size()); }
590 };
591 
592 //-------------------------------------------------------------------------------------------------
594 
595 template<unsigned short field>
596 class Field<fp_type, field> : public BaseField
597 {
598 protected:
602 
603 public:
605  static unsigned short get_field_id() { return field; }
606 
608  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
609 
611  Field () : BaseField(field), _value(), _precision(FIX8_DEFAULT_PRECISION) {}
612 
614  /* \param from field to copy */
615  Field (const Field& from) : BaseField(field, from._rlm), _value(from._value), _precision(from._precision) {}
616 
620  Field (const fp_type& val, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(val), _precision(FIX8_DEFAULT_PRECISION) {}
621 
626  Field (const fp_type& val, const int prec, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(val), _precision(prec) {}
627 
631  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(fast_atof(from.c_str())), _precision(FIX8_DEFAULT_PRECISION) {}
632 
636  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(fast_atof(from)), _precision(FIX8_DEFAULT_PRECISION) {}
637 
639  virtual ~Field() {}
640 
642 
644  Field& operator=(const Field& that)
645  {
646  if (this != &that)
647  _value = that._value;
648  return *this;
649  }
650 
652 
654  bool operator==(const BaseField& that) const
655  { return same_base(that) && static_cast<const Field<fp_type, field>&>(that)._value == _value; }
656 
658 
660  bool operator<(const BaseField& that) const
661  { return same_base(that) && _value < static_cast<const Field<fp_type, field>&>(that)._value; }
662 
664 
666  bool operator>(const BaseField& that) const
667  { return same_base(that) && _value > static_cast<const Field<fp_type, field>&>(that)._value; }
668 
671  void set_precision(const int prec) { _precision = prec; }
672 
675  bool is_valid() const { return _rlm ? _rlm->is_valid(_value) : true; }
676 
679  int get_rlm_idx() const { return _rlm ? _rlm->get_rlm_idx(_value) : -1; }
680 
683  const fp_type& get() const { return _value; }
684 
687  const fp_type& operator()() const { return _value; }
688 
692  const fp_type& set(const fp_type& from) { return _value = from; }
693 
697  const fp_type& set_from_raw(const f8String& from) { return _value = fast_atof(from.c_str()); }
698 
701  Field *copy() { return new Field(*this); }
702 
706  std::ostream& print(std::ostream& os) const { return os << _value; }
707 
711  size_t print(char *to) const { return modp_dtoa(_value, to, _precision); }
712 };
713 
714 //-------------------------------------------------------------------------------------------------
716 
717 template<unsigned short field>
718 class Field<char, field> : public BaseField
719 {
720  char _value;
722 
723 public:
725  static unsigned short get_field_id() { return field; }
726 
728  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
729 
731  Field () : BaseField(field), _value() {}
732 
735  Field (const Field& from) : BaseField(field, from._rlm), _value(from._value) {}
736 
740  Field (const char& val, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(val) {}
741 
745  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(from[0]) {}
746 
750  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(*from) {}
751 
753  ~Field() {}
754 
756 
758  Field& operator=(const Field& that)
759  {
760  if (this != &that)
761  _value = that._value;
762  return *this;
763  }
764 
766 
768  bool operator==(const BaseField& that) const
769  { return same_base(that) && static_cast<const Field<char, field>&>(that)._value == _value; }
770 
772 
774  bool operator<(const BaseField& that) const
775  { return same_base(that) && _value < static_cast<const Field<char, field>&>(that)._value; }
776 
778 
780  bool operator>(const BaseField& that) const
781  { return same_base(that) && _value > static_cast<const Field<char, field>&>(that)._value; }
782 
785  bool is_valid() const { return _rlm ? _rlm->is_valid(_value) : true; }
786 
789  int get_rlm_idx() const { return _rlm ? _rlm->get_rlm_idx(_value) : -1; }
790 
793  const char& get() const { return _value; }
794 
797  const char& operator()() const { return _value; }
798 
802  const char& set(const char& from) { return _value = from; }
803 
807  const char& set_from_raw(const f8String& from) { return _value = from[0]; }
808 
811  Field *copy() { return new Field(*this); }
812 
816  std::ostream& print(std::ostream& os) const { return os << _value; }
817 
821  size_t print(char *to) const { *to = _value; return 1; }
822 };
823 
824 //-------------------------------------------------------------------------------------------------
830 inline void format0(int data, char *to, int width)
831 {
832  while(width-- > 0)
833  {
834  to[width] = data % 10 + '0';
835  data /= 10;
836  }
837 }
838 
844 inline size_t parse_decimal(const char *begin, size_t len, int &to)
845 {
846  const char *bsv(begin);
847  while(len-- > 0)
848  to = (to << 3) + (to << 1) + (*begin++ - '0');
849  return begin - bsv;
850 }
851 
858 inline time_t time_to_epoch (const tm& ltm, int utcdiff=0)
859 {
860  static const int mon_days[] {0,
861  31,
862  31 + 28,
863  31 + 28 + 31,
864  31 + 28 + 31 + 30,
865  31 + 28 + 31 + 30 + 31,
866  31 + 28 + 31 + 30 + 31 + 30,
867  31 + 28 + 31 + 30 + 31 + 30 + 31,
868  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
869  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
870  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
871  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30,
872  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31
873  };
874 
875  const int tyears(ltm.tm_year ? ltm.tm_year - 70 : 0); // tm->tm_year is from 1900.
876  int tdays(mon_days[ltm.tm_mon] + (ltm.tm_mday ? ltm.tm_mday - 1 : 0) + tyears * 365 + (tyears + 2) / 4);
877  if (ltm.tm_year && ltm.tm_year % 4 == 0 && ltm.tm_mon < 2) // works till 2100, adjust for leap year with jan/feb +1day error
878  --tdays;
879  return tdays * 86400 + (ltm.tm_hour + utcdiff) * 3600 + ltm.tm_min * 60 + ltm.tm_sec;
880 }
881 
883 
895 inline size_t date_time_format(const Tickval& tickval, char *to, TimeIndicator ind)
896 {
897  const tm result(tickval.get_tm());
898  const char *start(to);
899 
900  if (ind > _time_with_ms)
901  {
902  format0(result.tm_year + 1900, to, 4);
903  to += 4;
904  format0(result.tm_mon + 1, to, 2);
905  to += 2;
906  if (ind == _short_date_only)
907  return to - start;
908  format0(result.tm_mday, to, 2);
909  to += 2;
910  if (ind == _date_only)
911  return to - start;
912  *to++ = '-';
913  }
914 
915  format0(result.tm_hour, to, 2);
916  to += 2;
917  *to++ = ':';
918  format0(result.tm_min, to, 2);
919  to += 2;
920  *to++ = ':';
921  format0(result.tm_sec, to, 2);
922  to += 2;
923 
924  if (ind == _time_with_ms || ind == _with_ms)
925  {
926  *to++ = '.';
927  format0(tickval.msecs(), to, 3);
928  to += 3;
929  }
930 
931  return to - start;
932 }
933 
938 inline Tickval::ticks date_time_parse(const char *ptr, size_t len)
939 {
940  if (len == 0 || (*ptr == 'n' && len == 3 && *(ptr + 1) == 'o' && *(ptr + 2) == 'w')) // special cases initialise to 'now'
941  return Tickval(true).get_ticks();
942 
944  int millisecond(0);
945  tm tms {};
946 
947  ptr += parse_decimal(ptr, 4, tms.tm_year);
948  tms.tm_year -= 1900;
949  ptr += parse_decimal(ptr, 2, tms.tm_mon);
950  --tms.tm_mon;
951  ptr += parse_decimal(ptr, 2, tms.tm_mday);
952  ++ptr;
953  ptr += parse_decimal(ptr, 2, tms.tm_hour);
954  ++ptr;
955  ptr += parse_decimal(ptr, 2, tms.tm_min);
956  ++ptr;
957  ptr += parse_decimal(ptr, 2, tms.tm_sec);
958  switch(len)
959  {
960  case 21: //_with_ms: // 19981231-23:59:59.123
961  parse_decimal(++ptr, 3, millisecond);
962  result = millisecond * Tickval::million; // drop through
963  case 17: //: // 19981231-23:59:59
964  result += time_to_epoch(tms) * Tickval::billion;
965  break;
966  default:
967  break;
968  }
969 
970  return result;
971 }
972 
978 inline Tickval::ticks time_parse(const char *ptr, size_t len, bool timeonly=false)
979 {
980  if (len == 0 || (*ptr == 'n' && len == 3 && *(ptr + 1) == 'o' && *(ptr + 2) == 'w')) // special cases initialise to 'now'
981  return Tickval(true).get_ticks();
982 
984  int millisecond(0);
985  tm tms {};
986 
987  ptr += parse_decimal(ptr, 2, tms.tm_hour);
988  ++ptr;
989  ptr += parse_decimal(ptr, 2, tms.tm_min);
990  ++ptr;
991  ptr += parse_decimal(ptr, 2, tms.tm_sec);
992  switch(len)
993  {
994  case 12: // 23:59:59.123
995  parse_decimal(++ptr, 3, millisecond);
996  result = millisecond * Tickval::million; // drop through
997  case 8: // 23:59:59
998  if (!timeonly)
999  result += time_to_epoch(tms) * Tickval::billion;
1000  else
1001  result += (tms.tm_hour * 3600ULL + tms.tm_min * 60ULL + tms.tm_sec) * Tickval::billion;
1002  break;
1003  default:
1004  break;
1005  }
1006 
1007  return result;
1008 }
1009 
1010 inline Tickval::ticks date_parse(const char *ptr, size_t len)
1011 {
1012  if (len == 0 || (*ptr == 'n' && len == 3 && *(ptr + 1) == 'o' && *(ptr + 2) == 'w')) // special cases initialise to 'now'
1013  return Tickval(true).get_ticks();
1014 
1015  tm tms {};
1016  ptr += parse_decimal(ptr, 4, tms.tm_year);
1017  tms.tm_year -= 1900;
1018  ptr += parse_decimal(ptr, 2, tms.tm_mon);
1019  --tms.tm_mon;
1020  if (len == 8)
1021  parse_decimal(ptr, 2, tms.tm_mday);
1022  else
1023  tms.tm_mday = 1;
1024  return time_to_epoch(tms) * Tickval::billion;
1025 }
1026 
1027 //-------------------------------------------------------------------------------------------------
1029 
1031 
1032 template<unsigned short field>
1033 class Field<UTCTimestamp, field> : public BaseField
1034 {
1037 
1038 public:
1040  static unsigned short get_field_id() { return field; }
1041 
1043  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1044 
1046  Field () : BaseField(field), _value(true) {}
1047 
1050  Field (const Field& from) : BaseField(field), _value(from._value) {}
1051 
1055  Field (const Tickval& val, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(val) {}
1056 
1060  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(date_time_parse(from.data(), from.size())) {}
1061 
1065  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field), _value(date_time_parse(from, from ? ::strlen(from) : 0)) {}
1066 
1070  Field (const tm& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(time_to_epoch(from) * Tickval::billion) {}
1071 
1073  ~Field() {}
1074 
1076 
1078  Field& operator=(const Field& that)
1079  {
1080  if (this != &that)
1081  _value = that._value;
1082  return *this;
1083  }
1084 
1086 
1088  bool operator==(const BaseField& that) const
1089  { return same_base(that) && static_cast<const Field<UTCTimestamp, field>&>(that)._value == _value; }
1090 
1092 
1094  bool operator<(const BaseField& that) const
1095  { return same_base(that) && _value < static_cast<const Field<UTCTimestamp, field>&>(that)._value; }
1096 
1098 
1100  bool operator>(const BaseField& that) const
1101  { return same_base(that) && _value > static_cast<const Field<UTCTimestamp, field>&>(that)._value; }
1102 
1105  const Tickval& get() const { return _value; }
1106 
1109  const Tickval& operator()() const { return _value; }
1110 
1113  void set(const Tickval& from) { _value = from; }
1114 
1117  Field *copy() { return new Field(*this); }
1118 
1122  std::ostream& print(std::ostream& os) const
1123  {
1124  char buf[MAX_MSGTYPE_FIELD_LEN] {};
1125  print(buf);
1126  return os << buf;
1127  }
1128 
1132  size_t print(char *to) const { return date_time_format(_value, to, _with_ms); }
1133 };
1134 
1135 //-------------------------------------------------------------------------------------------------
1137 
1139 
1140 template<unsigned short field>
1141 class Field<UTCTimeOnly, field> : public BaseField
1142 {
1145 
1146 public:
1148  static unsigned short get_field_id() { return field; }
1149 
1151  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1152 
1154  Field () : BaseField(field) {}
1155 
1157  /* \param from field to copy */
1158  Field (const Field& from) : BaseField(field), _value(from._value) {}
1159 
1163  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(time_parse(from.data(), from.size(), true)) {}
1164 
1168  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field), _value(time_parse(from, from ? ::strlen(from) : 0, true)) {}
1169 
1173  Field (const tm& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(time_to_epoch(from) * Tickval::billion) {}
1174 
1176  ~Field() {}
1177 
1179 
1181  Field& operator=(const Field& that)
1182  {
1183  if (this != &that)
1184  _value = that._value;
1185  return *this;
1186  }
1187 
1189 
1191  bool operator==(const BaseField& that) const
1192  { return same_base(that) && static_cast<const Field<UTCTimeOnly, field>&>(that)._value == _value; }
1193 
1195 
1197  bool operator<(const BaseField& that) const
1198  { return same_base(that) && _value < static_cast<const Field<UTCTimeOnly, field>&>(that)._value; }
1199 
1201 
1203  bool operator>(const BaseField& that) const
1204  { return same_base(that) && _value > static_cast<const Field<UTCTimeOnly, field>&>(that)._value; }
1205 
1208  const Tickval& get() const { return _value; }
1209 
1212  const Tickval& operator()() const { return _value; }
1213 
1216  void set(const Tickval& from) { _value = from; }
1217 
1220  Field *copy() { return new Field(*this); }
1221 
1225  std::ostream& print(std::ostream& os) const
1226  {
1227  char buf[MAX_MSGTYPE_FIELD_LEN] {};
1228  print(buf);
1229  return os << buf;
1230  }
1231 
1235  size_t print(char *to) const { return date_time_format(_value, to, _time_with_ms); }
1236 };
1237 
1238 //-------------------------------------------------------------------------------------------------
1240 
1242 
1243 template<unsigned short field>
1244 class Field<UTCDateOnly, field> : public BaseField
1245 {
1248 
1249 public:
1251  static unsigned short get_field_id() { return field; }
1252 
1254  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1255 
1257  Field () : BaseField(field) {}
1258 
1260  /* \param from field to copy */
1261  Field (const Field& from) : BaseField(field), _value(from._value) {}
1262 
1266  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(date_parse(from.data(), from.size())) {}
1267 
1271  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field), _value(date_parse(from, from ? ::strlen(from) : 0)) {}
1272 
1276  Field (const tm& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(time_to_epoch(from) * Tickval::billion) {}
1277 
1279  ~Field() {}
1280 
1282 
1284  Field& operator=(const Field& that)
1285  {
1286  if (this != &that)
1287  _value = that._value;
1288  return *this;
1289  }
1290 
1292 
1294  bool operator==(const BaseField& that) const
1295  { return same_base(that) && static_cast<const Field<UTCDateOnly, field>&>(that)._value == _value; }
1296 
1298 
1300  bool operator<(const BaseField& that) const
1301  { return same_base(that) && _value < static_cast<const Field<UTCDateOnly, field>&>(that)._value; }
1302 
1304 
1306  bool operator>(const BaseField& that) const
1307  { return same_base(that) && _value > static_cast<const Field<UTCDateOnly, field>&>(that)._value; }
1308 
1311  const Tickval& get() const { return _value; }
1312 
1315  const Tickval& operator()() const { return _value; }
1316 
1319  void set(const Tickval& from) { _value = from; }
1320 
1323  Field *copy() { return new Field(*this); }
1324 
1328  std::ostream& print(std::ostream& os) const
1329  {
1330  char buf[MAX_MSGTYPE_FIELD_LEN] {};
1331  print(buf);
1332  return os << buf;
1333  }
1334 
1338  size_t print(char *to) const { return date_time_format(_value, to, _date_only); }
1339 };
1340 
1341 //-------------------------------------------------------------------------------------------------
1343 
1345 
1346 template<unsigned short field>
1347 class Field<LocalMktDate, field> : public BaseField
1348 {
1351 
1352 public:
1354  static unsigned short get_field_id() { return field; }
1355 
1357  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1358 
1360  Field () : BaseField(field) {}
1361 
1363  /* \param from field to copy */
1364  Field (const Field& from) : BaseField(field), _value(from._value) {}
1365 
1369  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(date_parse(from.data(), from.size())) {}
1370 
1374  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field), _value(date_parse(from, from ? ::strlen(from) : 0)) {}
1375 
1379  Field (const tm& from, const RealmBase *rlm=nullptr) : BaseField(field), _value(time_to_epoch(from) * Tickval::billion) {}
1380 
1382  ~Field() {}
1383 
1385 
1387  Field& operator=(const Field& that)
1388  {
1389  if (this != &that)
1390  _value = that._value;
1391  return *this;
1392  }
1393 
1395 
1397  bool operator==(const BaseField& that) const
1398  { return same_base(that) && static_cast<const Field<LocalMktDate, field>&>(that)._value == _value; }
1399 
1401 
1403  bool operator<(const BaseField& that) const
1404  { return same_base(that) && _value < static_cast<const Field<LocalMktDate, field>&>(that)._value; }
1405 
1407 
1409  bool operator>(const BaseField& that) const
1410  { return same_base(that) && _value > static_cast<const Field<LocalMktDate, field>&>(that)._value; }
1411 
1414  const Tickval& get() const { return _value; }
1415 
1418  const Tickval& operator()() const { return _value; }
1419 
1422  void set(const Tickval& from) { _value = from; }
1423 
1426  Field *copy() { return new Field(*this); }
1427 
1431  std::ostream& print(std::ostream& os) const
1432  {
1433  char buf[MAX_MSGTYPE_FIELD_LEN] {};
1434  print(buf);
1435  return os << buf;
1436  }
1437 
1441  size_t print(char *to) const { return date_time_format(_value, to, _date_only); }
1442 };
1443 
1444 //-------------------------------------------------------------------------------------------------
1446 
1448 
1449 template<unsigned short field>
1450 class Field<MonthYear, field> : public BaseField
1451 {
1452  size_t _sz;
1455 
1456 public:
1458  static unsigned short get_field_id() { return field; }
1459 
1461  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1462 
1464  Field () : BaseField(field) {}
1465 
1467  /* \param from field to copy */
1468  Field (const Field& from) : BaseField(field), _sz(from._sz), _value(from._value) {}
1469 
1473  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field), _sz(from.size()), _value(date_parse(from.data(), _sz)) {}
1474 
1478  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field), _sz(from ? ::strlen(from) : 0), _value(date_parse(from, _sz)) {}
1479 
1483  Field (const tm& from, const RealmBase *rlm=nullptr) : BaseField(field), _sz(6), _value(time_to_epoch(from) * Tickval::billion) {}
1484 
1486  ~Field() {}
1487 
1489 
1491  Field& operator=(const Field& that)
1492  {
1493  if (this != &that)
1494  _value = that._value;
1495  return *this;
1496  }
1497 
1499 
1501  bool operator==(const BaseField& that) const
1502  { return same_base(that) && static_cast<const Field<MonthYear, field>&>(that)._value == _value; }
1503 
1505 
1507  bool operator<(const BaseField& that) const
1508  { return same_base(that) && _value < static_cast<const Field<MonthYear, field>&>(that)._value; }
1509 
1511 
1513  virtual bool operator>(const BaseField& that) const
1514  { return same_base(that) && _value > static_cast<const Field<MonthYear, field>&>(that)._value; }
1515 
1518  const Tickval& get() const { return _value; }
1519 
1522  const Tickval& operator()() const { return _value; }
1523 
1526  void set(const Tickval& from) { _value = from; }
1527 
1530  Field *copy() { return new Field(*this); }
1531 
1535  std::ostream& print(std::ostream& os) const
1536  {
1537  char buf[MAX_MSGTYPE_FIELD_LEN] {};
1538  print(buf);
1539  return os << buf;
1540  }
1541 
1545  size_t print(char *to) const { return date_time_format(_value, to, _sz == 6 ? _short_date_only : _date_only); }
1546 };
1547 
1548 //-------------------------------------------------------------------------------------------------
1550 
1552 
1553 template<unsigned short field>
1554 class Field<TZTimeOnly, field> : public BaseField
1555 {
1558 
1559 public:
1561  static unsigned short get_field_id() { return field; }
1562 
1564  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1565 
1567  Field () : BaseField(field) {}
1568 
1570  /* \param from field to copy */
1571  Field (const Field& from) : BaseField(field), _value(from._value) {}
1572 
1576  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm) {}
1577 
1581  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm) {}
1582 
1584  ~Field() {}
1585 
1587 
1589  Field& operator=(const Field& that)
1590  {
1591  if (this != &that)
1592  _value = that._value;
1593  return *this;
1594  }
1595 
1597 
1599  bool operator==(const BaseField& that) const
1600  { return same_base(that) && static_cast<const Field<TZTimeOnly, field>&>(that)._value == _value; }
1601 
1603 
1605  bool operator<(const BaseField& that) const
1606  { return same_base(that) && _value < static_cast<const Field<TZTimeOnly, field>&>(that)._value; }
1607 
1609 
1611  bool operator>(const BaseField& that) const
1612  { return same_base(that) && _value > static_cast<const Field<TZTimeOnly, field>&>(that)._value; }
1613 
1616  const Tickval& get() const { return _value; }
1617 
1620  const Tickval& operator()() const { return _value; }
1621 
1624  void set(const Tickval& from) { _value = from; }
1625 
1628  Field *copy() { return new Field(*this); }
1629 
1633  std::ostream& print(std::ostream& os) const { return os; } // TODO
1634 
1638  size_t print(char *to) const { return 0; } // TODO
1639 };
1640 
1641 //-------------------------------------------------------------------------------------------------
1643 
1645 
1646 template<unsigned short field>
1647 class Field<TZTimestamp, field> : public BaseField
1648 {
1651 
1652 public:
1654  static unsigned short get_field_id() { return field; }
1655 
1657  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1658 
1660  Field () : BaseField(field) {}
1661 
1663  /* \param from field to copy */
1664  Field (const Field& from) : BaseField(field), _value(from._value) {}
1665 
1669  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm) {}
1670 
1674  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm) {}
1675 
1677  ~Field() {}
1678 
1680 
1682  Field& operator=(const Field& that)
1683  {
1684  if (this != &that)
1685  _value = that._value;
1686  return *this;
1687  }
1688 
1690 
1692  bool operator==(const BaseField& that) const
1693  { return same_base(that) && static_cast<const Field<TZTimestamp, field>&>(that)._value == _value; }
1694 
1696 
1698  bool operator<(const BaseField& that) const
1699  { return same_base(that) && _value < static_cast<const Field<TZTimestamp, field>&>(that)._value; }
1700 
1702 
1704  bool operator>(const BaseField& that) const
1705  { return same_base(that) && _value > static_cast<const Field<TZTimestamp, field>&>(that)._value; }
1706 
1709  const Tickval& get() const { return _value; }
1710 
1713  const Tickval& operator()() const { return _value; }
1714 
1717  void set(const Tickval& from) { _value = from; }
1718 
1721  Field *copy() { return new Field(*this); }
1722 
1726  std::ostream& print(std::ostream& os) const { return os; } // TODO
1727 
1731  size_t print(char *to) const { return 0; } // TODO
1732 };
1733 
1734 //-------------------------------------------------------------------------------------------------
1736 
1738 
1739 template<unsigned short field>
1740 class Field<Length, field> : public Field<int, field>
1741 {
1742 public:
1744  Field () : Field<int, field>() {}
1745 
1749  Field (unsigned val, const RealmBase *rlm=nullptr) : Field<int, field>(val, rlm) {}
1750 
1752  /* \param from field to copy */
1753  Field (const Field& from) : Field<int, field>(from) {}
1754 
1758  Field (const f8String& from, const RealmBase *rlm=nullptr) : Field<int, field>(from.c_str(), rlm) {}
1759 
1763  Field (const char *from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1764 
1766  ~Field() {}
1767 };
1768 
1769 //-------------------------------------------------------------------------------------------------
1771 
1773 
1774 template<unsigned short field>
1775 class Field<TagNum, field> : public Field<int, field>
1776 {
1777 public:
1779  Field () : Field<int, field>() {}
1780 
1784  Field (const unsigned& val, const RealmBase *rlm=nullptr) : Field<int, field>(val, rlm) {}
1785 
1787  /* \param from field to copy */
1788  Field (const Field& from) : Field<int, field>(from) {}
1789 
1793  Field (const f8String& from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1794 
1798  Field (const char *from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1799 
1801  ~Field() {}
1802 };
1803 
1804 //-------------------------------------------------------------------------------------------------
1806 
1808 
1809 template<unsigned short field>
1810 class Field<SeqNum, field> : public Field<int, field>
1811 {
1812 public:
1814  Field () : Field<int, field>() {}
1815 
1819  Field (const unsigned& val, const RealmBase *rlm=nullptr) : Field<int, field>(val, rlm) {}
1820 
1822  /* \param from field to copy */
1823  Field (const Field& from) : Field<int, field>(from) {}
1824 
1828  Field (const f8String& from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1829 
1833  Field (const char *from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1834 
1836  ~Field() {}
1837 };
1838 
1839 //-------------------------------------------------------------------------------------------------
1841 
1843 
1844 template<unsigned short field>
1845 class Field<NumInGroup, field> : public Field<int, field>
1846 {
1847 public:
1849  Field () : Field<int, field>() {}
1850 
1854  Field (const unsigned& val, const RealmBase *rlm=nullptr) : Field<int, field>(val, rlm) {}
1855 
1857  /* \param from field to copy */
1858  Field (const Field& from) : Field<int, field>(from) {}
1859 
1863  Field (const f8String& from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1864 
1868  Field (const char *from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1869 
1871  ~Field() {}
1872 };
1873 
1874 //-------------------------------------------------------------------------------------------------
1876 
1878 
1879 template<unsigned short field>
1880 class Field<DayOfMonth, field> : public Field<int, field>
1881 {
1882 public:
1884  Field () : Field<int, field>() {}
1885 
1889  Field (const unsigned& val, const RealmBase *rlm=nullptr) : Field<int, field>(val, rlm) {}
1890 
1892  /* \param from field to copy */
1893  Field (const Field& from) : Field<int, field>(from) {}
1894 
1898  Field (const f8String& from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1899 
1903  Field (const char *from, const RealmBase *rlm=nullptr) : Field<int, field>(from, rlm) {}
1904 
1906  ~Field() {}
1907 };
1908 
1909 //-------------------------------------------------------------------------------------------------
1911 
1913 
1914 template<unsigned short field>
1915 class Field<Boolean, field> : public BaseField
1916 {
1917  bool _value;
1919 
1920 public:
1922  static unsigned short get_field_id() { return field; }
1923 
1925  FieldTrait::FieldType get_underlying_type() const { return _ftype; }
1926 
1928  Field () : BaseField(field) {}
1929 
1933  Field (const char val, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(toupper(val) == 'Y') {}
1934 
1937  explicit Field (const bool val) : BaseField(field), _value(val) {}
1938 
1940  /* \param from field to copy */
1941  Field (const Field& from) : BaseField(field), _value(from._value) {}
1942 
1946  Field (const f8String& from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(toupper(from[0]) == 'Y') {}
1947 
1951  Field (const char *from, const RealmBase *rlm=nullptr) : BaseField(field, rlm), _value(toupper(*from) == 'Y') {}
1952 
1954  ~Field() {}
1955 
1957 
1959  Field& operator=(const Field& that)
1960  {
1961  if (this != &that)
1962  _value = that._value;
1963  return *this;
1964  }
1965 
1967 
1969  bool operator==(const BaseField& that) const
1970  { return same_base(that) && static_cast<const Field<Boolean, field>&>(that)._value == _value; }
1971 
1973 
1975  bool operator<(const BaseField& that) const
1976  { return same_base(that) && _value < static_cast<const Field<Boolean, field>&>(that)._value; }
1977 
1979 
1981  bool operator>(const BaseField& that) const
1982  { return same_base(that) && _value > static_cast<const Field<Boolean, field>&>(that)._value; }
1983 
1986  bool get() const { return _value; }
1987 
1990  bool operator()() const { return _value; }
1991 
1994  int get_rlm_idx() const { return _rlm ? _rlm->get_rlm_idx(_value ? 'Y' : 'N') : -1; }
1995 
1999  bool set(const bool from) { return _value = from; }
2000 
2004  bool set_from_raw(const f8String& from) { return _value = toupper(from[0]) == 'Y'; }
2005 
2008  Field *copy() { return new Field(*this); }
2009 
2013  std::ostream& print(std::ostream& os) const { return os << (_value ? 'Y' : 'N'); }
2014 
2018  size_t print(char *to) const { *to = _value ? 'Y' : 'N'; return 1; }
2019 };
2020 
2021 //-------------------------------------------------------------------------------------------------
2022 using Qty = fp_type;
2023 using Amt = fp_type;
2024 using price = fp_type;
2027 
2028 //-------------------------------------------------------------------------------------------------
2036 using data = f8String;
2037 
2038 //-------------------------------------------------------------------------------------------------
2040 class Inst
2041 {
2042  struct _gen
2043  {
2050  template<typename T>
2051  static BaseField *_make(const char *from, const RealmBase *db, const int rv)
2052  { return new T{from, db}; }
2053 
2060  template<typename T, typename R>
2061  static BaseField *_make(const char *from, const RealmBase *db, const int rv)
2062  {
2063  return !db || rv < 0 || rv >= db->_sz || db->_dtype != RealmBase::dt_set
2064  ? new T(from, db) : new T(db->get_rlm_val<R>(rv), db);
2065  }
2066  };
2067 
2068 public:
2069  BaseField *(&_do)(const char *from, const RealmBase *db, const int);
2070 
2071  template<typename T, typename... args>
2072  Inst(Type2Type<T, args...>) : _do(_gen::_make<T, args...>) {}
2073 };
2074 
2076 {
2077  const Inst _create;
2078  const char *_name;
2079  const unsigned short _fnum;
2080  const RealmBase *_rlm;
2081  const char *_comment;
2082 };
2083 
2084 //-------------------------------------------------------------------------------------------------
2085 // Common (administrative) msgtypes
2089 const f8String Common_MsgType_REJECT("3");
2091 const f8String Common_MsgType_LOGOUT("5");
2092 const f8String Common_MsgType_LOGON("A");
2094 const char Common_MsgByte_HEARTBEAT('0');
2095 const char Common_MsgByte_TEST_REQUEST('1');
2096 const char Common_MsgByte_RESEND_REQUEST('2');
2097 const char Common_MsgByte_REJECT('3');
2098 const char Common_MsgByte_SEQUENCE_RESET('4');
2099 const char Common_MsgByte_LOGOUT('5');
2100 const char Common_MsgByte_LOGON('A');
2101 const char Common_MsgByte_BUSINESS_REJECT('j');
2102 
2103 //-------------------------------------------------------------------------------------------------
2104 // Common FIX field numbers
2105 
2106 const unsigned short Common_BeginSeqNo(7);
2107 const unsigned short Common_BeginString(8);
2108 const unsigned short Common_BodyLength(9);
2109 const unsigned short Common_CheckSum(10);
2110 const unsigned short Common_EndSeqNo(16);
2111 const unsigned short Common_MsgSeqNum(34);
2112 const unsigned short Common_MsgType(35);
2113 const unsigned short Common_NewSeqNo(36);
2114 const unsigned short Common_PossDupFlag(43);
2115 const unsigned short Common_RefSeqNum(45);
2116 const unsigned short Common_SenderCompID(49);
2117 const unsigned short Common_SendingTime(52);
2118 const unsigned short Common_TargetCompID(56);
2119 const unsigned short Common_Text(58);
2120 const unsigned short Common_EncryptMethod(98);
2121 const unsigned short Common_HeartBtInt(108);
2122 const unsigned short Common_TestReqID(112);
2123 const unsigned short Common_OnBehalfOfCompID(115);
2124 const unsigned short Common_OnBehalfOfSubID(116);
2125 const unsigned short Common_OrigSendingTime(122);
2126 const unsigned short Common_GapFillFlag(123);
2127 const unsigned short Common_ResetSeqNumFlag(141);
2128 const unsigned short Common_OnBehalfOfLocationID(144);
2129 const unsigned short Common_OnBehalfOfSendingTime(370);
2130 const unsigned short Common_RefMsgType(372);
2131 const unsigned short Common_BusinessRejectReason(380);
2132 const unsigned short Common_DefaultApplVerID(1137); // >= 5.0 || FIXT1.1
2133 
2134 //-------------------------------------------------------------------------------------------------
2135 // Common FIX fields
2136 
2142 
2144 
2154 
2157 
2161 
2165 
2170 
2171 //-------------------------------------------------------------------------------------------------
2172 
2173 } // FIX8
2174 
2175 #endif // FIX8_FIELD_HPP_
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1473
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:608
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1951
const char & set(const char &from)
Definition: field.hpp:802
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1893
size_t print(char *to) const
Definition: field.hpp:711
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1409
const unsigned short Common_GapFillFlag(123)
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1858
bool operator>=(const BaseField &that) const
Greater or equal to operator.
Definition: field.hpp:237
const char Common_MsgByte_SEQUENCE_RESET('4')
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1251
f8String country
Definition: field.hpp:2031
const RealmBase * _rlm
Definition: field.hpp:132
Field(const unsigned &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1854
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:397
size_t encode(std::ostream &os) const
Definition: field.hpp:184
const char Common_MsgByte_REJECT('3')
std::ostream & _print(std::ostream &os, int idx) const
Definition: field.hpp:110
virtual bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:548
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:725
virtual bool operator>(const BaseField &that) const =0
Greater than operator.
const unsigned short Common_TestReqID(112)
Field(const unsigned &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1819
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:660
const int & operator()() const
Definition: field.hpp:348
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:410
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1065
const f8String Common_MsgType_BUSINESS_REJECT("j")
#define FIX8_DEFAULT_PRECISION
Definition: f8config.h:99
Field(const tm &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1173
const unsigned short Common_RefMsgType(372)
Int2Type idiom. Kudos to Andrei Alexandrescu.
Definition: field.hpp:54
f8String data
Definition: field.hpp:2036
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:654
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:780
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1828
const unsigned short Common_CheckSum(10)
BaseField *(&) _do(const char *from, const RealmBase *db, const int)
Definition: field.hpp:2069
static const ticks million
Definition: tickval.hpp:76
Partial specialisation for UTCDateOnly field type.
Definition: field.hpp:1244
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1654
virtual ~Field()
Dtor.
Definition: field.hpp:405
virtual bool operator==(const BaseField &that) const =0
Equivalence operator.
size_t modp_dtoa(double value, char *str, int prec)
Convert double to ascii.
Definition: modp_numtoa.c:68
std::ostream & print(std::ostream &os) const
Definition: field.hpp:367
const f8String & set(const f8String &from)
Definition: field.hpp:570
const unsigned short Common_DefaultApplVerID(1137)
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1535
const f8String Common_MsgType_LOGON("A")
const size_t MAX_MSGTYPE_FIELD_LEN(32)
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1793
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1374
void set(const Tickval &from)
Definition: field.hpp:1422
const fp_type & set(const fp_type &from)
Definition: field.hpp:692
const char Common_MsgByte_BUSINESS_REJECT('j')
size_t itoa(T value, char *result, int base)
Fast itoa.
Definition: f8utils.hpp:647
const f8String Common_MsgType_SEQUENCE_RESET("4")
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1674
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:644
const int & set_from_raw(const f8String &from)
Definition: field.hpp:358
Partial specialisation for int field type.
Definition: field.hpp:268
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1461
bool same_base(const BaseField &that) const
BaseField Equivalence test.
Definition: field.hpp:207
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1501
size_t print(char *to) const
Definition: field.hpp:821
const char Common_MsgByte_LOGON('A')
Field()
Ctor. Compiler won't supply this method.
Definition: field.hpp:1884
const RealmBase * get_realm() const
Definition: field.hpp:241
bool is_valid() const
Definition: field.hpp:785
Field(const char val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1933
const unsigned short Common_BusinessRejectReason(380)
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:536
const unsigned short Common_OnBehalfOfCompID(115)
Partial specialisation for MonthYear field type.
Definition: field.hpp:1450
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1354
const unsigned short Common_TargetCompID(56)
const unsigned short Common_Text(58)
const unsigned short Common_HeartBtInt(108)
virtual ~BaseField()
Dtor.
Definition: field.hpp:141
Field(const char &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:740
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:319
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:430
Field(const tm &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1070
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:605
static bool is_char(FieldType ftype)
Definition: traits.hpp:88
const Tickval & operator()() const
Definition: field.hpp:1620
const char & set_from_raw(const f8String &from)
Definition: field.hpp:807
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:631
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1975
f8String MultipleCharValue
Definition: field.hpp:2029
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1094
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:402
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1946
const void * _range
Definition: field.hpp:62
const unsigned short Common_EncryptMethod(98)
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:331
virtual int get_rlm_idx() const
Definition: field.hpp:167
virtual bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:436
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1599
Field()
Ctor. Compiler won't supply this method.
Definition: field.hpp:1814
int get_rlm_idx() const
Definition: field.hpp:451
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1589
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:508
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1605
f8String MultipleStringValue
Definition: field.hpp:2030
Tickval::ticks date_parse(const char *ptr, size_t len)
Definition: field.hpp:1010
bool operator!=(const char *that) const
Inequivalence operator.
Definition: field.hpp:425
size_t parse_decimal(const char *begin, size_t len, int &to)
Definition: field.hpp:844
fp_type fast_atof(const char *p)
Definition: f8utils.hpp:727
const char * _name
Definition: field.hpp:2078
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:758
Field(const fp_type &val, const int prec, const RealmBase *rlm=nullptr)
Definition: field.hpp:626
virtual bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1513
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1581
Field(const fp_type &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:620
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:615
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1225
const size_t HEADER_CALC_OFFSET(32)
size_t print(char *to) const
Definition: field.hpp:589
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
Partial specialisation for TZTimeOnly field type.
Definition: field.hpp:1554
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1863
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:390
virtual ~Field()
Dtor.
Definition: field.hpp:314
const f8String Common_MsgType_TEST_REQUEST("1")
const f8String Common_MsgType_HEARTBEAT("0")
Partial specialisation for f8String field type.
Definition: field.hpp:490
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1763
const f8String Common_MsgType_LOGOUT("5")
const T * as() const
Definition: field.hpp:179
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1704
double fp_type
Definition: f8types.hpp:51
bool is_valid(const T &what) const
Definition: field.hpp:76
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1403
Field(const Tickval &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1055
std::ostream & print(std::ostream &os) const
Definition: field.hpp:816
void set(const Tickval &from)
Definition: field.hpp:1717
Partial specialisation for unsigned short field type.
Definition: field.hpp:718
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1151
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1576
const unsigned short Common_SenderCompID(49)
const unsigned short Common_EndSeqNo(16)
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1959
Domain range/set static metadata base class.
Definition: field.hpp:58
const fp_type & set_from_raw(const f8String &from)
Definition: field.hpp:697
const f8String Common_MsgType_REJECT("3")
virtual ~Field()
Dtor.
Definition: field.hpp:639
const char Common_MsgByte_RESEND_REQUEST('2')
Partial specialisation for Boolean field type.
Definition: field.hpp:1915
size_t date_time_format(const Tickval &tickval, char *to, TimeIndicator ind)
Definition: field.hpp:895
size_t print(char *to) const
Definition: field.hpp:1731
virtual bool operator<(const BaseField &that) const =0
Less than operator.
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1306
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1753
const char * operator()() const
Definition: field.hpp:459
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1284
std::ostream & print(std::ostream &os) const
Definition: field.hpp:584
const Tickval & operator()() const
Definition: field.hpp:1212
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1571
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:745
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1148
RealmBase(const void *range, RealmType dtype, FieldTrait::FieldType ftype, int sz, const char *const *descriptions)
Definition: field.hpp:68
FieldTrait::FieldType _ftype
Definition: field.hpp:64
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1868
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:276
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:768
size_t print(char *to) const
Definition: field.hpp:1132
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1925
Field(const tm &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1483
const int _sz
Definition: field.hpp:65
const char * _comment
Definition: field.hpp:2081
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:286
bool is_valid() const
Definition: field.hpp:447
Field()
Ctor. Compiler won't supply this method.
Definition: field.hpp:1744
static bool is_float(FieldType ftype)
Definition: traits.hpp:93
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1969
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1478
static BaseField * _make(const char *from, const RealmBase *db, const int rv)
Definition: field.hpp:2051
const char * set(const char *from)
Definition: field.hpp:464
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1564
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1397
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1300
fp_type Amt
Definition: field.hpp:2023
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1043
size_t print(char *to) const
Definition: field.hpp:1338
Tickval::ticks time_parse(const char *ptr, size_t len, bool timeonly=false)
Definition: field.hpp:978
Field()=delete
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1203
TimeIndicator
Definition: field.hpp:882
T fast_atoi(const char *str, const char term='\0')
Definition: f8utils.hpp:626
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1431
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1664
const unsigned short Common_PossDupFlag(43)
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1898
virtual bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:542
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1357
Type2Type idiom. Variadic template version. Kudos to Andrei Alexandrescu.
Definition: f8types.hpp:378
const Tickval & operator()() const
Definition: field.hpp:1713
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:666
struct tm get_tm() const
Definition: tickval.hpp:213
static const ticks billion
Definition: tickval.hpp:77
Tickval::ticks date_time_parse(const char *ptr, size_t len)
Definition: field.hpp:938
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:518
const RealmBase * _rlm
Definition: field.hpp:2080
Partial specialisation for fp_type field type. fp_type is singe or double.
Definition: field.hpp:596
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1364
static const ticks noticks
Definition: tickval.hpp:68
const unsigned short Common_MsgType(35)
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:750
f8String currency
Definition: field.hpp:2032
bool operator==(const char *that) const
Equivalence operator.
Definition: field.hpp:420
size_t print(char *to) const
Definition: field.hpp:2018
unsigned msecs() const
Definition: tickval.hpp:145
const T & get_rlm_val(const int idx) const
Definition: field.hpp:87
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1158
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1682
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1903
std::ostream & print(std::ostream &os) const
Definition: field.hpp:706
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1122
Partial specialisation for LocalMktDate field type.
Definition: field.hpp:1347
void set(const Tickval &from)
Definition: field.hpp:1113
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1507
const Tickval & operator()() const
Definition: field.hpp:1315
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1657
const unsigned short Common_MsgSeqNum(34)
const unsigned char default_assignment_separator('=')
default FIX assignment separator (=)
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:636
const unsigned short Common_SendingTime(52)
const char Common_MsgByte_HEARTBEAT('0')
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1181
const unsigned short Common_BodyLength(9)
const unsigned short Common_OrigSendingTime(122)
const char Common_MsgByte_TEST_REQUEST('1')
decltype(f8_time_point::min().time_since_epoch().count()) ticks
Definition: tickval.hpp:66
size_t print(char *to) const
Definition: field.hpp:1545
const unsigned short Common_OnBehalfOfSendingTime(370)
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:325
void set(const Tickval &from)
Definition: field.hpp:1216
Field metadata structures.
Definition: field.hpp:2040
const int & set(const int &from)
Definition: field.hpp:353
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:306
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1271
bool set_from_raw(const f8String &from)
Definition: field.hpp:2004
const f8String Common_MsgType_RESEND_REQUEST("2")
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1941
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1078
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:498
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1088
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1040
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1328
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1692
Partial specialisation for TZTimestamp field type.
Definition: field.hpp:1647
f8String Language
Definition: field.hpp:2034
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1823
void set(const Tickval &from)
Definition: field.hpp:1526
fp_type Percentage
Definition: field.hpp:2026
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1294
Field template. There will ONLY be partial template specialisations of this template.
Definition: field.hpp:256
const char * set_from_raw(const char *from)
Definition: field.hpp:469
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1669
Partial specialisation for UTCTimestamp field type.
Definition: field.hpp:1033
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:728
std::ostream & print(std::ostream &os, int idx) const
Definition: field.hpp:116
const unsigned short Common_OnBehalfOfLocationID(144)
static bool is_int(FieldType ftype)
Definition: traits.hpp:83
const Inst _create
Definition: field.hpp:2077
Field(const unsigned &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1889
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1168
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1163
virtual bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:442
Field(const Field &from)
Definition: field.hpp:735
const unsigned short _fnum
Definition: field.hpp:129
bool operator<=(const BaseField &that) const
Less or equal to operator.
Definition: field.hpp:232
bool operator==(const BaseField &that) const
Equivalence operator.
Definition: field.hpp:1191
void set(const Tickval &from)
Definition: field.hpp:1319
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1468
Field(const unsigned &val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1784
const Tickval & operator()() const
Definition: field.hpp:1109
const unsigned short Common_NewSeqNo(36)
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:296
time_t time_to_epoch(const tm &ltm, int utcdiff=0)
Definition: field.hpp:858
static bool is_string(FieldType ftype)
Definition: traits.hpp:98
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:774
const unsigned char default_field_separator(0x1)
default FIX field separator (^A)
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1922
const unsigned short Common_BeginString(8)
size_t print(char *to) const
Definition: field.hpp:1235
Field()
Ctor. Compiler won't supply this method.
Definition: field.hpp:1779
Field(unsigned val, const RealmBase *rlm=nullptr)
Definition: field.hpp:1749
Partial specialisation for UTCTimeOnly field type.
Definition: field.hpp:1141
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:279
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1197
Partial specialisation for char * field type.
Definition: field.hpp:379
Field()
Ctor. Compiler won't supply this method.
Definition: field.hpp:1849
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:526
f8String XMLData
Definition: field.hpp:2035
const fp_type & operator()() const
Definition: field.hpp:687
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1491
The base field class (ABC) for all fields.
Definition: field.hpp:127
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:1254
bool is_valid() const
Definition: field.hpp:336
const unsigned short Common_OnBehalfOfSubID(116)
const f8String & set_from_raw(const f8String &from)
Definition: field.hpp:575
const f8String & operator()() const
Definition: field.hpp:565
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1100
fp_type Qty
Definition: field.hpp:2022
friend std::ostream & operator<<(std::ostream &os, const BaseField &what)
Definition: field.hpp:247
f8String Exchange
Definition: field.hpp:2033
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1726
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1633
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1458
FieldTrait::FieldType get_underlying_type() const
The FieldType.
Definition: field.hpp:501
int get_rlm_idx() const
Definition: field.hpp:789
const Tickval & operator()() const
Definition: field.hpp:1522
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1060
size_t print(char *to) const
Definition: field.hpp:1441
Field(const tm &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1276
size_t print(char *to) const
Definition: field.hpp:372
void set_precision(const int prec)
Definition: field.hpp:671
Field(const tm &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1379
int get_rlm_idx() const
Definition: field.hpp:340
RealmType _dtype
Definition: field.hpp:63
void format0(int data, char *to, int width)
Definition: field.hpp:830
bool operator<(const BaseField &that) const
Less than operator.
Definition: field.hpp:1698
const char & operator()() const
Definition: field.hpp:797
static BaseField * _make(const char *from, const RealmBase *db, const int rv)
Definition: field.hpp:2061
size_t encode(char *to) const
Definition: field.hpp:194
const unsigned short Common_RefSeqNum(45)
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:301
Base class for all fix messages.
Definition: message.hpp:381
const unsigned short _fnum
Definition: field.hpp:2079
std::ostream & print(std::ostream &os) const
Definition: field.hpp:478
size_t print(char *to) const
Definition: field.hpp:1638
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1369
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1833
const unsigned short Common_ResetSeqNumFlag(141)
const Tickval & operator()() const
Definition: field.hpp:1418
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1981
ticks get_ticks() const
Definition: tickval.hpp:129
std::ostream & print(std::ostream &os) const
Definition: field.hpp:2013
Field & operator=(const Field &that)
Assignment operator.
Definition: field.hpp:1387
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1758
int get_rlm_idx(const T &what) const
Definition: field.hpp:94
const unsigned short Common_BeginSeqNo(7)
fp_type PriceOffset
Definition: field.hpp:2025
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:1561
size_t print(char *to) const
Definition: field.hpp:483
Inst(Type2Type< T, args...>)
Definition: field.hpp:2072
Field(const int val, const RealmBase *rlm=nullptr)
Definition: field.hpp:291
static unsigned short get_field_id()
Get the FIX fieldID (tag number).
Definition: field.hpp:387
void set(const Tickval &from)
Definition: field.hpp:1624
std::string f8String
Definition: f8types.hpp:47
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1261
Field & operator=(const Field &)=delete
virtual FieldTrait::FieldType get_underlying_type() const =0
bool set(const bool from)
Definition: field.hpp:1999
Field(const f8String &from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1266
unsigned short get_tag() const
Definition: field.hpp:145
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:1798
virtual std::ostream & print(std::ostream &os) const =0
const char Common_MsgByte_LOGOUT('5')
virtual BaseField * copy()=0
bool operator>(const BaseField &that) const
Greater than operator.
Definition: field.hpp:1611
virtual ~Field()
Dtor.
Definition: field.hpp:521
Field(const char *from, const RealmBase *rlm=nullptr)
Definition: field.hpp:513
const char *const * _descriptions
Definition: field.hpp:66
fp_type price
Definition: field.hpp:2024
bool operator!=(const BaseField &that) const
Inequivalence operator.
Definition: field.hpp:227
Field(const Field &from)
Copy Ctor.
Definition: field.hpp:1788