[Quickfix-users] Quickfix42 getHeader() problem for .NET
Brought to you by:
orenmnero
|
From: Christodoulou, C. D (london) <chr...@ml...> - 2003-09-26 10:52:02
|
Hi
Has anybody been able to use getHeader() from the .NET version of quickfix42
(version 1.5.0)?
Just to give you a bit of background:
1. I downloaded the windows NT version of quickfix for .NET.
2. I created a new solution called testcase.
3. I created a project called test1 - this is a simple form which has a
button on it. In the button event I include the testcode, a reference to
quickfix_net_debug, the using QuickFix42 statement and changed
Application.Run(new Form1() to System.Windows.Forms.Application.Run(new
Form1().
4. All I do is create an instance of a NewOrderSingle and try and get back
the reference to the Header (or trailer). See below. It is at this point it
fails with:-
-- Cannot implicitly convert type 'QuickFix.Message.Header' to
'QuickFix42.Header'
Here is the testcode I am using to find out why it's not working (it's just
a subset of the actual code I use):-
private void button1_Click(object sender, System.EventArgs
e)
{
try
{
// Create a FIX NewOrderSingle request.
NewOrderSingle newOrder = new
NewOrderSingle();
Header header = newOrder.getHeader(); <=
Error
header.setField(new
QuickFix.SenderCompID("sender123"));
QuickFix.MsgType msgType = new
QuickFix.MsgType();
QuickFix.StringField strType =
header.getField(msgType);
System.Diagnostics.Trace.WriteLine(msg.getValue());
}
catch ( Exception exc )
{
System.Diagnostics.Trace.Write(exc.ToString());
}
}
}
The getHeader() is declared as follows:
namespace QuickFix42
{
public __gc class Header : public QuickFix::Message::Header
{
Header(QuickFix::Message* message) :
QuickFix::Message::Header(message)
{}
NET_FIELD_SET(BeginString);
NET_FIELD_SET(BodyLength);
NET_FIELD_SET(MsgType);
...
}
...
Header* getHeader() { return
dynamic_cast<Header*>(QuickFix::Message::getHeader()); }
}
Therefore I am expecting it to return a QuickFix42 header, however it
actually thinks it's returning a QuickFix header which results in the
Above compilation error. Looking at the object browser it too thinks it's a
quickfix header event though the source code returns a quickfix42.
Thanks
Chris
|