File: user_defined.html

package info (click to toggle)
quickfix 1.15.1%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 42,080 kB
  • sloc: cpp: 631,686; python: 129,549; ruby: 106,716; xml: 43,737; ansic: 7,668; java: 1,826; cs: 816; makefile: 544; sh: 462; sql: 313
file content (91 lines) | stat: -rw-r--r-- 2,735 bytes parent folder | download | duplicates (2)
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
85
86
87
88
89
90
91
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>
<head>
  <link href="doxygen.css" rel="stylesheet" type="text/css">

  <title>User Defined Fields</title>
</head>

<body>
  <div class='header'>
    <div class='headertitle'>
      User Defined Fields
    </div>
  </div>

  <div class='contents'>
    <p>FIX allows users to define fields not defined in the
    specifications. 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=
    "python/user_defined_1.html">PYTHON</a>, <a href=
    "ruby/user_defined_1.html">RUBY</a>
    <pre class='fragment'>
message.setField(6123, "value");
message.getField(6123);
</pre>

    <p>QuickFIX also provides supplies macros for creating typesafe
    field objects.</p>See this code in <a href=
    "python/user_defined_2.html">PYTHON</a>, <a href=
    "ruby/user_defined_2.html">RUBY</a>
    <pre class='fragment'>
#include "quickfix/Field.h"

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

    <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=
    "python/user_defined_3.html">PYTHON</a>, <a href=
    "ruby/user_defined_3.html">RUBY</a>
    <pre class='fragment'>
MyStringField stringField("string");
MyPriceField priceField(14.54);

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

message.getField(stringField);
message.getField(priceField);
</pre>

    <p>These macros allow you to define fields of all supported FIX
    types. Keep in mind you can write fields of any type types as
    long as you supply a new macro and convertor that can convert
    your type to and from a string.</p>
    <pre class='fragment'>
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>
  </div>
</body>
</html>