private void  createDeltaFromMamaMsgWithoutVectorFields(
            MamdaSubscription subscription,
            MamaMsg msg,
            bool isRecap)
        {
            NullableInt numLevelFields_ = new NullableInt();

            int numLevelFieldInMsg = 1;

            if (msg.tryI32(MamdaOrderBookFields.NUM_LEVELS, ref numLevelFields_))
            {
                numLevelFieldInMsg = numLevelFields_.Value;
            }

            int maxLevelFields = MamdaOrderBookFields.getNumLevelFields();

            // getNumLevelFields() defaults to 0 but we want to go into the
            // below loop at least once for flattened messages scenario
            if (maxLevelFields == 0)
            {
                maxLevelFields = 1;
            }

            if (numLevelFieldInMsg < maxLevelFields)
            {
                maxLevelFields = numLevelFieldInMsg;
            }
            mPriceLevels = maxLevelFields;

            for (int i = 1; i <= maxLevelFields; i++)
            {
                clearLevelFields();
                mPriceLevel = i;
                MamaMsg plMsg = null;

                if (MamdaOrderBookFields.PRICE_LEVEL.Length > 1)
                {
                    plMsg = msg.getMsg(MamdaOrderBookFields.PRICE_LEVEL[i], null);
                }

                if (plMsg == null)
                {
                    if (numLevelFieldInMsg == 1)
                    {
                        // Price level fields are probably be in the main message.
                        plMsg = msg;
                    }
                    else
                    {
                        throw new MamdaDataException(
                                  "cannot find price level fields in MamaMsg");
                    }
                }
                getLevelInfoAndEntries(subscription, msg, plMsg, isRecap);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Compare another object
        /// </summary>
        /// <param name="obj">Object to compare with</param>
        /// <returns>
        /// If both objects are the same, returns zero. If this object
        /// has a value but the other object does not, returns +1. If this
        /// object does not have a value, but the other object does have a
        /// value, returns -1. If both objects have a value, returns an
        /// indication of their relative values
        ///</returns>
        public int CompareTo(object obj)
        {
            NullableInt other = (NullableInt)obj;

            if (mHasValue)
            {
                if (other.mHasValue)
                {
                    return(mValue.CompareTo(other.mValue));
                }
                else
                {
                    return(1);
                }
            }
            else if (other.mHasValue)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 3
0
        public bool tryI32(
			MamaFieldDescriptor descriptor,
			ref NullableInt result)
        {
            return tryI32(null, (ushort)descriptor.getFid(), ref result);
        }
Ejemplo n.º 4
0
        /// <overloads>Try to get a signed 32-bit integer field</overloads>
        public bool tryI32(
			string name, 
			ushort fid,
			ref NullableInt result)
        {
            int val = 0;
            bool ret = tryI32(name, fid, ref val);
            if (ret)
            {
                result.Value = val;
            }
            return ret;
        }
Ejemplo n.º 5
0
        private void createDeltaFromMamaMsgWithoutVectorFields(
                                                MamdaSubscription subscription,
                                                MamaMsg msg,
                                                bool isRecap)
        {
            NullableInt numLevelFields_ = new NullableInt();

            int numLevelFieldInMsg = 1;

            if (msg.tryI32 (MamdaOrderBookFields.NUM_LEVELS, ref numLevelFields_))
            {
                numLevelFieldInMsg = numLevelFields_.Value;
            }

            int maxLevelFields = MamdaOrderBookFields.getNumLevelFields();

            // getNumLevelFields() defaults to 0 but we want to go into the
            // below loop at least once for flattened messages scenario
            if (maxLevelFields == 0)
            {
                maxLevelFields = 1;
            }

            if (numLevelFieldInMsg < maxLevelFields)
            {
                maxLevelFields = numLevelFieldInMsg;
            }
            mPriceLevels = maxLevelFields;

            for (int i = 1; i <= maxLevelFields; i++)
            {
                clearLevelFields();
                mPriceLevel = i;
                MamaMsg plMsg = null;

                if (MamdaOrderBookFields.PRICE_LEVEL.Length > 1)
                {
                    plMsg = msg.getMsg(MamdaOrderBookFields.PRICE_LEVEL[i], null);
                }

                if (plMsg == null)
                {
                    if (numLevelFieldInMsg == 1)
                    {
                        // Price level fields are probably be in the main message.
                        plMsg = msg;
                    }
                    else
                    {
                         throw new MamdaDataException (
                            "cannot find price level fields in MamaMsg");
                    }
                }
                getLevelInfoAndEntries(subscription, msg, plMsg, isRecap);
            }
        }