/// <summary> /// The GetUniqueFields method retrieves a collection which /// represents the set of all FIX field definitions found in /// the dictionaries associated with a specific version. /// </summary> /// <param name="version"> /// The name of the version definition that is to be used /// for looking up the FIX field definitions. /// </param> /// <returns> /// The collection of FIX field definitions that represents /// the complete set of all of the field definitions in the /// dictionaries associated with the specified version. /// </returns> public FixDxCollection GetUniqueFields(string version) { FixDxCollection result = new FixDxCollection(); if (_vxRegistry != null) { VfxFixVxRecord vxDetails = _vxRegistry.Get(version); if (vxDetails != null) { if (_dxRegistry != null) { // REC: Temporary map that is used to ensure there // is only one instance of a field for each tag. Dictionary <int, FixDxField> mapFields = new Dictionary <int, FixDxField>(); // REC: Iterate over all of the FIX dictionaries that // are associated with the version and build the list // of FIX field definitions from them: foreach (VfxFixVersion_Dictionary_Reference dxEntry in vxDetails.Dictionaries) { FixDictionary dxInstance = _dxRegistry.GetEntry(dxEntry.Name); if (dxInstance != null) { foreach (IFixDxElement dxElement in dxInstance.Fields) { FixDxField dxField = dxElement as FixDxField; if (dxField != null) { if (mapFields.ContainsKey(dxField.Tag) == false) { mapFields.Add(dxField.Tag, dxField); } else { mapFields[dxField.Tag] = dxField; } } } } } foreach (int key in mapFields.Keys) { result.Add(mapFields[key]); } } } } return(result); }
// REC: The ResolveFieldName method attempts to // resolve a FIX tag to it's corresponding name: private string ResolveFieldName(string tag) { string result = null; // REC: Although a tag may be improperly presented // as a string, it needs to be converted into an // integer in order to resolve against a dictionary: int nTag = -1; if (int.TryParse(tag, out nTag) == true) { foreach (FixDictionary dx in _settings.Dictionaries) { FixDxField dxField = dx.Fields.GetElement(nTag) as FixDxField; if (dxField != null) { result = dxField.Name; break; } } } return(result); }