/// <summary> Decodes an object class handle stored within the specified bufferStream. /// /// </summary> /// <param name="bufferStream">the bufferStream that contains the encoded handle /// </param> /// <param name="offset">the offset within the bufferStream at which the encoded /// handle is located /// </param> /// <returns> an <code>IObjectClassHandle</code> representing the decoded /// handle /// </returns> /// <exception cref="CouldNotDecode"> if the handle could not be decoded /// </exception> /// <exception cref="FederateNotExecutionMember"> if the federate is not a member /// of the execution /// </exception> public virtual IObjectClassHandle Decode(byte[] buffer, int offset) { byte[] buf = new byte[8]; Array.Copy(buffer, offset, buf, 0, 8); return(new XRTIObjectClassHandle(EncodingHelpers.DecodeLong(buf))); }
/// <summary> /// Decodes a federate handle within the specified bufferStream and /// returns a corresponding <code>IFederateHandle</code> instance. /// </summary> /// <param name="bufferStream">the bufferStream from which to Decode the federate handle /// </param> /// <param name="offset">the offset within the bufferStream at which the encoded /// federate handle resides /// </param> /// <returns> the new <code>IFederateHandle</code> instance corresponding /// to the encoded handle /// </returns> /// <exception cref="CouldNotDecode"> if the federate handle could not be decoded /// </exception> /// <exception cref="FederateNotExecutionMember"> if the federate is not a member /// of the execution /// </exception> public virtual IFederateHandle Decode(byte[] buffer, int offset) { byte[] buf = new byte[8]; Array.Copy(buffer, offset, buf, 0, 8); return((XRTIFederateHandle)(EncodingHelpers.DecodeLong(buf))); }
/// <summary> /// Encodes this object handle, placing the result into the specified /// bufferStream. /// </summary> /// <param name="bufferStream">the bufferStream to contain the encoded parameterValue /// </param> /// <param name="offset">the offset within the bufferStream at which to store /// the encoded parameterValue /// </param> public void Encode(byte[] buffer, int offset) { byte[] buf = EncodingHelpers.EncodeLong(identifier); Array.Copy(buf, 0, buffer, offset, 8); }
/// <summary> /// Decodes an attribute handle, returning a new instance of /// <code>IAttributeHandle</code>. /// </summary> /// <param name="bufferStream">the encoded attribute handle /// </param> /// <param name="offset">the offset of the handle data in the bufferStream /// </param> /// <returns> an instance of <code>IAttributeHandle</code> corresponding /// to the encoded handle /// </returns> /// <exception cref="CouldNotDecode"> if the attribute handle could not be decoded /// </exception> /// <exception cref="FederateNotExecutionMember"> if the federate is not a member /// of the execution /// </exception> public virtual IAttributeHandle Decode(byte[] buffer, int offset) { return(new XRTIAttributeHandle(EncodingHelpers.DecodeLong(buffer, offset))); }