Wombat.MamaMsg.getField C# (CSharp) Метод

getField() публичный Метод

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
name string
fid ushort
Результат Wombat.MamaMsgField
        public MamaMsgField getField(
			string name,
			ushort fid)
        {
            EnsurePeerCreated();
            IntPtr field = IntPtr.Zero;
            int code = NativeMethods.mamaMsg_getField(nativeHandle, name, fid,ref field);
            CheckResultCode(code);

            if (mField == null)
            {
                //See MamaWrapper constructor - this is fine as ownsThePeer will be set false
                mField = new MamaMsgField (field);
            }
            else
            {
                mField.setNativeHandle(field);

            }
            return mField;
        }

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 valueIfMissing ) : Wombat.MamaMsgField

Usage Example

Пример #1
0
        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