Example #1
0
        /// <summary>
        /// The Clone method is invoked to construct a completely
        /// new instance/copy of an instance of a dictionary.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FixDictionary result = new FixDictionary();

            // REC: Copy all of the metadata properties into the
            // new instance of the dictionary:
            foreach (string key in _mapProperties.Keys)
            {
                result.Properties.Add(key, _mapProperties[key]);
            }

            // REC: Clone all of the header elements in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement hdrElement in _hdrCollection)
            {
                result.Header.Add(CloneElement(hdrElement));
            }

            // REC: Clone all of the field entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxField dxField in _fldElements)
            {
                result.AddField(CloneField(dxField));
            }

            // REC: Clone all of the block entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxBlock dxBlock in _blkElements)
            {
                result.AddBlock(CloneBlock(dxBlock));
            }

            // REC: Clone all of the message entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxMessage dxMessage in _messages)
            {
                result.AddMessage(CloneMessage(dxMessage));
            }

            // REC: Clone all of the enum entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxEnumeration dxEnumeration in _enmElements)
            {
                result.AddEnumeration(CloneEnumeration(dxEnumeration));
            }

            // REC: Clone all of the trailer entries in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement trlElement in _trlCollection)
            {
                result.Trailer.Add(CloneElement(trlElement));
            }

            return(result);
        }
Example #2
0
 /// <summary>
 /// The PopulateEnums method populates the enumerations section
 /// of the supplied VFX dictionary with all of the enumerations
 /// that are defined in the supplied XML dictionary.
 /// </summary>
 /// <param name="source">
 /// The source dictionary for the enumeration elements.
 /// </param>
 /// <param name="target">
 /// The target dictionary for the converted elements.
 /// </param>
 private static void PopulateEnums(XmlDictionary source, FixDictionary target)
 {
     foreach (XmlFixDxEnumeration src in source.Enums.Entries)
     {
         FixDxEnumeration dst = new FixDxEnumeration(src.Name);
         foreach (object element in src.Enumerators)
         {
             if (element is XmlFixDxEnumerator)
             {
                 XmlFixDxEnumerator srcEnum = element as XmlFixDxEnumerator;
                 FixDxEnumerator    dstEnum = new FixDxEnumerator(srcEnum.value, srcEnum.Description);
                 dst.Enumerators.Add(dstEnum);
             }
         }
         target.AddEnumeration(dst);
     }
 }
Example #3
0
        /// <summary>
        /// The Clone method is invoked to construct a completely
        /// new instance/copy of an instance of a dictionary.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FixDictionary result = new FixDictionary();

            // REC: Copy all of the metadata properties into the
            // new instance of the dictionary:
            foreach (string key in _mapProperties.Keys)
            {
                result.Properties.Add(key, _mapProperties[key]);
            }

            // REC: Clone all of the header elements in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement hdrElement in _hdrCollection)
            {
                result.Header.Add(CloneElement(hdrElement));
            }

            // REC: Clone all of the field entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxField dxField in _fldElements)
            {
                result.AddField(CloneField(dxField));
            }

            // REC: Clone all of the block entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxBlock dxBlock in _blkElements)
            {
                result.AddBlock(CloneBlock(dxBlock));
            }

            // REC: Clone all of the message entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxMessage dxMessage in _messages)
            {
                result.AddMessage(CloneMessage(dxMessage));
            }

            // REC: Clone all of the enum entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxEnumeration dxEnumeration in _enmElements)
            {
                result.AddEnumeration(CloneEnumeration(dxEnumeration));
            }

            // REC: Clone all of the trailer entries in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement trlElement in _trlCollection)
            {
                result.Trailer.Add(CloneElement(trlElement));
            }

            return result;
        }
Example #4
0
 /// <summary>
 /// The PopulateEnums method populates the enumerations section
 /// of the supplied VFX dictionary with all of the enumerations
 /// that are defined in the supplied XML dictionary.
 /// </summary>
 /// <param name="source">
 /// The source dictionary for the enumeration elements.
 /// </param>
 /// <param name="target">
 /// The target dictionary for the converted elements.
 /// </param>
 private static void PopulateEnums(XmlDictionary source, FixDictionary target)
 {
     foreach (XmlFixDxEnumeration src in source.Enums.Entries)
     {
         FixDxEnumeration dst = new FixDxEnumeration(src.Name);
         foreach (object element in src.Enumerators)
         {
             if (element is XmlFixDxEnumerator)
             {
                 XmlFixDxEnumerator srcEnum = element as XmlFixDxEnumerator;
                 FixDxEnumerator dstEnum = new FixDxEnumerator(srcEnum.value, srcEnum.Description);
                 dst.Enumerators.Add(dstEnum);
             }
         }
         target.AddEnumeration(dst);
     }
 }