2013-01-22 18 views
0

我下載QuickFix.dll從quickfixengine.org獲取QuickFix :: Field :: OrdType的值?

當我聲明屬於命名空間的QuickFix ::字段的對象,我不能得到其相應的鹼值(i意味着OrdType char值,對於訂單ID等字符串值) 。因爲沒有與它們相關的屬性。

有沒有其他辦法可以達到同樣的效果?

的代碼是:

......

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) 
+0

你能給出你想要做什麼更明確的解釋嗎?也許你可以提供你正在嘗試的代碼片段。 –

+0

請停止標記此「tcp」。這不是一個TCP問題。真的,唯一適合的標籤是「quickfix」。 –

回答

1

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,其導出到FIX::StringFieldFIX::BoolFieldFIX::IntField等所有這些具有getValue()函數返回轉換成適當的數據類型的原始字段值。

這樣做的另一種方法(更不合理)是使用Message::getField(int),它將字段的值作爲字符串返回。所以你可以使用std::string str_value = message.get(40);,但是你需要一個字符串來代替char(或者int或者bool或者其他)。

+0

通過C#visual studio的對象瀏覽器檢查,沒有顯示任何屬性或功能,檢查過VC++ visual studio的對象瀏覽器,沒有顯示任何屬性或功能,VC++沒有智能,所以我在C#中聲明瞭一個對象,通過intelliscence檢查功能它顯示getValue()和其他功能 –

+0

所以我的回答有幫助嗎? (如果是的話,請將其標記爲答案,謝謝。) –

+0

不是,因爲我在看到你的答案(沒有冒犯意味)之前就想出了它,但它絕對值得讚賞並且打勾,因爲它是正確的答案。 –