///<summary> Reads this BoxInHouseMessage from the specified stream.</summary> ///<param name="reader"> the input stream to read from</param> ///<returns> the object</returns> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override object Deserialize(HlaEncodingReader reader, ref object msg) { BoxInHouseMessage decodedValue; if (!(msg is BoxInHouseMessage)) { decodedValue = new BoxInHouseMessage(); BaseInteractionMessage baseMsg = msg as BaseInteractionMessage; decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle; decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle; decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag; } else { decodedValue = msg as BoxInHouseMessage; } object tmp = decodedValue; try { decodedValue = base.Deserialize(reader, ref tmp) as BoxInHouseMessage; decodedValue.Time = reader.ReadHLAopaqueData(); } catch (System.IO.IOException ioe) { throw new RTIinternalError(ioe.ToString()); } return(decodedValue); }
///<summary> ///Notifies that the box is already in its house ///</summary> ///<param name="msg"> the message associated with the interaction</param> ///<exception cref="InteractionClassNotRecognized"> if the interaction class was not recognized</exception> ///<exception cref="InteractionParameterNotRecognized"> if a parameter of the interaction was not /// recognized</exception> ///<exception cref="InteractionClassNotSubscribed"> if the federate had not subscribed to the /// interaction class</exception> ///<exception cref="FederateInternalError"> if an error occurs in the federate</exception> public void OnReceiveBoxInHouse(BoxInHouseMessage msg) { ILogicalTime time = timeFactory.Decode(msg.Time, 0); if (log.IsDebugEnabled) { log.Debug("Received BoxInHouseMessage [time = " + time + "]"); } form.UpdateBoxInHouseTimeLabel(time); ObjectInstanceDescriptor oid = rti.descriptorManager.GetObjectInstanceDescriptor(home.InstanceHandle); IObjectClassHandle och = oid.ClassHandle; ObjectClassDescriptor ocd = rti.descriptorManager.GetObjectClassDescriptor(och); HLAattributeHandleValuePair[] handleValuePairList = new HLAattributeHandleValuePair[1]; handleValuePairList[0] = new HLAattributeHandleValuePair(); handleValuePairList[0].AttributeHandle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("BoxesCount").Handle).Identifier; handleValuePairList[0].AttributeValue = 1; rti.UpdateAttributeValues(home.InstanceHandle, handleValuePairList, new byte[1], time); }
///<summary> Reads this BoxInHouseMessage from the specified stream.</summary> ///<param name="reader"> the input stream to read from</param> ///<returns> the object</returns> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override object Deserialize(HlaEncodingReader reader, ref object msg) { BoxInHouseMessage decodedValue; if (!(msg is BoxInHouseMessage)) { decodedValue = new BoxInHouseMessage(); BaseInteractionMessage baseMsg = msg as BaseInteractionMessage; decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle; decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle; decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag; } else { decodedValue = msg as BoxInHouseMessage; } object tmp = decodedValue; try { decodedValue = base.Deserialize(reader, ref tmp) as BoxInHouseMessage; decodedValue.Time = reader.ReadHLAopaqueData(); } catch(System.IO.IOException ioe) { throw new RTIinternalError(ioe.ToString()); } return decodedValue; }