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(); }
///<summary> /// Writes this HLAfederation.HLAfederatesinFederation to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="HLAfederatesinFederation"> the property to serialize</param> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override void Serialize(HlaEncodingWriter writer, object HLAfederatesinFederation) { try { writer.WriteHLAinteger32BE(((byte[][])HLAfederatesinFederation).Length); for(int i=0;i< ((byte[][])HLAfederatesinFederation).Length;i++) { writer.WriteHLAinteger32BE((((byte[][])HLAfederatesinFederation)[i]).Length); for(int j=0;j< (((byte[][])HLAfederatesinFederation)[i]).Length;j++) { writer.WriteHLAoctet((((byte[][])HLAfederatesinFederation)[i])[j]); } } } catch(IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
///<summary> /// Writes this HLAfederation.HLAfederatesinFederation to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="HLAfederatesinFederation"> the property to serialize</param> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override void Serialize(HlaEncodingWriter writer, object HLAfederatesinFederation) { try { writer.WriteHLAinteger32BE(((byte[][])HLAfederatesinFederation).Length); for (int i = 0; i < ((byte[][])HLAfederatesinFederation).Length; i++) { writer.WriteHLAinteger32BE((((byte[][])HLAfederatesinFederation)[i]).Length); for (int j = 0; j < (((byte[][])HLAfederatesinFederation)[i]).Length; j++) { writer.WriteHLAoctet((((byte[][])HLAfederatesinFederation)[i])[j]); } } } catch (IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
///<summary> /// Writes this HLAfederation.HLAnextSaveTime to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="HLAnextSaveTime"> the property to serialize</param> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override void Serialize(HlaEncodingWriter writer, object HLAnextSaveTime) { try { writer.WriteHLAinteger32BE(((byte[])HLAnextSaveTime).Length); for (int i = 0; i < ((byte[])HLAnextSaveTime).Length; i++) { writer.WriteHLAoctet(((byte[])HLAnextSaveTime)[i]); } } catch (IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
///<summary> /// Writes this HLAfederation.HLAlastSaveTime to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="HLAlastSaveTime"> the property to serialize</param> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override void Serialize(HlaEncodingWriter writer, object HLAlastSaveTime) { try { writer.WriteHLAinteger32BE(((byte[])HLAlastSaveTime).Length); for(int i=0;i< ((byte[])HLAlastSaveTime).Length;i++) { writer.WriteHLAoctet(((byte[])HLAlastSaveTime)[i]); } } catch(IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
///<summary> /// Writes this HLAfederate.HLAfederateHandle to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="HLAfederateHandle"> the property to serialize</param> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override void Serialize(HlaEncodingWriter writer, object HLAfederateHandle) { // PATCH ANGEL: Es necesario realizar un cast del object primero a HLAfederateHandle y luego a byte[] para que funcione correctamente (1º Linea de código) // Se debería incluir esta modificación en el Dynamic Compiler (Lo comentado es lo que generaba). try { byte[] handle = ((byte[])((HLAfederateHandle)HLAfederateHandle)); writer.WriteHLAinteger32BE(handle.Length); // Como argumento: ((byte[])HLAfederateHandle).Length for (int i = 0; i < handle.Length; i++) // Condición del for: i < ((byte[])HLAfederateHandle).Length { writer.WriteHLAoctet(handle[i]); // Como argumento: ((byte[])HLAfederateHandle)[i] } } catch (IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
///<summary> Writes this HlaGenericInteractionMessage 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(((HLAGenericInteractionMessage)obj).ParameterList.Length); for (int i = 0; i < ((HLAGenericInteractionMessage)obj).ParameterList.Length; i++) { HLAparameterHandleValuePairXrtiSerializer.Serialize(writer, ((HLAGenericInteractionMessage)obj).ParameterList[i]); } } catch (IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
///<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()); } }
///<summary>Writes this HLAtimeState to the specified stream.</summary> ///<param name="writer"> the stream to write to</param> ///<exception cref="IOException"> if an error occurs</exception> public static void Serialize(HlaEncodingWriter writer, HLAtimeState val) { writer.WriteHLAinteger32BE((int)val); }
///<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()); } }
///<summary> Writes this HLArequestAttributeValueUpdateMessage 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.WriteHLAinteger64BE(((HLArequestAttributeValueUpdateMessage)obj).ObjectInstanceHandle); writer.WriteHLAinteger32BE(((HLArequestAttributeValueUpdateMessage)obj).AttributeHandleList.Length); for (int i = 0; i < ((HLArequestAttributeValueUpdateMessage)obj).AttributeHandleList.Length; i++) { writer.WriteHLAinteger64BE(((HLArequestAttributeValueUpdateMessage)obj).AttributeHandleList[i]); } } catch (IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }
public static void Serialize(HlaEncodingWriter writer, Actor.MoveDirection val) { writer.WriteHLAinteger32BE((int)val); }
///<summary> /// Writes this Home.PosX to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="PosX"> the property to serialize</param> ///<exception cref="System.IO.IOException"> if an error occurs</exception> public override void Serialize(HlaEncodingWriter writer, object PosX) { try { writer.WriteHLAinteger32BE((int)PosX); } catch(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 HLAfederateMessage 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); int val = (((HLAfederateMessage)obj).HLAfederate).data; writer.WriteHLAinteger32BE(val); /* writer.WriteHLAinteger32BE((((HLAfederateMessage)obj).HLAfederate).Length); for (int i = 0; i < (((HLAfederateMessage)obj).HLAfederate).Length; i++) { writer.WriteHLAoctet((((HLAfederateMessage)obj).HLAfederate)[i]); } */ } catch (System.IO.IOException ioe) { throw new RTIinternalError(ioe.ToString()); } }