예제 #1
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 and returns a HLAalternative from the specified stream.
        ///</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the decoded value</returns>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            String decodedValue;

            try
            {
                decodedValue = reader.ReadHLAunicodeString();
                return(decodedValue);
            }
            catch (IOException ioe)
            {
                throw new FederateInternalError(ioe.ToString());
            }
        }
예제 #3
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);
        }
        ///<summary> Reads this PeerAdvertisementInteractionMessage 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)
        {
            PeerAdvertisementInteractionMessage decodedValue;

            if (!(msg is PeerAdvertisementInteractionMessage))
            {
                decodedValue = new PeerAdvertisementInteractionMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.InteractionClassHandle    = baseMsg.InteractionClassHandle;
                decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                decodedValue.UserSuppliedTag           = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as PeerAdvertisementInteractionMessage;
            }
            //object tmp = decodedValue;
            //decodedValue = base.Deserialize(reader, ref tmp) as PeerAdvertisementInteractionMessage;
            try
            {
                decodedValue.PeerName        = reader.ReadHLAunicodeString();
                decodedValue.PeerDescription = reader.ReadHLAunicodeString();
                decodedValue.PeerChannels    = new ConnectionList();
                int PeerChannelsLength = reader.ReadHLAinteger32BE();

                for (int i = 0; i < PeerChannelsLength; i++)
                {
                    decodedValue.PeerChannels.Add(reader.ReadHLAunicodeString());
                }
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }