c++ - 获取 QuickFix::Field::OrdType 的值?

标签 c++ quickfix

我下载了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/

相关文章:

c++ - 图片显示错误

c++ - 如何硬编码设置

python-3.x - 在 Windows\Linux CentOS for Python3 上安装 quickfix 模块

c++ - quickfix/c++ 中的重复组

c++ - UuidCreateSequential 的奇怪行为

c++ - 创建简单链表时无法访问内存

quickfix - 修复重复组以重用相同标签

java - QuickFix/j 连接状态机

c++ - 为什么这个顶点缓冲对象更新失败?

C++:&(std::cout) 作为模板参数