public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._environmentalSimulationApplicationID.GetMarshalledSize(); // this._environmentalSimulationApplicationID
            marshalSize += 2;                                                              // this._fieldNumber
            marshalSize += 2;                                                              // this._pduNumber
            marshalSize += 2;                                                              // this._pduTotal
            marshalSize += 2;                                                              // this._coordinateSystem
            marshalSize += 1;                                                              // this._numberOfGridAxes
            marshalSize += 1;                                                              // this._constantGrid
            marshalSize += this._environmentType.GetMarshalledSize();                      // this._environmentType
            marshalSize += this._orientation.GetMarshalledSize();                          // this._orientation
            marshalSize += 8;                                                              // this._sampleTime
            marshalSize += 4;                                                              // this._totalValues
            marshalSize += 1;                                                              // this._vectorDimension
            marshalSize += 2;                                                              // this._padding1
            marshalSize += 1;                                                              // this._padding2
            for (int idx = 0; idx < this._gridDataList.Count; idx++)
            {
                GridAxisRecord listElement = (GridAxisRecord)this._gridDataList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<GriddedDataPdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<environmentalSimulationApplicationID>");
                this._environmentalSimulationApplicationID.Reflection(sb);
                sb.AppendLine("</environmentalSimulationApplicationID>");
                sb.AppendLine("<fieldNumber type=\"ushort\">" + this._fieldNumber.ToString(CultureInfo.InvariantCulture) + "</fieldNumber>");
                sb.AppendLine("<pduNumber type=\"ushort\">" + this._pduNumber.ToString(CultureInfo.InvariantCulture) + "</pduNumber>");
                sb.AppendLine("<pduTotal type=\"ushort\">" + this._pduTotal.ToString(CultureInfo.InvariantCulture) + "</pduTotal>");
                sb.AppendLine("<coordinateSystem type=\"ushort\">" + this._coordinateSystem.ToString(CultureInfo.InvariantCulture) + "</coordinateSystem>");
                sb.AppendLine("<gridDataList type=\"byte\">" + this._gridDataList.Count.ToString(CultureInfo.InvariantCulture) + "</gridDataList>");
                sb.AppendLine("<constantGrid type=\"byte\">" + this._constantGrid.ToString(CultureInfo.InvariantCulture) + "</constantGrid>");
                sb.AppendLine("<environmentType>");
                this._environmentType.Reflection(sb);
                sb.AppendLine("</environmentType>");
                sb.AppendLine("<orientation>");
                this._orientation.Reflection(sb);
                sb.AppendLine("</orientation>");
                sb.AppendLine("<sampleTime type=\"long\">" + this._sampleTime.ToString(CultureInfo.InvariantCulture) + "</sampleTime>");
                sb.AppendLine("<totalValues type=\"uint\">" + this._totalValues.ToString(CultureInfo.InvariantCulture) + "</totalValues>");
                sb.AppendLine("<vectorDimension type=\"byte\">" + this._vectorDimension.ToString(CultureInfo.InvariantCulture) + "</vectorDimension>");
                sb.AppendLine("<padding1 type=\"ushort\">" + this._padding1.ToString(CultureInfo.InvariantCulture) + "</padding1>");
                sb.AppendLine("<padding2 type=\"byte\">" + this._padding2.ToString(CultureInfo.InvariantCulture) + "</padding2>");
                for (int idx = 0; idx < this._gridDataList.Count; idx++)
                {
                    sb.AppendLine("<gridDataList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"GridAxisRecord\">");
                    GridAxisRecord aGridAxisRecord = (GridAxisRecord)this._gridDataList[idx];
                    aGridAxisRecord.Reflection(sb);
                    sb.AppendLine("</gridDataList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</GriddedDataPdu>");
            }
            catch (Exception e)
            {
                if (PduBase.TraceExceptions)
                {
                    Trace.WriteLine(e);
                    Trace.Flush();
                }

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._environmentalSimulationApplicationID.Unmarshal(dis);
                    this._fieldNumber      = dis.ReadUnsignedShort();
                    this._pduNumber        = dis.ReadUnsignedShort();
                    this._pduTotal         = dis.ReadUnsignedShort();
                    this._coordinateSystem = dis.ReadUnsignedShort();
                    this._numberOfGridAxes = dis.ReadUnsignedByte();
                    this._constantGrid     = dis.ReadUnsignedByte();
                    this._environmentType.Unmarshal(dis);
                    this._orientation.Unmarshal(dis);
                    this._sampleTime      = dis.ReadLong();
                    this._totalValues     = dis.ReadUnsignedInt();
                    this._vectorDimension = dis.ReadUnsignedByte();
                    this._padding1        = dis.ReadUnsignedShort();
                    this._padding2        = dis.ReadUnsignedByte();

                    for (int idx = 0; idx < this.NumberOfGridAxes; idx++)
                    {
                        GridAxisRecord anX = new GridAxisRecord();
                        anX.Unmarshal(dis);
                        this._gridDataList.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._environmentalSimulationApplicationID.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._fieldNumber);
                    dos.WriteUnsignedShort((ushort)this._pduNumber);
                    dos.WriteUnsignedShort((ushort)this._pduTotal);
                    dos.WriteUnsignedShort((ushort)this._coordinateSystem);
                    dos.WriteUnsignedByte((byte)this._gridDataList.Count);
                    dos.WriteUnsignedByte((byte)this._constantGrid);
                    this._environmentType.Marshal(dos);
                    this._orientation.Marshal(dos);
                    dos.WriteLong((long)this._sampleTime);
                    dos.WriteUnsignedInt((uint)this._totalValues);
                    dos.WriteUnsignedByte((byte)this._vectorDimension);
                    dos.WriteUnsignedShort((ushort)this._padding1);
                    dos.WriteUnsignedByte((byte)this._padding2);

                    for (int idx = 0; idx < this._gridDataList.Count; idx++)
                    {
                        GridAxisRecord aGridAxisRecord = (GridAxisRecord)this._gridDataList[idx];
                        aGridAxisRecord.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        /// <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(GridAxisRecord obj)
        {
            bool ivarsEqual = true;

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

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

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

            return(ivarsEqual);
        }
예제 #6
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(GridAxisRecord obj)
        {
            bool ivarsEqual = true;

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

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

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

            return ivarsEqual;
        }