获取 QuickFix::Field::OrdType 的值

get the value of QuickFix::Field::OrdType?

本文关键字:的值 OrdType Field 获取 QuickFix      更新时间:2023-10-16

我从quickfixengine.org下载了QuickFix.dll

当我声明一个属于命名空间QuickFix::Fields的对象时,我无法获取其相应的基值(我的意思是 OrdType 的 char 值,OrderID的字符串值等)。因为没有与之关联的属性。

有没有其他方法可以实现相同的目标?

代码为:

......
QuickField::Fields::OrdType ordType;
message.Get(OrdType);//message is a NewOrderSingle 
                     //type object defined prevviously in the code
                     //Now i wish to get the value contained in "ordType" but it has no
                     //properties to access its data member(s)

这是您想要看到的:

QuickField::Fields::OrdType ordType;
message.get(ordType);
char char_value = ordType.getValue();

建议:查看类文档。 场基类是FIX::FieldBase,它导出为FIX::StringFieldFIX::BoolFieldFIX::IntField等。 所有这些都有一个getValue()函数,该函数返回转换为正确数据类型的原始字段值。

执行此操作的另一种方法(不太合法)是使用 Message::getField(int) 将字段的值作为字符串返回。 所以你可以使用 std::string str_value = message.get(40); ,但你会有一个字符串而不是一个字符(或 int 或 bool 或其他什么)。