Exemplo n.º 1
0
 public virtual void SendRealiableInteraction(StreamMessageChannel messageChannel, BaseInteractionMessage msg)
 {
     try
     {
         lock (messageChannel.SyncObject)
         {
             /*
              * if (log.IsDebugEnabled)
              *  log.Debug("Sending Interaction: " + msg);
              */
             serializer.Serialize(messageChannel.OutputStream, msg);
         }
     }
     catch (System.Exception e)
     {
         throw new RTIinternalError(e.Message);
     }
 }
 ///<summary>
 /// Writes this HLAfederate.HLAGALT 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 HLAGALT)
 {
     try
     {
         IHlaEncodingSerializer serializer = serializerManager.GetSerializer(typeof(ILogicalTime));
         serializer.Serialize(writer, HLAGALT);
     }
     catch (IOException ioe)
     {
         throw new RTIinternalError(ioe.ToString());
     }
 }
Exemplo n.º 3
0
        public override void Serialize(HlaEncodingWriter writer, object msg)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("serialization writer");
            }

            writer.WriteHLAinteger32BE(MAGIC_NUMBER);
            writer.WriteHLAinteger32BE(hlaEncodingModelVersion);
            baseSerializer.Serialize(writer, msg);
            writer.Flush();
        }
Exemplo n.º 4
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);
            }
        }
        ///<summary> Writes this HLAupdateAttributeValuesMessage 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);

                writer.WriteHLAinteger64BE(((HLAupdateAttributeValuesMessage)obj).ObjectInstanceHandle);
                writer.WriteHLAinteger32BE((((HLAupdateAttributeValuesMessage)obj).AttributeHandleValuePairList).Length);

                for (int i = 0; i < (((HLAupdateAttributeValuesMessage)obj).AttributeHandleValuePairList).Length; i++)
                {
                    hlaAttributeHandleValuePairXrtiSerializer.Serialize(writer, ((HLAupdateAttributeValuesMessage)obj).AttributeHandleValuePairList[i]);
                }
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
        }