我下载了QuickFix.dll
来自quickfixengine.org
当我声明一个属于命名空间 QuickFix::Fields
的对象时,我无法获取其相应的基值(我的意思是 OrdType
的字符值, 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();
建议:查看the class documentation 。字段基类是 FIX::FieldBase
,派生为FIX::StringField
, FIX::BoolField
, FIX::IntField
等等。所有这些都有 getValue()
函数返回转换为正确数据类型的原始字段值。
另一种方法(不太合法)是使用 Message::getField(int)
它以字符串形式返回字段的值。所以你可以使用std::string str_value = message.get(40);
,但你会得到一个字符串而不是字符(或 int 或 bool 或其他)。
关于c++ - 获取 QuickFix::Field::OrdType 的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14459706/