Search code examples
c++quickfix

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


I downloaded QuickFix.dll from quickfixengine.org

When I declare an object which belongs to namespace QuickFix::Fields, I cannot get its corresponding base value (I mean char value for OrdType, string value for OrderID etc). As there are no properties associated with them.

Is there any other way to achieve the same?

The code is:

......
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)

Solution

  • This is what you want to see:

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

    Advice: check out the class documentation. The field base class is FIX::FieldBase, which derives into FIX::StringField, FIX::BoolField, FIX::IntField, etc. All of these have a getValue() function which returns the raw field value converted into the proper data type.

    Another way to do this (much less legitimate) is to use Message::getField(int) which returns the value of a field as a string. So you could use std::string str_value = message.get(40);, but you'd have a string instead of a char (or int or bool or whatever).