Field.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 
3 /****************************************************************************
4 ** Copyright (c) 2001-2014
5 **
6 ** This file is part of the QuickFIX FIX Engine
7 **
8 ** This file may be distributed under the terms of the quickfixengine.org
9 ** license as defined by quickfixengine.org and appearing in the file
10 ** LICENSE included in the packaging of this file.
11 **
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 **
15 ** See http://www.quickfixengine.org/LICENSE for licensing information.
16 **
17 ** Contact ask@quickfixengine.org if any conditions of this licensing are
18 ** not clear to you.
19 **
20 ****************************************************************************/
21 
22 #ifndef FIX_FIELD
23 #define FIX_FIELD
24 
25 #ifdef _MSC_VER
26 #pragma warning( disable : 4786 )
27 #endif
28 
29 #include <sstream>
30 #include <numeric>
31 #include "FieldNumbers.h"
32 #include "FieldConvertors.h"
33 #include "FieldTypes.h"
34 #include "Utility.h"
35 
36 namespace FIX
37 {
45 class FieldBase
46 {
47  friend class Message;
48 public:
49  FieldBase( int field, const std::string& string )
50  : m_field( field ), m_string(string), m_length( 0 ), m_total( 0 ),
51  m_calculated( false )
52  {}
53 
54  virtual ~FieldBase() {}
55 
56  void setField( int field )
57  {
58  m_field = field;
59  m_calculated = false;
60  }
61 
62  void setString( const std::string& string )
63  {
64  m_string = string;
65  m_calculated = false;
66  }
67 
69  int getField() const
70  { return m_field; }
71 
73  const std::string& getString() const
74  { return m_string; }
75 
77  const std::string& getFixString() const
78  {
79  calculate();
80  return m_data;
81  }
82 
84  int getLength() const
85  {
86  calculate();
87  return m_length;
88  }
89 
91  int getTotal() const
92  {
93  calculate();
94  return m_total;
95  }
96 
98  bool operator < ( const FieldBase& field ) const
99  { return m_field < field.m_field; }
100 
101 private:
102  void calculate() const
103  {
104  if( m_calculated ) return;
105 
106  int tagLength = FIX::number_of_symbols_in( m_field ) + 1;
107  m_length = tagLength + m_string.length() + 1;
108 
109  m_data.resize( m_length );
110 
111  char * buf = (char*)m_data.c_str();
112  FIX::integer_to_string(buf, tagLength, m_field);
113 
114  buf[tagLength - 1] = '=';
115  memcpy( buf + tagLength, m_string.data(), m_string.length() );
116  buf[m_length - 1] = '\001';
117 
118  const unsigned char* iter = reinterpret_cast<const unsigned char*>( m_data.c_str() );
119  m_total = std::accumulate( iter, iter + m_length, 0 );
120 
121  m_calculated = true;
122  }
123 
124  int m_field;
125  std::string m_string;
126  mutable std::string m_data;
127  mutable int m_length;
128  mutable int m_total;
129  mutable bool m_calculated;
130 };
133 inline std::ostream& operator <<
134 ( std::ostream& stream, const FieldBase& field )
135 {
136  stream << field.getString();
137  return stream;
138 }
139 
144 class StringField : public FieldBase
145 {
146 public:
147  explicit StringField( int field, const std::string& data )
148 : FieldBase( field, data ) {}
149  StringField( int field )
150 : FieldBase( field, "" ) {}
151 
152  void setValue( const std::string& value )
153  { setString( value ); }
154  const std::string& getValue() const
155  { return getString(); }
156  operator const std::string&() const
157  { return getString(); }
158 
159  bool operator<( const StringField& rhs ) const
160  { return getString() < rhs.getString(); }
161  bool operator>( const StringField& rhs ) const
162  { return getString() > rhs.getString(); }
163  bool operator==( const StringField& rhs ) const
164  { return getString() == rhs.getString(); }
165  bool operator!=( const StringField& rhs ) const
166  { return getString() != rhs.getString(); }
167  bool operator<=( const StringField& rhs ) const
168  { return getString() <= rhs.getString(); }
169  bool operator>=( const StringField& rhs ) const
170  { return getString() >= rhs.getString(); }
171  friend bool operator<( const StringField&, const char* );
172  friend bool operator<( const char*, const StringField& );
173  friend bool operator>( const StringField&, const char* );
174  friend bool operator>( const char*, const StringField& );
175  friend bool operator==( const StringField&, const char* );
176  friend bool operator==( const char*, const StringField& );
177  friend bool operator!=( const StringField&, const char* );
178  friend bool operator!=( const char*, const StringField& );
179  friend bool operator<=( const StringField&, const char* );
180  friend bool operator<=( const char*, const StringField& );
181  friend bool operator>=( const StringField&, const char* );
182  friend bool operator>=( const char*, const StringField& );
183 
184  friend bool operator<( const StringField&, const std::string& );
185  friend bool operator<( const std::string&, const StringField& );
186  friend bool operator>( const StringField&, const std::string& );
187  friend bool operator>( const std::string&, const StringField& );
188  friend bool operator==( const StringField&, const std::string& );
189  friend bool operator==( const std::string&, const StringField& );
190  friend bool operator!=( const StringField&, const std::string& );
191  friend bool operator!=( const std::string&, const StringField& );
192  friend bool operator<=( const StringField&, const std::string& );
193  friend bool operator<=( const std::string&, const StringField& );
194  friend bool operator>=( const StringField&, const std::string& );
195  friend bool operator>=( const std::string&, const StringField& );
196 };
197 
198 inline bool operator<( const StringField& lhs, const char* rhs )
199  { return lhs.getValue() < rhs; }
200 inline bool operator<( const char* lhs, const StringField& rhs )
201  { return lhs < rhs.getValue(); }
202 inline bool operator>( const StringField& lhs, const char* rhs )
203  { return lhs.getValue() > rhs; }
204 inline bool operator>( const char* lhs, const StringField& rhs )
205  { return lhs > rhs.getValue(); }
206 inline bool operator==( const StringField& lhs, const char* rhs )
207  { return lhs.getValue() == rhs; }
208 inline bool operator==( const char* lhs, const StringField& rhs )
209  { return lhs == rhs.getValue(); }
210 inline bool operator!=( const StringField& lhs, const char* rhs )
211  { return lhs.getValue() != rhs; }
212 inline bool operator!=( const char* lhs, const StringField& rhs )
213  { return lhs != rhs.getValue(); }
214 inline bool operator<=( const StringField& lhs, const char* rhs )
215  { return lhs.getValue() <= rhs; }
216 inline bool operator<=( const char* lhs, const StringField& rhs )
217  { return lhs <= rhs.getValue(); }
218 inline bool operator>=( const StringField& lhs, const char* rhs )
219  { return lhs.getValue() >= rhs; }
220 inline bool operator>=( const char* lhs, const StringField& rhs )
221  { return lhs >= rhs.getValue(); }
222 
223 inline bool operator<( const StringField& lhs, const std::string& rhs )
224  { return lhs.getValue() < rhs; }
225 inline bool operator<( const std::string& lhs, const StringField& rhs )
226  { return lhs < rhs.getValue(); }
227 inline bool operator>( const StringField& lhs, const std::string& rhs )
228  { return lhs.getValue() > rhs; }
229 inline bool operator>( const std::string& lhs, const StringField& rhs )
230  { return lhs > rhs.getValue(); }
231 inline bool operator==( const StringField& lhs, const std::string& rhs )
232  { return lhs.getValue() == rhs; }
233 inline bool operator==( const std::string& lhs, const StringField& rhs )
234  { return lhs == rhs.getValue(); }
235 inline bool operator!=( const StringField& lhs, const std::string& rhs )
236  { return lhs.getValue() != rhs; }
237 inline bool operator!=( const std::string& lhs, const StringField& rhs )
238  { return lhs != rhs.getValue(); }
239 inline bool operator<=( const StringField& lhs, const std::string& rhs )
240  { return lhs.getValue() <= rhs; }
241 inline bool operator<=( const std::string& lhs, const StringField& rhs )
242  { return lhs <= rhs.getValue(); }
243 inline bool operator>=( const StringField& lhs, const std::string& rhs )
244  { return lhs.getValue() >= rhs; }
245 inline bool operator>=( const std::string& lhs, const StringField& rhs )
246  { return lhs >= rhs.getValue(); }
247 
249 class CharField : public FieldBase
250 {
251 public:
252  explicit CharField( int field, char data )
253 : FieldBase( field, CharConvertor::convert( data ) ) {}
254  CharField( int field )
255 : FieldBase( field, "" ) {}
256 
257  void setValue( char value )
258  { setString( CharConvertor::convert( value ) ); }
259  char getValue() const throw ( IncorrectDataFormat )
260  { try
261  { return CharConvertor::convert( getString() ); }
262  catch( FieldConvertError& )
263  { throw IncorrectDataFormat( getField(), getString() ); } }
264  operator char() const
265  { return getValue(); }
266 };
267 
269 class DoubleField : public FieldBase
270 {
271 public:
272  explicit DoubleField( int field, double data, int padding = 0 )
273 : FieldBase( field, DoubleConvertor::convert( data, padding ) ) {}
274  DoubleField( int field )
275 : FieldBase( field, "" ) {}
276 
277  void setValue( double value, int padding = 0 )
278  { setString( DoubleConvertor::convert( value, padding ) ); }
279  double getValue() const throw ( IncorrectDataFormat )
280  { try
281  { return DoubleConvertor::convert( getString() ); }
282  catch( FieldConvertError& )
283  { throw IncorrectDataFormat( getField(), getString() ); } }
284  operator double() const
285  { return getValue(); }
286 };
287 
289 class IntField : public FieldBase
290 {
291 public:
292  explicit IntField( int field, int data )
293 : FieldBase( field, IntConvertor::convert( data ) ) {}
294  IntField( int field )
295 : FieldBase( field, "" ) {}
296 
297  void setValue( int value )
298  { setString( IntConvertor::convert( value ) ); }
299  int getValue() const throw ( IncorrectDataFormat )
300  { try
301  { return IntConvertor::convert( getString() ); }
302  catch( FieldConvertError& )
303  { throw IncorrectDataFormat( getField(), getString() ); } }
304  operator const int() const
305  { return getValue(); }
306 };
307 
309 class BoolField : public FieldBase
310 {
311 public:
312  explicit BoolField( int field, bool data )
313 : FieldBase( field, BoolConvertor::convert( data ) ) {}
314  BoolField( int field )
315 : FieldBase( field, "" ) {}
316 
317  void setValue( bool value )
318  { setString( BoolConvertor::convert( value ) ); }
319  bool getValue() const throw ( IncorrectDataFormat )
320  { try
321  { return BoolConvertor::convert( getString() ); }
322  catch( FieldConvertError& )
323  { throw IncorrectDataFormat( getField(), getString() ); } }
324  operator bool() const
325  { return getValue(); }
326 };
327 
330 {
331 public:
332  explicit UtcTimeStampField( int field, const UtcTimeStamp& data, bool showMilliseconds = false )
333 : FieldBase( field, UtcTimeStampConvertor::convert( data, showMilliseconds ) ) {}
334  UtcTimeStampField( int field, bool showMilliseconds = false )
335 : FieldBase( field, UtcTimeStampConvertor::convert( UtcTimeStamp(), showMilliseconds ) ) {}
336 
337  void setValue( const UtcTimeStamp& value )
340  { try
342  catch( FieldConvertError& )
343  { throw IncorrectDataFormat( getField(), getString() ); } }
344  operator UtcTimeStamp() const
345  { return getValue(); }
346 
347  bool operator<( const UtcTimeStampField& rhs ) const
348  { return getValue() < rhs.getValue(); }
349  bool operator==( const UtcTimeStampField& rhs ) const
350  { return getValue() == rhs.getValue(); }
351  bool operator!=( const UtcTimeStampField& rhs ) const
352  { return getValue() != rhs.getValue(); }
353 };
354 
356 class UtcDateField : public FieldBase
357 {
358 public:
359  explicit UtcDateField( int field, const UtcDate& data )
360 : FieldBase( field, UtcDateConvertor::convert( data ) ) {}
361  UtcDateField( int field )
362 : FieldBase( field, UtcDateConvertor::convert( UtcDate() ) ) {}
363 
364  void setValue( const UtcDate& value )
365  { setString( UtcDateConvertor::convert( value ) ); }
367  { try
368  { return UtcDateConvertor::convert( getString() ); }
369  catch( FieldConvertError& )
370  { throw IncorrectDataFormat( getField(), getString() ); } }
371  operator UtcDate() const
372  { return getValue(); }
373 
374  bool operator<( const UtcDateField& rhs ) const
375  { return getValue() < rhs.getValue(); }
376  bool operator==( const UtcDateField& rhs ) const
377  { return getValue() == rhs.getValue(); }
378  bool operator!=( const UtcDateField& rhs ) const
379  { return getValue() != rhs.getValue(); }
380 };
381 
384 {
385 public:
386  explicit UtcTimeOnlyField( int field, const UtcTimeOnly& data, bool showMilliseconds = false )
387 : FieldBase( field, UtcTimeOnlyConvertor::convert( data, showMilliseconds ) ) {}
388  UtcTimeOnlyField( int field, bool showMilliseconds = false )
389 : FieldBase( field, UtcTimeOnlyConvertor::convert( UtcTimeOnly(), showMilliseconds ) ) {}
390 
391  void setValue( const UtcTimeOnly& value )
394  { try
396  catch( FieldConvertError& )
397  { throw IncorrectDataFormat( getField(), getString() ); } }
398  operator UtcTimeOnly() const
399  { return getValue(); }
400 
401  bool operator<( const UtcTimeOnlyField& rhs ) const
402  { return getValue() < rhs.getValue(); }
403  bool operator==( const UtcTimeOnlyField& rhs ) const
404  { return getValue() == rhs.getValue(); }
405  bool operator!=( const UtcTimeOnlyField& rhs ) const
406  { return getValue() != rhs.getValue(); }
407 };
408 
410 class CheckSumField : public FieldBase
411 {
412 public:
413  explicit CheckSumField( int field, int data )
414 : FieldBase( field, CheckSumConvertor::convert( data ) ) {}
415  CheckSumField( int field )
416 : FieldBase( field, "" ) {}
417 
418  void setValue( int value )
419  { setString( CheckSumConvertor::convert( value ) ); }
420  int getValue() const throw ( IncorrectDataFormat )
421  { try
422  { return CheckSumConvertor::convert( getString() ); }
423  catch( FieldConvertError& )
424  { throw IncorrectDataFormat( getField(), getString() ); } }
425  operator const int() const
426  { return getValue(); }
427 };
428 
452 }
453 
454 #define DEFINE_FIELD_CLASS_NUM( NAME, TOK, TYPE, NUM ) \
455 class NAME : public TOK##Field { public: \
456 NAME() : TOK##Field(NUM) {} \
457 NAME(const TYPE& value) : TOK##Field(NUM, value) {} \
458 }
459 
460 #define DEFINE_FIELD_CLASS( NAME, TOK, TYPE ) \
461 DEFINE_FIELD_CLASS_NUM(NAME, TOK, TYPE, FIELD::NAME)
462 
463 #define DEFINE_DEPRECATED_FIELD_CLASS( NAME, TOK, TYPE ) \
464 DEFINE_FIELD_CLASS_NUM(NAME, TOK, TYPE, DEPRECATED_FIELD::NAME)
465 
466 #define DEFINE_FIELD_TIMECLASS_NUM( NAME, TOK, TYPE, NUM ) \
467 class NAME : public TOK##Field { public: \
468 NAME() : TOK##Field(NUM, false) {} \
469 NAME(bool showMilliseconds) : TOK##Field(NUM, showMilliseconds) {} \
470 NAME(const TYPE& value) : TOK##Field(NUM, value) {} \
471 NAME(const TYPE& value, bool showMilliseconds) : TOK##Field(NUM, value, showMilliseconds) {} \
472 }
473 
474 #define DEFINE_FIELD_TIMECLASS( NAME, TOK, TYPE ) \
475 DEFINE_FIELD_TIMECLASS_NUM(NAME, TOK, TYPE, FIELD::NAME)
476 
477 #define DEFINE_DEPRECATED_FIELD_TIMECLASS( NAME, TOK, TYPE ) \
478 DEFINE_FIELD_TIMECLASS_NUM(NAME, TOK, TYPE, DEPRECATED_FIELD::NAME)
479 
480 #define DEFINE_CHECKSUM( NAME ) \
481  DEFINE_FIELD_CLASS(NAME, CheckSum, FIX::INT)
482 #define DEFINE_STRING( NAME ) \
483  DEFINE_FIELD_CLASS(NAME, String, FIX::STRING)
484 #define DEFINE_CHAR( NAME ) \
485  DEFINE_FIELD_CLASS(NAME, Char, FIX::CHAR)
486 #define DEFINE_PRICE( NAME ) \
487  DEFINE_FIELD_CLASS(NAME, Price, FIX::PRICE)
488 #define DEFINE_INT( NAME ) \
489  DEFINE_FIELD_CLASS(NAME, Int, FIX::INT)
490 #define DEFINE_AMT( NAME ) \
491  DEFINE_FIELD_CLASS(NAME, Amt, FIX::AMT)
492 #define DEFINE_QTY( NAME ) \
493  DEFINE_FIELD_CLASS(NAME, Qty, FIX::QTY)
494 #define DEFINE_CURRENCY( NAME ) \
495  DEFINE_FIELD_CLASS(NAME, Currency, FIX::CURRENCY)
496 #define DEFINE_MULTIPLEVALUESTRING( NAME ) \
497  DEFINE_FIELD_CLASS(NAME, MultipleValueString, FIX::MULTIPLEVALUESTRING)
498 #define DEFINE_MULTIPLESTRINGVALUE( NAME ) \
499  DEFINE_FIELD_CLASS(NAME, MultipleStringValue, FIX::MULTIPLESTRINGVALUE)
500 #define DEFINE_MULTIPLECHARVALUE( NAME ) \
501  DEFINE_FIELD_CLASS(NAME, MultipleCharValue, FIX::MULTIPLECHARVALUE)
502 #define DEFINE_EXCHANGE( NAME ) \
503  DEFINE_FIELD_CLASS(NAME, Exchange, FIX::EXCHANGE)
504 #define DEFINE_UTCTIMESTAMP( NAME ) \
505  DEFINE_FIELD_TIMECLASS(NAME, UtcTimeStamp, FIX::UTCTIMESTAMP)
506 #define DEFINE_BOOLEAN( NAME ) \
507  DEFINE_FIELD_CLASS(NAME, Bool, FIX::BOOLEAN)
508 #define DEFINE_LOCALMKTDATE( NAME ) \
509  DEFINE_FIELD_CLASS(NAME, String, FIX::LOCALMKTDATE)
510 #define DEFINE_DATA( NAME ) \
511  DEFINE_FIELD_CLASS(NAME, Data, FIX::DATA)
512 #define DEFINE_FLOAT( NAME ) \
513  DEFINE_FIELD_CLASS(NAME, Float, FIX::FLOAT)
514 #define DEFINE_PRICEOFFSET( NAME ) \
515  DEFINE_FIELD_CLASS(NAME, PriceOffset, FIX::PRICEOFFSET)
516 #define DEFINE_MONTHYEAR( NAME ) \
517  DEFINE_FIELD_CLASS(NAME, MonthYear, FIX::MONTHYEAR)
518 #define DEFINE_DAYOFMONTH( NAME ) \
519  DEFINE_FIELD_CLASS(NAME, DayOfMonth, FIX::DAYOFMONTH)
520 #define DEFINE_UTCDATE( NAME ) \
521  DEFINE_FIELD_CLASS(NAME, UtcDate, FIX::UTCDATE)
522 #define DEFINE_UTCDATEONLY( NAME ) \
523  DEFINE_FIELD_CLASS(NAME, UtcDateOnly, FIX::UTCDATEONLY)
524 #define DEFINE_UTCTIMEONLY( NAME ) \
525  DEFINE_FIELD_CLASS(NAME, UtcTimeOnly, FIX::UTCTIMEONLY)
526 #define DEFINE_NUMINGROUP( NAME ) \
527  DEFINE_FIELD_CLASS(NAME, NumInGroup, FIX::NUMINGROUP)
528 #define DEFINE_SEQNUM( NAME ) \
529  DEFINE_FIELD_CLASS(NAME, SeqNum, FIX::SEQNUM)
530 #define DEFINE_LENGTH( NAME ) \
531  DEFINE_FIELD_CLASS(NAME, Length, FIX::LENGTH)
532 #define DEFINE_PERCENTAGE( NAME ) \
533  DEFINE_FIELD_CLASS(NAME, Percentage, FIX::PERCENTAGE)
534 #define DEFINE_COUNTRY( NAME ) \
535  DEFINE_FIELD_CLASS(NAME, Country, FIX::COUNTRY)
536 #define DEFINE_TZTIMEONLY( NAME ) \
537  DEFINE_FIELD_CLASS(NAME, String, FIX::TZTIMEONLY)
538 #define DEFINE_TZTIMESTAMP( NAME ) \
539  DEFINE_FIELD_CLASS(NAME, String, FIX::TZTIMESTAMP)
540 #define DEFINE_XMLDATA( NAME ) \
541  DEFINE_FIELD_CLASS(NAME, String, FIX::XMLDATA)
542 #define DEFINE_LANGUAGE( NAME ) \
543  DEFINE_FIELD_CLASS(NAME, String, FIX::LANGUAGE)
544 
545 #define USER_DEFINE_STRING( NAME, NUM ) \
546  DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::STRING, NUM)
547 #define USER_DEFINE_CHAR( NAME, NUM ) \
548  DEFINE_FIELD_CLASS_NUM(NAME, Char, FIX::CHAR, NUM)
549 #define USER_DEFINE_PRICE( NAME, NUM ) \
550  DEFINE_FIELD_CLASS_NUM(NAME, Price, FIX::PRICE, NUM)
551 #define USER_DEFINE_INT( NAME, NUM ) \
552  DEFINE_FIELD_CLASS_NUM(NAME, Int, FIX::INT, NUM)
553 #define USER_DEFINE_AMT( NAME, NUM ) \
554  DEFINE_FIELD_CLASS_NUM(NAME, Amt, FIX::AMT, NUM)
555 #define USER_DEFINE_QTY( NAME, NUM ) \
556  DEFINE_FIELD_CLASS_NUM(NAME, Qty, FIX::QTY, NUM)
557 #define USER_DEFINE_CURRENCY( NAME, NUM ) \
558  DEFINE_FIELD_CLASS_NUM(NAME, Currency, FIX::CURRENCY, NUM)
559 #define USER_DEFINE_MULTIPLEVALUESTRING( NAME, NUM ) \
560  DEFINE_FIELD_CLASS_NUM(NAME, MultipleValueString, FIX::MULTIPLEVALUESTRING, NUM)
561 #define USER_DEFINE_MULTIPLESTRINGVALUE( NAME, NUM ) \
562  DEFINE_FIELD_CLASS_NUM(NAME, MultipleStringValue, FIX::MULTIPLESTRINGVALUE, NUM)
563 #define USER_DEFINE_MULTIPLECHARVALUE( NAME, NUM ) \
564  DEFINE_FIELD_CLASS_NUM(NAME, MultipleCharValue, FIX::MULTIPLECHARVALUE, NUM)
565 #define USER_DEFINE_EXCHANGE( NAME, NUM ) \
566  DEFINE_FIELD_CLASS_NUM(NAME, Exchange, FIX::EXCHANGE, NUM)
567 #define USER_DEFINE_UTCTIMESTAMP( NAME, NUM ) \
568  DEFINE_FIELD_TIMECLASS_NUM(NAME, UtcTimeStamp, FIX::UTCTIMESTAMP, NUM)
569 #define USER_DEFINE_BOOLEAN( NAME, NUM ) \
570  DEFINE_FIELD_CLASS_NUM(NAME, Bool, FIX::BOOLEAN, NUM)
571 #define USER_DEFINE_LOCALMKTDATE( NAME, NUM ) \
572  DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::STRING, NUM)
573 #define USER_DEFINE_DATA( NAME, NUM ) \
574  DEFINE_FIELD_CLASS_NUM(NAME, Data, FIX::DATA, NUM)
575 #define USER_DEFINE_FLOAT( NAME, NUM ) \
576  DEFINE_FIELD_CLASS_NUM(NAME, Float, FIX::FLOAT, NUM)
577 #define USER_DEFINE_PRICEOFFSET( NAME, NUM ) \
578  DEFINE_FIELD_CLASS_NUM(NAME, PriceOffset, FIX::PRICEOFFSET, NUM)
579 #define USER_DEFINE_MONTHYEAR( NAME, NUM ) \
580  DEFINE_FIELD_CLASS_NUM(NAME, MonthYear, FIX::MONTHYEAR, NUM)
581 #define USER_DEFINE_DAYOFMONTH( NAME, NUM ) \
582  DEFINE_FIELD_CLASS_NUM(NAME, DayOfMonth, FIX::DAYOFMONTH, NUM)
583 #define USER_DEFINE_UTCDATE( NAME, NUM ) \
584  DEFINE_FIELD_CLASS_NUM(NAME, UtcDate, FIX::UTCDATE, NUM)
585 #define USER_DEFINE_UTCDATEONLY( NAME, NUM ) \
586  DEFINE_FIELD_CLASS_NUM(NAME, UtcDateOnly, FIX::UTCDATEONLY, NUM)
587 #define USER_DEFINE_UTCTIMEONLY( NAME, NUM ) \
588  DEFINE_FIELD_CLASS_NUM(NAME, UtcTimeOnly, FIX::UTCTIMEONLY, NUM)
589 #define USER_DEFINE_NUMINGROUP( NAME, NUM ) \
590  DEFINE_FIELD_CLASS_NUM(NAME, NumInGroup, FIX::NUMINGROUP, NUM)
591 #define USER_DEFINE_SEQNUM( NAME, NUM ) \
592  DEFINE_FIELD_CLASS_NUM(NAME, SeqNum, FIX::SEQNUM, NUM)
593 #define USER_DEFINE_LENGTH( NAME, NUM ) \
594  DEFINE_FIELD_CLASS_NUM(NAME, Length, FIX::LENGTH, NUM)
595 #define USER_DEFINE_PERCENTAGE( NAME, NUM ) \
596  DEFINE_FIELD_CLASS_NUM(NAME, Percentage, FIX::PERCENTAGE, NUM)
597 #define USER_DEFINE_COUNTRY( NAME, NUM ) \
598  DEFINE_FIELD_CLASS_NUM(NAME, Country, FIX::COUNTRY, NUM)
599 #define USER_DEFINE_TZTIMEONLY( NAME, NUM ) \
600  DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::TZTIMEONLY, NUM)
601 #define USER_DEFINE_TZTIMESTAMP( NAME, NUM ) \
602  DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::TZTIMESTAMP, NUM)
603 #define USER_DEFINE_XMLDATA( NAME, NUM ) \
604  DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::XMLDATA, NUM)
605 #define USER_DEFINE_LANGUAGE( NAME, NUM ) \
606  DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::LANGUAGE, NUM)
607 
608 #endif
609 
BoolField(int field)
Definition: Field.h:314
void setValue(const UtcTimeStamp &value)
Definition: Field.h:337
DoubleField PercentageField
Definition: Field.h:448
Unable to convert field into its native format.
Definition: Exceptions.h:66
static std::string convert(const UtcTimeOnly &value, bool showMilliseconds=false)
Field has a badly formatted value.
Definition: Exceptions.h:146
StringField MonthYearField
Definition: Field.h:442
bool operator<=(const StringField &rhs) const
Definition: Field.h:167
UtcDate getValue() const
Definition: Field.h:366
int getLength() const
Get the length of the fields string representation.
Definition: Field.h:84
static std::string convert(char value)
BoolField(int field, bool data)
Definition: Field.h:312
void setValue(int value)
Definition: Field.h:297
bool operator>(const StringField &rhs) const
Definition: Field.h:161
static std::string convert(const UtcTimeStamp &value, bool showMilliseconds=false)
Field that contains a double value.
Definition: Field.h:269
StringField ExchangeField
Definition: Field.h:436
MSC doesn&#39;t support partial template specialization so we have this.
Definition: Field.h:144
Time only represented in UTC.
Definition: FieldTypes.h:469
UtcTimeOnlyField(int field, bool showMilliseconds=false)
Definition: Field.h:388
int getTotal() const
Get the total value the fields characters added together.
Definition: Field.h:91
IntField NumInGroupField
Definition: Field.h:446
bool operator<(const UtcDateField &rhs) const
Definition: Field.h:374
Converts a UtcTimeStamp to/from a string.
int number_of_symbols_in(const signed_int value)
bool operator!=(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
DoubleField FloatField
Definition: Field.h:439
Field that contains a checksum value.
Definition: Field.h:410
bool operator>=(const StringField &lhs, const char *rhs)
Definition: Field.h:218
UtcTimeOnlyField(int field, const UtcTimeOnly &data, bool showMilliseconds=false)
Definition: Field.h:386
UtcDateField(int field, const UtcDate &data)
Definition: Field.h:359
bool getValue() const
Definition: Field.h:319
char * integer_to_string(char *buf, const size_t len, signed_int t)
void setValue(const std::string &value)
Definition: Field.h:152
IntField(int field, int data)
Definition: Field.h:292
Field that contains a UTC date value.
Definition: Field.h:356
StringField DataField
Definition: Field.h:438
bool operator==(const UtcDateField &rhs) const
Definition: Field.h:376
Converts checksum to/from a string.
FieldBase(int field, const std::string &string)
Definition: Field.h:49
std::string m_string
Definition: Field.h:125
int getValue() const
Definition: Field.h:299
DoubleField(int field)
Definition: Field.h:274
char getValue() const
Definition: Field.h:259
void setValue(bool value)
Definition: Field.h:317
Field that contains a character value.
Definition: Field.h:249
Converts a UtcTimeOnly to/from a string.
UtcTimeStamp getValue() const
Definition: Field.h:339
int m_field
Definition: Field.h:124
bool operator==(const StringField &rhs) const
Definition: Field.h:163
StringField TzTimeOnlyField
Definition: Field.h:450
bool operator==(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
IntField SeqNumField
Definition: Field.h:447
int getField() const
Get the fields integer tag.
Definition: Field.h:69
Field that contains a UTC time value.
Definition: Field.h:383
Field that contains a boolean value.
Definition: Field.h:309
bool operator!=(const UtcTimeStampField &rhs) const
Definition: Field.h:351
static std::string convert(signed_int value)
IntField LengthField
Definition: Field.h:445
DoubleField AmtField
Definition: Field.h:430
CharField(int field)
Definition: Field.h:254
UtcTimeStampField(int field, const UtcTimeStamp &data, bool showMilliseconds=false)
Definition: Field.h:332
UtcDateField(int field)
Definition: Field.h:361
StringField DayOfMonthField
Definition: Field.h:443
Date only represented in UTC.
Definition: FieldTypes.h:551
const std::string & getValue() const
Definition: Field.h:154
static std::string convert(double value, int padding=0)
bool operator<(const StringField &rhs) const
Definition: Field.h:159
int m_length
Definition: Field.h:127
UtcTimeOnly getValue() const
Definition: Field.h:393
bool m_calculated
Definition: Field.h:129
StringField MultipleValueStringField
Definition: Field.h:433
bool operator!=(const UtcTimeOnlyField &rhs) const
Definition: Field.h:405
std::string m_data
Definition: Field.h:126
DoubleField PriceField
Definition: Field.h:429
DoubleField(int field, double data, int padding=0)
Definition: Field.h:272
DoubleField PriceOffsetField
Definition: Field.h:440
StringField MultipleCharValueField
Definition: Field.h:435
bool operator==(const UtcTimeStampField &rhs) const
Definition: Field.h:349
bool operator==(const UtcTimeOnlyField &rhs) const
Definition: Field.h:403
bool operator!=(const StringField &rhs) const
Definition: Field.h:165
Base class for all FIX messages.
Definition: Message.h:67
bool operator>(const StringField &lhs, const char *rhs)
Definition: Field.h:202
StringField MultipleStringValueField
Definition: Field.h:434
bool operator>=(const StringField &rhs) const
Definition: Field.h:169
UtcTimeStampField(int field, bool showMilliseconds=false)
Definition: Field.h:334
static std::string convert(int value)
void setField(int field)
Definition: Field.h:56
StringField CurrencyField
Definition: Field.h:432
void setValue(char value)
Definition: Field.h:257
bool operator<(const UtcTimeOnlyField &rhs) const
Definition: Field.h:401
Field that contains an integer value.
Definition: Field.h:289
Converts character to/from a string.
int getValue() const
Definition: Field.h:420
const std::string & getFixString() const
Get the string representation of the Field (i.e.) 55=MSFT[SOH].
Definition: Field.h:77
const std::string & getString() const
Get the string representation of the fields value.
Definition: Field.h:73
double getValue() const
Definition: Field.h:279
bool operator<=(const StringField &lhs, const char *rhs)
Definition: Field.h:214
bool operator<(const FieldBase &field) const
Compares fields based on thier tag numbers.
Definition: Field.h:98
static std::string convert(const UtcDate &value)
static std::string convert(bool value)
Converts boolean to/from a string.
StringField MonthField
Definition: Field.h:441
Base representation of all Field classes.
Definition: Field.h:45
StringField CountryField
Definition: Field.h:449
bool operator<(const UtcTimeStampField &rhs) const
Definition: Field.h:347
void setValue(const UtcTimeOnly &value)
Definition: Field.h:391
Date and Time represented in UTC.
Definition: FieldTypes.h:399
StringField TzTimeStampField
Definition: Field.h:451
Converts integer to/from a string.
CharField(int field, char data)
Definition: Field.h:252
int m_total
Definition: Field.h:128
void setValue(double value, int padding=0)
Definition: Field.h:277
StringField LocalMktDateField
Definition: Field.h:437
bool operator!=(const UtcDateField &rhs) const
Definition: Field.h:378
virtual ~FieldBase()
Definition: Field.h:54
UtcDateField UtcDateOnlyField
Definition: Field.h:444
void setString(const std::string &string)
Definition: Field.h:62
StringField(int field, const std::string &data)
Definition: Field.h:147
Converts a UtcDate to/from a string.
Field that contains a UTC time stamp value.
Definition: Field.h:329
IntField(int field)
Definition: Field.h:294
void calculate() const
Definition: Field.h:102
CheckSumField(int field, int data)
Definition: Field.h:413
CheckSumField(int field)
Definition: Field.h:415
DoubleField QtyField
Definition: Field.h:431
Converts double to/from a string.
bool operator<(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
StringField(int field)
Definition: Field.h:149
void setValue(const UtcDate &value)
Definition: Field.h:364
void setValue(int value)
Definition: Field.h:418

Generated on Sat Mar 29 2014 15:13:32 for QuickFIX by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2001