Re: [Quickfix-developers] Field name to number conversion - more info
Brought to you by:
orenmnero
From: Alexis M. <ale...@ya...> - 2008-08-15 17:13:54
|
George, I'm doing something similar in C# - not sure if it applies to what you're trying to do, but I read in field names from my config and create a Dictionary<string, int> object from that which I can use to map to a field ID. I use Reflection to achieve this. My C# code looks like: intnameID = (int)(System.Reflection.Assembly.LoadFrom("quickfix_net.dll").GetType("QuickFix." + fieldName).GetField("FIELD").GetValue(0)); (where "fieldName" contains the field, e.g. "OrderQty" I'm looking up at the time. Not sure if this helps, but hopefully it will point you in the right direction! Alexis ----- Original Message ---- From: George Hrysanthopoulos <ge...@so...> To: qui...@li... Sent: Friday, August 15, 2008 5:28:20 PM Subject: Re: [Quickfix-developers] Field name to number conversion - more info QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hello again everyone, Here is some more info on what I am trying to do: Let's say I have a file called: fixfields.cfg In the file I have: OrderQty Symbol Price ClOrdID Side Currently, from: "Application::onMessage" function, I do: FIX::Symbol symbol; FIX::Side side; FIX::OrderQty orderQty; FIX::Price price; FIX::ClOrdID clOrdID; ... ... message.get( symbol ); message.get( side ); message.get( orderQty ); message.get( price ); message.get( clOrdID ); I am sure you recognize this as the sample executor application. What I want to do is: message.get( "symbol_1_from_file" ); message.get( "symbol_2_from_file" ); message.get( "symbol_3_from_file" ); ... ... You see, what I want to do is "message.get" for the fields I read in from the config file. This way the fields are not hard coded in the app. The question is, is there a way to get the field, as a string, and then find the appropriate enum? I hope this makes more sense. Also, and this is a big one, I am a "C" programmer. I am relatively new to "C++". So, please bear with me. -George On Aug 14, 2008, at 5:34 PM, George Hrysanthopoulos wrote: QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hello everyone, During runtime I want to read a file, with field names, and when a deal comes in, just print to screen the fields I am interested in (for starters). However, I see that the field names are enum'ed from file: FieldNumbers.h How do I generate a field number from a string? Is there a built-in way of doing this or do I have to (somehow) keep a copy of "FieldNumbers.h" in my executable? Or, worst case, keep the fields I am interested in as numbers in the setup file? This is not at all user friendly and I would like to avoid that. -G ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Quickfix-developers mailing list Qui...@li...urceforge..net https://lists.sourceforge.net/lists/listinfo/quickfix-developers |