File: user_defined.html

package info (click to toggle)
quickfix 1.13.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 152,548 kB
  • ctags: 679,426
  • sloc: cpp: 639,331; xml: 129,200; python: 108,722; ruby: 85,152; sh: 10,492; ansic: 9,025; java: 1,827; cs: 1,145; makefile: 523; sql: 313; perl: 108
file content (84 lines) | stat: -rw-r--r-- 3,140 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>
  <head>
    <title>User Defined Fields</title>
    <H1>User Defined Fields</H1>
  </head>
  <body>
  <p>
    FIX allows for users to define their own fields that do not belong to the spec. How can QuickFIX
    be used to set and get user defined fields? Well one answer would be to use the non-type safe
    set and get fields like so:
  </p>
  See this code in <a href="csharp/user_defined_1.html">C#</a>, <a href="vbnet/user_defined_1.html">VB.NET</a>, <a href="python/user_defined_1.html">PYTHON</a>, <a href="ruby/user_defined_1.html">RUBY</a>
  <PRE><B>
  message.setField(6123, "value");
  message.getField(6123);
  </PRE></B>

  <p>
    But there is a better way. Instead of using this non type safe method, why not bring your own
    user defined fields into the type system? QuickFIX provides you with a set of macros to do just
    that. Now you can define your user defined fields in a separate file like this.
  </p>
  See this code in <a href="csharp/user_defined_2.html">C#</a>, <a href="vbnet/user_defined_2.html">VB.NET</a>, <a href="python/user_defined_2.html">PYTHON</a>, <a href="ruby/user_defined_2.html">RUBY</a>
  <PRE><B>
  #include "quickfix/Field.h"

  namespace FIX
  {
    USER_DEFINE_STRING(MyStringField, 6123);
    USER_DEFINE_PRICE(MyPriceField, 8756);
  }
  </PRE></B>

  <p>
  User defined fields must be declared within the <B>FIX</B> namespace.
  Now, elsewhere in your application, you can write code like this:
  </p>
  See this code in <a href="csharp/user_defined_3.html">C#</a>, <a href="vbnet/user_defined_3.html">VB.NET</a>, <a href="python/user_defined_3.html">PYTHON</a>, <a href="ruby/user_defined_3.html">RUBY</a>
  <PRE><B>
  MyStringField stringField("string");
  MyPriceField priceField(14.54);

  message.setField(stringField);
  message.setField(priceField);

  message.getField(stringField);
  message.getField(priceField);
  </PRE></B>

  <p>
  Here is a list of macros that allow you to define fields of all supported FIX types, but keep
  in mind you can write fields of wildly different types if you supply a new macro and convertor
  that can convert your type to and from a string. Here is the list of macros:
  </p>
  <PRE><B>
  USER_DEFINE_STRING( NAME, NUM )
  USER_DEFINE_CHAR( NAME, NUM )
  USER_DEFINE_PRICE( NAME, NUM )
  USER_DEFINE_INT( NAME, NUM )
  USER_DEFINE_AMT( NAME, NUM )
  USER_DEFINE_QTY( NAME, NUM )
  USER_DEFINE_CURRENCY( NAME, NUM )
  USER_DEFINE_MULTIPLEVALUESTRING( NAME, NUM )
  USER_DEFINE_EXCHANGE( NAME, NUM )
  USER_DEFINE_UTCTIMESTAMP( NAME, NUM )
  USER_DEFINE_BOOLEAN( NAME, NUM )
  USER_DEFINE_LOCALMKTDATE( NAME, NUM )
  USER_DEFINE_DATA( NAME, NUM )
  USER_DEFINE_FLOAT( NAME, NUM )
  USER_DEFINE_PRICEOFFSET( NAME, NUM )
  USER_DEFINE_MONTHYEAR( NAME, NUM )
  USER_DEFINE_DAYOFMONTH( NAME, NUM )
  USER_DEFINE_UTCDATE( NAME, NUM )
  USER_DEFINE_UTCTIMEONLY( NAME, NUM )
  USER_DEFINE_NUMINGROUP( NAME, NUM )
  USER_DEFINE_SEQNUM( NAME, NUM )
  USER_DEFINE_LENGTH( NAME, NUM )
  USER_DEFINE_PERCENTAGE( NAME, NUM )
  USER_DEFINE_COUNTRY( NAME, NUM )
  </PRE></B>
  </body>
</html>