forked from quickfixgo/quickfix
/
Logon.generated.go
133 lines (112 loc) · 3.41 KB
/
Logon.generated.go
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package logon
import (
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/enum"
"github.com/quickfixgo/quickfix/field"
"github.com/quickfixgo/quickfix/fix40"
"github.com/quickfixgo/quickfix/tag"
)
//Logon is the fix40 Logon type, MsgType = A
type Logon struct {
fix40.Header
*quickfix.Body
fix40.Trailer
Message *quickfix.Message
}
//FromMessage creates a Logon from a quickfix.Message instance
func FromMessage(m *quickfix.Message) Logon {
return Logon{
Header: fix40.Header{&m.Header},
Body: &m.Body,
Trailer: fix40.Trailer{&m.Trailer},
Message: m,
}
}
//ToMessage returns a quickfix.Message instance
func (m Logon) ToMessage() *quickfix.Message {
return m.Message
}
//New returns a Logon initialized with the required fields for Logon
func New(encryptmethod field.EncryptMethodField, heartbtint field.HeartBtIntField) (m Logon) {
m.Message = quickfix.NewMessage()
m.Header = fix40.NewHeader(&m.Message.Header)
m.Body = &m.Message.Body
m.Trailer.Trailer = &m.Message.Trailer
m.Header.Set(field.NewMsgType("A"))
m.Set(encryptmethod)
m.Set(heartbtint)
return
}
//A RouteOut is the callback type that should be implemented for routing Message
type RouteOut func(msg Logon, sessionID quickfix.SessionID) quickfix.MessageRejectError
//Route returns the beginstring, message type, and MessageRoute for this Message type
func Route(router RouteOut) (string, string, quickfix.MessageRoute) {
r := func(msg *quickfix.Message, sessionID quickfix.SessionID) quickfix.MessageRejectError {
return router(FromMessage(msg), sessionID)
}
return "FIX.4.0", "A", r
}
//SetRawDataLength sets RawDataLength, Tag 95
func (m Logon) SetRawDataLength(v int) {
m.Set(field.NewRawDataLength(v))
}
//SetRawData sets RawData, Tag 96
func (m Logon) SetRawData(v string) {
m.Set(field.NewRawData(v))
}
//SetEncryptMethod sets EncryptMethod, Tag 98
func (m Logon) SetEncryptMethod(v enum.EncryptMethod) {
m.Set(field.NewEncryptMethod(v))
}
//SetHeartBtInt sets HeartBtInt, Tag 108
func (m Logon) SetHeartBtInt(v int) {
m.Set(field.NewHeartBtInt(v))
}
//GetRawDataLength gets RawDataLength, Tag 95
func (m Logon) GetRawDataLength() (v int, err quickfix.MessageRejectError) {
var f field.RawDataLengthField
if err = m.Get(&f); err == nil {
v = f.Value()
}
return
}
//GetRawData gets RawData, Tag 96
func (m Logon) GetRawData() (v string, err quickfix.MessageRejectError) {
var f field.RawDataField
if err = m.Get(&f); err == nil {
v = f.Value()
}
return
}
//GetEncryptMethod gets EncryptMethod, Tag 98
func (m Logon) GetEncryptMethod() (v enum.EncryptMethod, err quickfix.MessageRejectError) {
var f field.EncryptMethodField
if err = m.Get(&f); err == nil {
v = f.Value()
}
return
}
//GetHeartBtInt gets HeartBtInt, Tag 108
func (m Logon) GetHeartBtInt() (v int, err quickfix.MessageRejectError) {
var f field.HeartBtIntField
if err = m.Get(&f); err == nil {
v = f.Value()
}
return
}
//HasRawDataLength returns true if RawDataLength is present, Tag 95
func (m Logon) HasRawDataLength() bool {
return m.Has(tag.RawDataLength)
}
//HasRawData returns true if RawData is present, Tag 96
func (m Logon) HasRawData() bool {
return m.Has(tag.RawData)
}
//HasEncryptMethod returns true if EncryptMethod is present, Tag 98
func (m Logon) HasEncryptMethod() bool {
return m.Has(tag.EncryptMethod)
}
//HasHeartBtInt returns true if HeartBtInt is present, Tag 108
func (m Logon) HasHeartBtInt() bool {
return m.Has(tag.HeartBtInt)
}