示例#1
0
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._objectID.Marshal(dos);
                    this._referencedObjectID.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._updateNumber);
                    dos.WriteUnsignedByte((byte)this._forceID);
                    dos.WriteUnsignedByte((byte)this._linearSegmentParameters.Count);
                    this._requesterID.Marshal(dos);
                    this._receivingID.Marshal(dos);
                    this._objectType.Marshal(dos);

                    for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++)
                    {
                        LinearSegmentParameter aLinearSegmentParameter = (LinearSegmentParameter)this._linearSegmentParameters[idx];
                        aLinearSegmentParameter.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
示例#2
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._objectID.Unmarshal(dis);
                    this._referencedObjectID.Unmarshal(dis);
                    this._updateNumber     = dis.ReadUnsignedShort();
                    this._forceID          = dis.ReadUnsignedByte();
                    this._numberOfSegments = dis.ReadUnsignedByte();
                    this._requesterID.Unmarshal(dis);
                    this._receivingID.Unmarshal(dis);
                    this._objectType.Unmarshal(dis);
                    for (int idx = 0; idx < this.NumberOfSegments; idx++)
                    {
                        LinearSegmentParameter anX = new LinearSegmentParameter();
                        anX.Unmarshal(dis);
                        this._linearSegmentParameters.Add(anX);
                    }
                    ;
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
示例#3
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<LinearObjectStatePdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<objectID>");
                this._objectID.Reflection(sb);
                sb.AppendLine("</objectID>");
                sb.AppendLine("<referencedObjectID>");
                this._referencedObjectID.Reflection(sb);
                sb.AppendLine("</referencedObjectID>");
                sb.AppendLine("<updateNumber type=\"ushort\">" + this._updateNumber.ToString(CultureInfo.InvariantCulture) + "</updateNumber>");
                sb.AppendLine("<forceID type=\"byte\">" + this._forceID.ToString(CultureInfo.InvariantCulture) + "</forceID>");
                sb.AppendLine("<linearSegmentParameters type=\"byte\">" + this._linearSegmentParameters.Count.ToString(CultureInfo.InvariantCulture) + "</linearSegmentParameters>");
                sb.AppendLine("<requesterID>");
                this._requesterID.Reflection(sb);
                sb.AppendLine("</requesterID>");
                sb.AppendLine("<receivingID>");
                this._receivingID.Reflection(sb);
                sb.AppendLine("</receivingID>");
                sb.AppendLine("<objectType>");
                this._objectType.Reflection(sb);
                sb.AppendLine("</objectType>");
                for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++)
                {
                    sb.AppendLine("<linearSegmentParameters" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"LinearSegmentParameter\">");
                    LinearSegmentParameter aLinearSegmentParameter = (LinearSegmentParameter)this._linearSegmentParameters[idx];
                    aLinearSegmentParameter.Reflection(sb);
                    sb.AppendLine("</linearSegmentParameters" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</LinearObjectStatePdu>");
            }
            catch (Exception e)
            {
#if DEBUG
                Trace.WriteLine(e);
                Trace.Flush();
#endif
                this.OnException(e);
            }
        }
示例#4
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._objectID.GetMarshalledSize();           // this._objectID
            marshalSize += this._referencedObjectID.GetMarshalledSize(); // this._referencedObjectID
            marshalSize += 2;                                            // this._updateNumber
            marshalSize += 1;                                            // this._forceID
            marshalSize += 1;                                            // this._numberOfSegments
            marshalSize += this._requesterID.GetMarshalledSize();        // this._requesterID
            marshalSize += this._receivingID.GetMarshalledSize();        // this._receivingID
            marshalSize += this._objectType.GetMarshalledSize();         // this._objectType
            for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++)
            {
                LinearSegmentParameter listElement = (LinearSegmentParameter)this._linearSegmentParameters[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
示例#5
0
        /// <summary>
        /// Compares for reference AND value equality.
        /// </summary>
        /// <param name="obj">The object to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if both operands are equal; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(LinearSegmentParameter obj)
        {
            bool ivarsEqual = true;

            if (obj.GetType() != this.GetType())
            {
                return(false);
            }

            if (this._segmentNumber != obj._segmentNumber)
            {
                ivarsEqual = false;
            }

            if (this._segmentModification != obj._segmentModification)
            {
                ivarsEqual = false;
            }

            if (this._generalSegmentAppearance != obj._generalSegmentAppearance)
            {
                ivarsEqual = false;
            }

            if (this._specificSegmentAppearance != obj._specificSegmentAppearance)
            {
                ivarsEqual = false;
            }

            if (!this._segmentLocation.Equals(obj._segmentLocation))
            {
                ivarsEqual = false;
            }

            if (!this._segmentOrientation.Equals(obj._segmentOrientation))
            {
                ivarsEqual = false;
            }

            if (this._segmentLength != obj._segmentLength)
            {
                ivarsEqual = false;
            }

            if (this._segmentWidth != obj._segmentWidth)
            {
                ivarsEqual = false;
            }

            if (this._segmentHeight != obj._segmentHeight)
            {
                ivarsEqual = false;
            }

            if (this._segmentDepth != obj._segmentDepth)
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }