예제 #1
0
        ///<summary> Writes this HLAsubscribeObjectClassAttributesMessage to the specified stream.</summary>
        ///<param name="writer"> the output stream to write to</param>
        ///<param name="obj"> the object to serialize</param>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override void Serialize(HlaEncodingWriter writer, object obj)
        {
            try
            {
                base.Serialize(writer, obj);

                IObjectClassHandle objectClass          = ((HLAsubscribeObjectClassAttributesMessage)obj).HLAobjectClass;
                byte[]             objectClassByteArray = new byte[objectClass.EncodedLength()];
                objectClass.Encode(objectClassByteArray, 0);

                writer.WriteHLAopaqueData(objectClassByteArray);

                IAttributeHandleSet attributeHandleSet = ((HLAsubscribeObjectClassAttributesMessage)obj).HLAattributeList;
                writer.WriteHLAinteger32BE(attributeHandleSet.Count);

                foreach (IAttributeHandle attributeHandle in attributeHandleSet)
                {
                    byte[] attributeHandleByteArray = new byte[attributeHandle.EncodedLength()];
                    attributeHandle.Encode(attributeHandleByteArray, 0);

                    writer.WriteHLAopaqueData(attributeHandleByteArray);
                }

                writer.WriteHLAboolean(((HLAsubscribeObjectClassAttributesMessage)obj).HLAactive);

                /*
                 * writer.WriteHLAinteger32BE((((HLAsubscribeObjectClassAttributesMessage)obj).HLAobjectClass).Length);
                 *
                 * for (int i = 0; i < (((HLAsubscribeObjectClassAttributesMessage)obj).HLAobjectClass).Length; i++)
                 * {
                 *  writer.WriteHLAoctet((((HLAsubscribeObjectClassAttributesMessage)obj).HLAobjectClass)[i]);
                 * }
                 * writer.WriteHLAinteger32BE((((HLAsubscribeObjectClassAttributesMessage)obj).HLAattributeList).Length);
                 *
                 * for (int i = 0; i < (((HLAsubscribeObjectClassAttributesMessage)obj).HLAattributeList).Length; i++)
                 * {
                 *  writer.WriteHLAinteger32BE(((((HLAsubscribeObjectClassAttributesMessage)obj).HLAattributeList)[i]).Length);
                 *
                 *  for (int j = 0; j < ((((HLAsubscribeObjectClassAttributesMessage)obj).HLAattributeList)[i]).Length; j++)
                 *  {
                 *      writer.WriteHLAoctet(((((HLAsubscribeObjectClassAttributesMessage)obj).HLAattributeList)[i])[j]);
                 *  }
                 * }
                 * writer.WriteHLAboolean(((HLAsubscribeObjectClassAttributesMessage)obj).HLAactive);
                 */
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
        }
예제 #2
0
        ///<summary> Writes this HLAsubscribeInteractionClassMessage to the specified stream.</summary>
        ///<param name="writer"> the output stream to write to</param>
        ///<param name="obj"> the object to serialize</param>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override void Serialize(HlaEncodingWriter writer, object obj)
        {
            try
            {
                base.Serialize(writer, obj);

                IInteractionClassHandle interactionClassHandle = (((HLAsubscribeInteractionClassMessage)obj).HLAinteractionClass);
                byte[] interactionClassHandleByteArray         = new byte[interactionClassHandle.EncodedLength()];
                interactionClassHandle.Encode(interactionClassHandleByteArray, 0);

                writer.WriteHLAopaqueData(interactionClassHandleByteArray);

                writer.WriteHLAboolean(((HLAsubscribeInteractionClassMessage)obj).HLAactive);

                /*
                 * writer.WriteHLAinteger32BE((((HLAsubscribeInteractionClassMessage)obj).HLAinteractionClass).Length);
                 *
                 * for (int i = 0; i < (((HLAsubscribeInteractionClassMessage)obj).HLAinteractionClass).Length; i++)
                 * {
                 *  writer.WriteHLAoctet((((HLAsubscribeInteractionClassMessage)obj).HLAinteractionClass)[i]);
                 * }
                 * writer.WriteHLAboolean(((HLAsubscribeInteractionClassMessage)obj).HLAactive);
                 */
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
        }
 ///<summary> Writes this HLAcreateFederationExecutionMessage to the specified stream.</summary>
 ///<param name="writer"> the output stream to write to</param>
 ///<param name="obj"> the object to serialize</param>
 ///<exception cref="IOException"> if an error occurs</exception>
 public override void Serialize(HlaEncodingWriter writer, object obj)
 {
     try
     {
         base.Serialize(writer, obj);
         writer.WriteHLAunicodeString(((HLAcreateFederationExecutionMessage)obj).FederationExecutionName);
         writer.WriteHLAopaqueData(((HLAcreateFederationExecutionMessage)obj).FederationDescriptionDocument);
     }
     catch (System.IO.IOException ioe)
     {
         throw new RTIinternalError(ioe.ToString());
     }
 }
        ///<summary> Writes this BoxInHouseMessage to the specified stream.</summary>
        ///<param name="writer"> the output stream to write to</param>
        ///<param name="obj"> the object to serialize</param>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override void Serialize(HlaEncodingWriter writer, object obj)
        {
            try
            {
                base.Serialize(writer, obj);

                byte[] logicalTimeBytesArray = ((BoxInHouseMessage)obj).Time;
                writer.WriteHLAopaqueData(logicalTimeBytesArray);
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
        }
 ///<summary> Writes this HLAinteractionFragmentMessage to the specified stream.</summary>
 ///<param name="writer"> the output stream to write to</param>
 ///<param name="obj"> the object to serialize</param>
 ///<exception cref="IOException"> if an error occurs</exception>
 public override void Serialize(HlaEncodingWriter writer, object obj)
 {
     try
     {
         writer.WriteHLAinteger32BE(((HLAinteractionFragmentMessage)obj).InteractionNumber);
         writer.WriteHLAinteger32BE(((HLAinteractionFragmentMessage)obj).InteractionSize);
         writer.WriteHLAinteger32BE(((HLAinteractionFragmentMessage)obj).FragmentOffset);
         writer.WriteHLAopaqueData(((HLAinteractionFragmentMessage)obj).FragmentContents);
     }
     catch (IOException ioe)
     {
         throw new RTIinternalError(ioe.ToString());
     }
 }
        ///<summary>
        /// Writes this ILogicalTime to the specified stream.
        ///</summary>
        ///<param name="writer"> the output stream to write to</param>
        ///<param name="HLAfederationName"> the property to serialize</param>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override void Serialize(HlaEncodingWriter writer, object HLAlogicalTime)
        {
            try
            {
                ILogicalTime logicalTime           = (ILogicalTime)HLAlogicalTime;
                byte[]       logicalTimeBytesArray = new byte[logicalTime.EncodedLength()];
                logicalTime.Encode(logicalTimeBytesArray, 0);

                writer.WriteHLAopaqueData(logicalTimeBytesArray);
            }
            catch (IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
        }
예제 #7
0
        ///<summary>
        /// Writes this HLAparameterHandleValuePair to the specified stream.
        ///</summary>
        ///<param name="writer"> the output stream to write to</param>
        ///<param name="obj"> the object to serialize</param>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override void Serialize(HlaEncodingWriter writer, object obj)
        {
            BaseInteractionMessage msg = obj as BaseInteractionMessage;

            writer.WriteHLAinteger64BE(msg.FederateHandle);
            writer.WriteHLAinteger64BE(msg.InteractionIndex);
            writer.WriteHLAinteger64BE(msg.FederationExecutionHandle);
            writer.WriteHLAopaqueData(msg.UserSuppliedTag);
            writer.WriteHLAinteger64BE(msg.InteractionClassHandle);
            IHlaEncodingSerializer serializer = serializerManager.GetSerializer(msg.InteractionClassHandle);

            if (serializer != null && !this.Equals(serializer))
            {
                serializer.Serialize(writer, obj);
            }
        }