///<summary> Reads this HLAcreateFederationExecutionMessage 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)
 {
     HLAcreateFederationExecutionMessage decodedValue;
     if (!(msg is HLAcreateFederationExecutionMessage))
     {
         decodedValue = new HLAcreateFederationExecutionMessage();
         BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
         decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
         decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
         decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
     }
     else
     {
         decodedValue = msg as HLAcreateFederationExecutionMessage;
     }
     object tmp = decodedValue;
     decodedValue = base.Deserialize(reader, ref tmp) as HLAcreateFederationExecutionMessage;
     try
     {
         decodedValue.FederationExecutionName = reader.ReadHLAunicodeString();
         decodedValue.FederationDescriptionDocument = reader.ReadHLAopaqueData();
     }
     catch(System.IO.IOException ioe)
     {
         throw new RTIinternalError(ioe.ToString());
     }
     return decodedValue;
 }
 ///<summary>
 /// Reads and returns a ILogicalTimeInterval from the specified stream.
 ///</summary>
 ///<param name="reader"> the input stream to read from</param>
 ///<param name="dummy"> this parameter is not used</param>
 ///<returns> the decoded value</returns>
 ///<exception cref="System.IO.IOException"> if an error occurs</exception>
 public override object Deserialize(HlaEncodingReader reader, ref object dummy)
 {
     ILogicalTimeInterval decodedValue;
     try
     {
         decodedValue = logicalTimeIntervalFactory.Decode(reader.ReadHLAopaqueData(), 0);
         return decodedValue;
     }
     catch (IOException ioe)
     {
         throw new FederateInternalError(ioe.ToString());
     }
 }
        ///<summary>
        /// Reads and returns a HLAfederate.HLAlogicalTime from the specified stream.
        ///</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<param name="dummy"> this parameter is not used</param>
        ///<returns> the decoded value</returns>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object dummy)
        {
            ILogicalTime decodedValue;

            try
            {
                decodedValue = logicalTimeFactory.Decode(reader.ReadHLAopaqueData(), 0);
                return(decodedValue);
            }
            catch (IOException ioe)
            {
                throw new FederateInternalError(ioe.ToString());
            }
        }
        ///<summary> Reads this HLAsubscribeObjectClassAttributesMessage 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)
        {
            HLAsubscribeObjectClassAttributesMessage decodedValue;
            if (!(msg is HLAsubscribeObjectClassAttributesMessage))
            {
                decodedValue = new HLAsubscribeObjectClassAttributesMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAsubscribeObjectClassAttributesMessage;
            }
            object tmp = decodedValue;
            decodedValue = base.Deserialize(reader, ref tmp) as HLAsubscribeObjectClassAttributesMessage;
            try
            {
                byte[] objectClassByteArray = reader.ReadHLAopaqueData();
                decodedValue.HLAobjectClass = objectClassFactory.Decode(objectClassByteArray, 0);

                decodedValue.HLAattributeList = attributeHandleSetFactory.Create();

                int count = reader.ReadHLAinteger32BE();

                for (int i = 0; i < count; i++)
                {
                    IAttributeHandle attributeHandle = attributeHandleFactory.Decode(reader.ReadHLAopaqueData(), 0);
                    decodedValue.HLAattributeList.Add(attributeHandle);
                }

                decodedValue.HLAactive = reader.ReadHLAboolean();

                /*
                decodedValue.HLAobjectClass = new byte[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < decodedValue.HLAobjectClass.Length; i++)
                {
                    decodedValue.HLAobjectClass[i] = reader.ReadHLAoctet();
                }
                decodedValue.HLAattributeList = new byte[reader.ReadHLAinteger32BE()][];

                for (int i = 0; i < decodedValue.HLAattributeList.Length; i++)
                {
                    decodedValue.HLAattributeList[i] = new byte[reader.ReadHLAinteger32BE()];

                    for (int j = 0; j < decodedValue.HLAattributeList[i].Length; j++)
                    {
                        decodedValue.HLAattributeList[i][j] = reader.ReadHLAoctet();
                    }
                }
                decodedValue.HLAactive = reader.ReadHLAboolean();
                */
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return decodedValue;
        }
        ///<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;
        }
        ///<summary> Reads this HLAupdateAttributeValuesWithTimeMessage 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)
        {
            HLAupdateAttributeValuesWithTimeMessage decodedValue;
            if (!(msg is HLAupdateAttributeValuesWithTimeMessage))
            {
                decodedValue = new HLAupdateAttributeValuesWithTimeMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.CopyTo(baseMsg);
                //decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                //decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                //decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAupdateAttributeValuesWithTimeMessage;
            }

            object tmp = decodedValue;

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

                decodedValue.LogicalTime = reader.ReadHLAopaqueData();
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }

            return decodedValue;
        }
 ///<summary> Reads this HLAinteractionFragmentMessage 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)
 {
     HLAinteractionFragmentMessage msg = new HLAinteractionFragmentMessage();
     msg.CopyTo((BaseInteractionMessage)msg2);
     try
     {
         msg.InteractionNumber = reader.ReadHLAinteger32BE();
         msg.InteractionSize = reader.ReadHLAinteger32BE();
         msg.FragmentOffset = reader.ReadHLAinteger32BE();
         msg.FragmentContents = reader.ReadHLAopaqueData();
     }
     catch (IOException ioe)
     {
         throw new RTIinternalError(ioe.ToString());
     }
     return msg;
 }