Example #1
0
        ///<summary> Reads this HLAfederateMessage 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)
        {
            HLAfederateMessage decodedValue;
            if (!(msg is HLAfederateMessage))
            {
                decodedValue = new HLAfederateMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAfederateMessage;
            }
            object tmp = decodedValue;
            decodedValue = base.Deserialize(reader, ref tmp) as HLAfederateMessage;
            try
            {
                /*
                decodedValue.HLAfederate = new byte[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < decodedValue.HLAfederate.Length; i++)
                {
                    decodedValue.HLAfederate[i] = reader.ReadHLAoctet();
                }
                */
                decodedValue.HLAfederate = (HLAfederateHandle)reader.ReadHLAinteger32BE();
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return decodedValue;
        }
Example #2
0
        ///<summary> Reads this HLAfederateMessage 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)
        {
            HLAfederateMessage decodedValue;

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

            decodedValue = base.Deserialize(reader, ref tmp) as HLAfederateMessage;
            try
            {
                /*
                 * decodedValue.HLAfederate = new byte[reader.ReadHLAinteger32BE()];
                 *
                 * for (int i = 0; i < decodedValue.HLAfederate.Length; i++)
                 * {
                 *  decodedValue.HLAfederate[i] = reader.ReadHLAoctet();
                 * }
                 */
                decodedValue.HLAfederate = (HLAfederateHandle)reader.ReadHLAinteger32BE();
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }