Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// The PopulateMessages method populates the message section
        /// of the supplied VFX dictionary with all message definitions
        /// that are found in the supplied XML dictionary.
        /// </summary>
        /// <param name="source">
        /// The source dictionary for the message elements.
        /// </param>
        /// <param name="target">
        /// The target dictionary for the converted elements.
        /// </param>
        private static void PopulateMessages(XmlDictionary source, FixDictionary target)
        {
            foreach (XmlFixDxMessage src in source.Messages.Entries)
            {
                FixDxMessage dst = new FixDxMessage(src.MsgType, src.Name, src.MsgCategory);
                foreach (IFixDxElement dxElement in TranslateElements(src.Elements))
                {
                    dst.Elements.Add(dxElement);
                }

                target.AddMessage(dst);
            }
        }
Beispiel #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;
        }
Beispiel #4
0
        /// <summary>
        /// The PopulateMessages method populates the message section
        /// of the supplied VFX dictionary with all message definitions
        /// that are found in the supplied XML dictionary.
        /// </summary>
        /// <param name="source">
        /// The source dictionary for the message elements.
        /// </param>
        /// <param name="target">
        /// The target dictionary for the converted elements.
        /// </param>
        private static void PopulateMessages(XmlDictionary source, FixDictionary target)
        {
            foreach (XmlFixDxMessage src in source.Messages.Entries)
            {
                FixDxMessage dst = new FixDxMessage(src.MsgType, src.Name, src.MsgCategory);
                foreach (IFixDxElement dxElement in TranslateElements(src.Elements))
                {
                    dst.Elements.Add(dxElement);
                }

                target.AddMessage(dst);
            }
        }