Wombat.MamaMsg.tryI32 C# (CSharp) Method

tryI32() public method

public tryI32 ( Wombat.MamaFieldDescriptor descriptor, Wombat.NullableInt &result ) : bool
descriptor Wombat.MamaFieldDescriptor
result Wombat.NullableInt
return bool
        public bool tryI32(
			MamaFieldDescriptor descriptor,
			ref NullableInt result)
        {
            return tryI32(null, (ushort)descriptor.getFid(), ref result);
        }

Same methods

MamaMsg::tryI32 ( Wombat.MamaFieldDescriptor descriptor, int &result ) : bool
MamaMsg::tryI32 ( string name, ushort fid, Wombat.NullableInt &result ) : bool
MamaMsg::tryI32 ( string name, ushort fid, int &result ) : bool

Usage Example

コード例 #1
0
        /// <summary>
        /// Returns whether a complete book delta was received.
        /// 
        /// Books without vector fields (i.e. fixed field layout) might
        /// come in multiple MamaMsgs.  The MdMsgNum and MdTotalNum
        /// fields can be used to determine which message is which.
        /// 
        /// When a single price level is present, it may or may not be
        /// encapsulated in a nested message field.  Similarly, with single
        /// entries in a price level.
        /// </summary>
        /// <param name="delta"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private bool createDeltaFromMamaMsgWithoutVectorFields(
			MamdaOrderBook delta,
			MamaMsg msg)
        {
            int msgNum   = 1;
            int msgTotal = 1;

            if (msg.tryI32(MamaReservedFields.MsgNum, ref mMsgNum))
            {
                msgNum = mMsgNum.Value;
            }
            if (msg.tryI32(MamaReservedFields.MsgTotal, ref mMsgTotal))
            {
                msgTotal = mMsgTotal.Value;
            }

            if (msgNum == 1)
            {
                // Only clear the book if this is the first message in the
                // set of updates.
                delta.clear();
            }

            if (!mHaveSanityCheckedBookDict)
            {
                mHaveSanityCheckedBookDict = true;
                if (MamdaOrderBookFields.PRICE_LEVEL.Length == 0)
                {
                    throw new MamdaOrderBookException (
                        "data dictionary error: cannot find price level fields");
                }
            }

            //for optimised feed date, wNumLevels should be assumed = 1 if not sent
            int numLevelFieldInMsg = 1;
            if (msg.tryI32(MamdaOrderBookFields.NUM_LEVELS, ref mNumLevelFields))
            {
                numLevelFieldInMsg = mNumLevelFields.Value;
            }

            int maxLevelFields = MamdaOrderBookFields.PRICE_LEVEL.Length;
            if (numLevelFieldInMsg < maxLevelFields)
            {
                maxLevelFields = numLevelFieldInMsg;
            }

            for (int i = 1; i <= maxLevelFields; i++)
            {
                MamaMsg 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");
                    }
                }

                MamdaOrderBookPriceLevel level = new MamdaOrderBookPriceLevel();
                getLevelInfo(level, plMsg, delta);
                getEntries(level, plMsg);
                delta.addLevel (level);
            }
            return msgNum == msgTotal;
        }
All Usage Examples Of Wombat.MamaMsg::tryI32
MamaMsg