Exemplo n.º 1
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(Vector3Float obj)
        {
            bool ivarsEqual = true;

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

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

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

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

            return(ivarsEqual);
        }
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._radioEntityType.Unmarshal(dis);
                    this._transmitState = dis.ReadUnsignedByte();
                    this._inputSource   = dis.ReadUnsignedByte();
                    this._padding1      = dis.ReadUnsignedShort();
                    this._antennaLocation.Unmarshal(dis);
                    this._relativeAntennaLocation.Unmarshal(dis);
                    this._antennaPatternType         = dis.ReadUnsignedShort();
                    this._antennaPatternCount        = dis.ReadUnsignedShort();
                    this._frequency                  = dis.ReadDouble();
                    this._transmitFrequencyBandwidth = dis.ReadFloat();
                    this._power = dis.ReadFloat();
                    this._modulationType.Unmarshal(dis);
                    this._cryptoSystem             = dis.ReadUnsignedShort();
                    this._cryptoKeyId              = dis.ReadUnsignedShort();
                    this._modulationParameterCount = dis.ReadUnsignedByte();
                    this._padding2 = dis.ReadUnsignedShort();
                    this._padding3 = dis.ReadUnsignedByte();

                    for (int idx = 0; idx < this.ModulationParameterCount; idx++)
                    {
                        Vector3Float anX = new Vector3Float();
                        anX.Unmarshal(dis);
                        this._modulationParametersList.Add(anX);
                    }

                    for (int idx = 0; idx < this.AntennaPatternCount; idx++)
                    {
                        Vector3Float anX = new Vector3Float();
                        anX.Unmarshal(dis);
                        this._antennaPatternList.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._radioEntityType.Marshal(dos);
                    dos.WriteUnsignedByte((byte)this._transmitState);
                    dos.WriteUnsignedByte((byte)this._inputSource);
                    dos.WriteUnsignedShort((ushort)this._padding1);
                    this._antennaLocation.Marshal(dos);
                    this._relativeAntennaLocation.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._antennaPatternType);
                    dos.WriteUnsignedShort((ushort)this._antennaPatternList.Count);
                    dos.WriteDouble((double)this._frequency);
                    dos.WriteFloat((float)this._transmitFrequencyBandwidth);
                    dos.WriteFloat((float)this._power);
                    this._modulationType.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._cryptoSystem);
                    dos.WriteUnsignedShort((ushort)this._cryptoKeyId);
                    dos.WriteUnsignedByte((byte)this._modulationParametersList.Count);
                    dos.WriteUnsignedShort((ushort)this._padding2);
                    dos.WriteUnsignedByte((byte)this._padding3);

                    for (int idx = 0; idx < this._modulationParametersList.Count; idx++)
                    {
                        Vector3Float aVector3Float = (Vector3Float)this._modulationParametersList[idx];
                        aVector3Float.Marshal(dos);
                    }

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._radioEntityType.GetMarshalledSize();         // this._radioEntityType
            marshalSize += 1;                                                 // this._transmitState
            marshalSize += 1;                                                 // this._inputSource
            marshalSize += 2;                                                 // this._padding1
            marshalSize += this._antennaLocation.GetMarshalledSize();         // this._antennaLocation
            marshalSize += this._relativeAntennaLocation.GetMarshalledSize(); // this._relativeAntennaLocation
            marshalSize += 2;                                                 // this._antennaPatternType
            marshalSize += 2;                                                 // this._antennaPatternCount
            marshalSize += 8;                                                 // this._frequency
            marshalSize += 4;                                                 // this._transmitFrequencyBandwidth
            marshalSize += 4;                                                 // this._power
            marshalSize += this._modulationType.GetMarshalledSize();          // this._modulationType
            marshalSize += 2;                                                 // this._cryptoSystem
            marshalSize += 2;                                                 // this._cryptoKeyId
            marshalSize += 1;                                                 // this._modulationParameterCount
            marshalSize += 2;                                                 // this._padding2
            marshalSize += 1;                                                 // this._padding3
            for (int idx = 0; idx < this._modulationParametersList.Count; idx++)
            {
                Vector3Float listElement = (Vector3Float)this._modulationParametersList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            for (int idx = 0; idx < this._antennaPatternList.Count; idx++)
            {
                Vector3Float listElement = (Vector3Float)this._antennaPatternList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
Exemplo n.º 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(Vector3Float obj)
        {
            bool ivarsEqual = true;

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

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

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

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

            return ivarsEqual;
        }
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<TransmitterPdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<radioEntityType>");
                this._radioEntityType.Reflection(sb);
                sb.AppendLine("</radioEntityType>");
                sb.AppendLine("<transmitState type=\"byte\">" + this._transmitState.ToString(CultureInfo.InvariantCulture) + "</transmitState>");
                sb.AppendLine("<inputSource type=\"byte\">" + this._inputSource.ToString(CultureInfo.InvariantCulture) + "</inputSource>");
                sb.AppendLine("<padding1 type=\"ushort\">" + this._padding1.ToString(CultureInfo.InvariantCulture) + "</padding1>");
                sb.AppendLine("<antennaLocation>");
                this._antennaLocation.Reflection(sb);
                sb.AppendLine("</antennaLocation>");
                sb.AppendLine("<relativeAntennaLocation>");
                this._relativeAntennaLocation.Reflection(sb);
                sb.AppendLine("</relativeAntennaLocation>");
                sb.AppendLine("<antennaPatternType type=\"ushort\">" + this._antennaPatternType.ToString(CultureInfo.InvariantCulture) + "</antennaPatternType>");
                sb.AppendLine("<antennaPatternList type=\"ushort\">" + this._antennaPatternList.Count.ToString(CultureInfo.InvariantCulture) + "</antennaPatternList>");
                sb.AppendLine("<frequency type=\"double\">" + this._frequency.ToString(CultureInfo.InvariantCulture) + "</frequency>");
                sb.AppendLine("<transmitFrequencyBandwidth type=\"float\">" + this._transmitFrequencyBandwidth.ToString(CultureInfo.InvariantCulture) + "</transmitFrequencyBandwidth>");
                sb.AppendLine("<power type=\"float\">" + this._power.ToString(CultureInfo.InvariantCulture) + "</power>");
                sb.AppendLine("<modulationType>");
                this._modulationType.Reflection(sb);
                sb.AppendLine("</modulationType>");
                sb.AppendLine("<cryptoSystem type=\"ushort\">" + this._cryptoSystem.ToString(CultureInfo.InvariantCulture) + "</cryptoSystem>");
                sb.AppendLine("<cryptoKeyId type=\"ushort\">" + this._cryptoKeyId.ToString(CultureInfo.InvariantCulture) + "</cryptoKeyId>");
                sb.AppendLine("<modulationParametersList type=\"byte\">" + this._modulationParametersList.Count.ToString(CultureInfo.InvariantCulture) + "</modulationParametersList>");
                sb.AppendLine("<padding2 type=\"ushort\">" + this._padding2.ToString(CultureInfo.InvariantCulture) + "</padding2>");
                sb.AppendLine("<padding3 type=\"byte\">" + this._padding3.ToString(CultureInfo.InvariantCulture) + "</padding3>");
                for (int idx = 0; idx < this._modulationParametersList.Count; idx++)
                {
                    sb.AppendLine("<modulationParametersList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"Vector3Float\">");
                    Vector3Float aVector3Float = (Vector3Float)this._modulationParametersList[idx];
                    aVector3Float.Reflection(sb);
                    sb.AppendLine("</modulationParametersList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                for (int idx = 0; idx < this._antennaPatternList.Count; idx++)
                {
                    sb.AppendLine("<antennaPatternList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"Vector3Float\">");
                    Vector3Float aVector3Float = (Vector3Float)this._antennaPatternList[idx];
                    aVector3Float.Reflection(sb);
                    sb.AppendLine("</antennaPatternList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

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

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }