示例#1
0
        ///<summary>
        /// Reads and returns a BaseIteractionMessage from the specified stream.
        ///</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the decoded parameterValue</returns>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            if (msg == null)
            {
                msg = new BaseInteractionMessage();
            }
            BaseInteractionMessage decodedValue = msg as BaseInteractionMessage;

            decodedValue.FederateHandle            = reader.ReadHLAinteger64BE();
            decodedValue.InteractionIndex          = reader.ReadHLAinteger64BE();
            decodedValue.FederationExecutionHandle = reader.ReadHLAinteger64BE();
            decodedValue.UserSuppliedTag           = reader.ReadHLAopaqueData();
            decodedValue.InteractionClassHandle    = reader.ReadHLAinteger64BE();

            IHlaEncodingSerializer serializer = serializerManager.GetSerializer(decodedValue.InteractionClassHandle);

            if (serializer != null && !this.Equals(serializer))
            {
                object decodedValueTmp = decodedValue;
                return(serializer.Deserialize(reader, ref decodedValueTmp));
            }
            else
            {
                return(decodedValue);
            }
        }
示例#2
0
        ///<summary> Reads this HLAregisterObjectInstanceMessage from the specified stream.</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the object</returns>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            /* msg2
             * HLAregisterObjectInstanceMessage msg = new HLAregisterObjectInstanceMessage();
             * msg.CopyTo((BaseInteractionMessage)msg2);
             *
             * try
             * {
             *  msg.ObjectName = reader.ReadHLAunicodeString();
             *  msg.ObjectInstanceHandle = reader.ReadHLAinteger64BE();
             *  msg.ObjectClassHandle = reader.ReadHLAinteger64BE();
             * }
             * catch (IOException ioe)
             * {
             *  throw new RTIinternalError(ioe.ToString());
             * }
             * return msg;
             */

            HLAregisterObjectInstanceMessage decodedValue;

            if (!(msg is HLAregisterObjectInstanceMessage))
            {
                decodedValue = new HLAregisterObjectInstanceMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.CopyTo(baseMsg);
                //decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                //decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                //decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAregisterObjectInstanceMessage;
            }
            object tmp = decodedValue;

            try
            {
                decodedValue = base.Deserialize(reader, ref tmp) as HLAregisterObjectInstanceMessage;

                decodedValue.ObjectName           = reader.ReadHLAunicodeString();
                decodedValue.ObjectInstanceHandle = reader.ReadHLAinteger64BE();
                decodedValue.ObjectClassHandle    = reader.ReadHLAinteger64BE();
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }
示例#3
0
        ///<summary> Reads this HLAjoinFederationExecutionMessage from the specified stream.</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the object</returns>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            HLAjoinFederationExecutionMessage decodedValue;

            if (!(msg is HLAjoinFederationExecutionMessage))
            {
                decodedValue = new HLAjoinFederationExecutionMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.InteractionClassHandle    = baseMsg.InteractionClassHandle;
                decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                decodedValue.UserSuppliedTag           = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAjoinFederationExecutionMessage;
            }
            object tmp = decodedValue;

            decodedValue = base.Deserialize(reader, ref tmp) as HLAjoinFederationExecutionMessage;
            try
            {
                decodedValue.FederationExecutionName = reader.ReadHLAunicodeString();
                decodedValue.FederateType            = reader.ReadHLAunicodeString();
                decodedValue.FederateHandle          = reader.ReadHLAinteger64BE();
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }
        ///<summary> Reads this HLAreportHandlesMessage from the specified stream.</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the object</returns>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg2)
        {
            HLAreportHandlesMessage msg = new HLAreportHandlesMessage();

            msg.CopyTo((BaseInteractionMessage)msg2);
            try
            {
                msg.BlockStart = reader.ReadHLAinteger64BE();
                msg.BlockSize  = reader.ReadHLAinteger64BE();
            }
            catch (IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(msg);
        }
示例#5
0
        ///<summary> Reads this HLArequestAttributeValueUpdateMessage from the specified stream.</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the object</returns>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg2)
        {
            HLArequestAttributeValueUpdateMessage msg = new HLArequestAttributeValueUpdateMessage();

            msg.CopyTo((BaseInteractionMessage)msg2);

            try
            {
                msg.ObjectInstanceHandle = reader.ReadHLAinteger64BE();
                msg.AttributeHandleList  = new long[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < msg.AttributeHandleList.Length; i++)
                {
                    msg.AttributeHandleList[i] = reader.ReadHLAinteger64BE();
                }
            }
            catch (IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(msg);
        }
        ///<summary> Reads this HLAupdateAttributeValuesMessage 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)
        {
            HLAupdateAttributeValuesMessage decodedValue;

            if (!(msg is HLAupdateAttributeValuesMessage))
            {
                decodedValue = new HLAupdateAttributeValuesMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.CopyTo(baseMsg);
                //decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                //decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                //decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAupdateAttributeValuesMessage;
            }
            object tmp = decodedValue;

            try
            {
                decodedValue = base.Deserialize(reader, ref tmp) as HLAupdateAttributeValuesMessage;

                decodedValue.ObjectInstanceHandle         = reader.ReadHLAinteger64BE();
                decodedValue.AttributeHandleValuePairList = new HLAattributeHandleValuePair[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < decodedValue.AttributeHandleValuePairList.Length; i++)
                {
                    tmp = BaseInteractionMessage.NullBaseInteractionMessage;
                    decodedValue.AttributeHandleValuePairList[i] = (HLAattributeHandleValuePair)hlaAttributeHandleValuePairXrtiSerializer.Deserialize(reader, ref tmp);
                }
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }