forked from quickfixgo/quickfix
/
ApplicationMessageReport.go
64 lines (57 loc) · 2.68 KB
/
ApplicationMessageReport.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
//Package applicationmessagereport msg type = BY.
package applicationmessagereport
import (
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/enum"
"github.com/quickfixgo/quickfix/fix50sp2/applidreportgrp"
"github.com/quickfixgo/quickfix/fixt11"
)
//Message is a ApplicationMessageReport FIX Message
type Message struct {
FIXMsgType string `fix:"BY"`
fixt11.Header
//ApplReportID is a required field for ApplicationMessageReport.
ApplReportID string `fix:"1356"`
//ApplReportType is a required field for ApplicationMessageReport.
ApplReportType int `fix:"1426"`
//ApplIDReportGrp is a non-required component for ApplicationMessageReport.
ApplIDReportGrp *applidreportgrp.ApplIDReportGrp
//Text is a non-required field for ApplicationMessageReport.
Text *string `fix:"58"`
//EncodedTextLen is a non-required field for ApplicationMessageReport.
EncodedTextLen *int `fix:"354"`
//EncodedText is a non-required field for ApplicationMessageReport.
EncodedText *string `fix:"355"`
//ApplReqID is a non-required field for ApplicationMessageReport.
ApplReqID *string `fix:"1346"`
fixt11.Trailer
}
//Marshal converts Message to a quickfix.Message instance
func (m Message) Marshal() quickfix.Message { return quickfix.Marshal(m) }
//New returns an initialized ApplicationMessageReport instance
func New(applreportid string, applreporttype int) *Message {
var m Message
m.SetApplReportID(applreportid)
m.SetApplReportType(applreporttype)
return &m
}
func (m *Message) SetApplReportID(v string) { m.ApplReportID = v }
func (m *Message) SetApplReportType(v int) { m.ApplReportType = v }
func (m *Message) SetApplIDReportGrp(v applidreportgrp.ApplIDReportGrp) { m.ApplIDReportGrp = &v }
func (m *Message) SetText(v string) { m.Text = &v }
func (m *Message) SetEncodedTextLen(v int) { m.EncodedTextLen = &v }
func (m *Message) SetEncodedText(v string) { m.EncodedText = &v }
func (m *Message) SetApplReqID(v string) { m.ApplReqID = &v }
//A RouteOut is the callback type that should be implemented for routing Message
type RouteOut func(msg Message, 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 {
m := new(Message)
if err := quickfix.Unmarshal(msg, m); err != nil {
return err
}
return router(*m, sessionID)
}
return enum.ApplVerID_FIX50SP2, "BY", r
}