[Quickfix-developers] Copying QuickFix messages
Brought to you by:
orenmnero
|
From: Sam S. <sa...@if...> - 2007-10-18 16:13:01
|
Hi,
=20
I need to a deep clone of a QuickFix message, retaining its type. I have
written the following method in C#.
=20
It seems to work.
=20
Having examine the C++ code of the fix library and the underlying types
I believe that this should do a by-value copy.
=20
Please can anyone let me know if there are any problems with this, or
there is a better way to do it?
=20
public static QuickFix.Message DeepCopyFixMessage
(QuickFix.Message inputMessage)
{
QuickFix.Message outputMessage;
=20
outputMessage =3D (QuickFix.Message)
System.Activator.CreateInstance (inputMessage.GetType ());
unsafe
{
outputMessage.setUnmanaged
(inputMessage.unmanaged ());
}
=20
return outputMessage;
}
Sam Smith
Intelligent Financial Systems Ltd
=20
|