///<summary> Reads this HlaGenericInteractionMessage 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)
        {
            HLAGenericInteractionMessage msg = new HLAGenericInteractionMessage();
            msg.CopyTo((BaseInteractionMessage)msg2);
            try
            {
                msg.ParameterList = new HLAparameterHandleValuePair[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < msg.ParameterList.Length; i++)
                {
                    msg.ParameterList[i] = HLAparameterHandleValuePairXrtiSerializer.Deserialize(reader);
                }
            }
            catch (IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return msg;
        }
Exemplo n.º 2
0
        ///<summary> Reads this HlaGenericInteractionMessage 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)
        {
            HLAGenericInteractionMessage msg = new HLAGenericInteractionMessage();

            msg.CopyTo((BaseInteractionMessage)msg2);
            try
            {
                msg.ParameterList = new HLAparameterHandleValuePair[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < msg.ParameterList.Length; i++)
                {
                    msg.ParameterList[i] = HLAparameterHandleValuePairXrtiSerializer.Deserialize(reader);
                }
            }
            catch (IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(msg);
        }
Exemplo n.º 3
0
 public void OnReceiveHLAGenericInteraction(HLAGenericInteractionMessage msg)
 {
     message = msg;
     if (log.IsDebugEnabled) log.Debug("Received LastMessage =  " + msg.ToString());
 }
Exemplo n.º 4
0
        public void TestHlaGenericInteractionMessage()
        {
            long ticks = System.DateTime.Now.Ticks;
            HLAGenericInteractionMessage msg = new HLAGenericInteractionMessage();
            msg.UserSuppliedTag = System.Text.UnicodeEncoding.Unicode.GetBytes("Sample user data Generic");
            msg.ParameterList = new HLAparameterHandleValuePair[2];

            msg.ParameterList[0] = new HLAparameterHandleValuePair();
            msg.ParameterList[0].ParameterHandle = 1;
            msg.ParameterList[0].ParameterValue = BitConverter.GetBytes(Math.PI);

            msg.ParameterList[1] = new HLAparameterHandleValuePair();
            msg.ParameterList[1].ParameterHandle = 2;
            msg.ParameterList[1].ParameterValue = BitConverter.GetBytes(ticks);

            myListener.LastMessage = null;
            helper.SendInteraction(msg);

            if (!(myListener.LastMessage is HLAGenericInteractionMessage))
            {
                throw new Exception("Error reading HlaGenericInteractionMessage");
            }
            else
            {
                HLAGenericInteractionMessage lastMsg = myListener.LastMessage as HLAGenericInteractionMessage;

                Assert.AreEqual(lastMsg.FederationExecutionHandle, msg.FederationExecutionHandle);
                Assert.AreEqual(lastMsg.InteractionClassHandle, msg.InteractionClassHandle);
                Assert.AreEqual(lastMsg.UserSuppliedTag, msg.UserSuppliedTag);
                Assert.AreEqual(lastMsg.ParameterList.Length, msg.ParameterList.Length);
                Assert.AreEqual(lastMsg.ParameterList[0].ParameterValue, msg.ParameterList[0].ParameterValue);
                Assert.AreEqual(lastMsg.ParameterList[1].ParameterValue, msg.ParameterList[1].ParameterValue);
                Assert.AreEqual(Math.PI, BitConverter.ToDouble(msg.ParameterList[0].ParameterValue, 0));
                Assert.AreEqual(ticks, BitConverter.ToInt64(msg.ParameterList[1].ParameterValue, 0));
            }
        }
Exemplo n.º 5
0
 public override void OnReceiveHLAGenericInteraction(HLAGenericInteractionMessage msg)
 {
     if (log.IsDebugEnabled)
         log.Debug("Received HLAGenericInteraction =  " + msg.ToString());
 }