Wombat.MamaMsg.getField C# (CSharp) Method

getField() public method

Get a MAMA msg field. The result contains the reusable field object of the nativeHandle object. Applications calling this method will receive the same reusable object for repeated calls on same nativeHandle object.
public getField ( string name, ushort fid, Wombat.MamaMsgField valueIfMissing ) : Wombat.MamaMsgField
name string
fid ushort
valueIfMissing Wombat.MamaMsgField
return Wombat.MamaMsgField
        public MamaMsgField getField(
			string name,
			ushort fid,
			MamaMsgField valueIfMissing)
        {
            if (mField == null)
            {
                mField = new MamaMsgField ();
                mField.SelfManageLifeTime(false);
            }
            if (tryField (name, fid, ref mField))
                return mField;
            else
                return valueIfMissing;
        }

Same methods

MamaMsg::getField ( Wombat.MamaFieldDescriptor descriptor ) : Wombat.MamaMsgField
MamaMsg::getField ( Wombat.MamaFieldDescriptor descriptor, Wombat.MamaMsgField valueIfMissing ) : Wombat.MamaMsgField
MamaMsg::getField ( string name, ushort fid ) : Wombat.MamaMsgField

Usage Example

        private void updateOrderImbalanceFields(
			MamdaSubscription	subscription,
			MamaMsg				msg,
			mamaMsgType			msgType)
		{
			string securityStatus = null;
			lock (this)
			{
				MamaMsgField msgField = null;
	            
				/*The wSecStatusQual will not always be in the message 
				so you need to account for this by checking for it.
				*/
				try
				{
					msgField = msg.getField(MamdaOrderImbalanceFields.SECURITY_STATUS_QUAL, null);
				}
				catch (MamdaDataException ex)
				{
					throw new MamaException(MamaStatus.mamaStatus.MAMA_STATUS_PLATFORM, ex.Message);
				}
				if (msgField == null) //does not exist
					return;

				securityStatus = msgField.getString();

				if (isImbalanceType(securityStatus))
				{
					clearCache(mOrderImbalanceCache);
				}
				msg.iterateFields(mFieldIterator, null,null);
			}

			switch (msgType)
			{
				case mamaMsgType.MAMA_MSG_TYPE_INITIAL:
				case mamaMsgType.MAMA_MSG_TYPE_RECAP:
					handleRecap(subscription, msg);
					break;
				case mamaMsgType.MAMA_MSG_TYPE_UPDATE:
				{
					int value = 0;
					if (securityStatus != null)
					{
						value = MamdaOrderImbalanceType.stringToValue(securityStatus);
						if (MamdaOrderImbalanceType.isMamdaImbalanceOrder(value))
						{
							handleOrderImbalance(subscription,msg); 
						}
						else
						{
							handleNoOrderImbalance(subscription, msg); 
						}
					}
				}
				break;
			default:
				break;
			}
	        
		}
MamaMsg