Re: [Quickfix-developers] Re: IsSetField is not available in the C# assemblies
Brought to you by:
orenmnero
|
From: <sil...@tu...> - 2003-06-24 14:59:00
|
I already found the solution. I thing that my solution is more simply.
1. Just add next methods to Quickfix::Message class
bool Message::IsSetField(QuickFix::Field& field)
{ =20
QF_STACK_TRY
int fieldNumber =3D field.getField();
return m_pUnmanaged->isSetField(fieldNumber);
QF_STACK_CATCH
}
bool Message::IsSetField(int fieldNumber)
{
QF_STACK_TRY
return m_pUnmanaged->isSetField(fieldNumber);
QF_STACK_CATCH
}
2. Add next method to Quickfix::Message::Header class
bool Message::Header::IsSetField(int fieldNumber)
{
QF_STACK_TRY
return m_message->IsSetField(fieldNumber);
QF_STACK_CATCH
}
3. And add next methods to Quickfix::Message::Trailer class
bool Message::Trailer::IsSetField(int fieldNumber)
{
QF_STACK_TRY
return m_message->IsSetField(fieldNumber);
QF_STACK_CATCH
}
4. Add to NET_FIELD_SET define which is defined in Message.h next lines:
bool IsSet##FIELD() \
{ QuickFix::FIELD* value =3D new QuickFix::FIELD(); \
int fieldnumber =3D value->getField(); \
return IsSetField(fieldnumber);}
Best regards,=20
Slava Tretyak.
----- Original Message -----=20
From: "Rob Kulseth" <ro...@ri...>
To: "???????? ???????" <sil...@tu...>; =
<qui...@li...>
Sent: Tuesday, June 24, 2003 5:31 PM
Subject: RE: [Quickfix-developers] Re: IsSetField is not available in =
the C# assemblies
I assume you would like to be able to do the following
//Example 1**********************************************************
MsgType mt =3D new MsgType();
if(message.getHeader().isSet(mt))
//a MsgType field exists and it's value is already in the mt variable
else
//the message does not contain a MsgType Field. just an example
//Example =
2**************************************************************
XmlData xd =3D new XmlData()
if(message.isSet(xd))
//an XmlData field exists and it's value is already in the mt variable
else
//the message does not contain a MsgType Field.
//***********************************************************************=
*
To get the above capability, paste the following code into the public =
sections of both the Message class and the Header class in the =
src/Net/message.h file. There is probably a better way to do this, =
which is why I never submitted it before, but it works well. it was =
Oren's suggestion for a quick Fix (no pun intended) that he gave me =
through this message board. Maybe he could add it to the release.
//begin copy
bool Message::isSet( StringField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( BooleanField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( CharField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( IntField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( DoubleField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( UtcTimeStampField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( UtcDateField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
bool Message::isSet( UtcTimeOnlyField* f){
try{getField(f);return true;}
catch(Exception & e){}
return false;
}
//end Copy
-----Original Message-----
From: sil...@tu... [mailto:sil...@tu...]
Sent: Tuesday, June 24, 2003 1:39 AM
To: mur...@pe...
Cc: qui...@li...
Subject: [Quickfix-developers] Re: IsSetField is not available in the C# =
assemblies
What do you mean?
How can I resolve this problem?
--- murphypa <murphypa@pe...> wrote:
> Re this topic:
>=20
> IsSetField is not available in the C# assemblies
> (neither on the Message=20
> nor on the Group classes).
> As I do not want to trap exceptions when I do not
> need to - I added the=20
> call to the Message
> and Group class headers.
>=20
> What is the recommended way of doing these
> additions?
>=20
> sincerely,
> mpa |