Пример #1
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<GridAxisRecordRepresentation2>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<dataValues type=\"ushort\">" + this._dataValues.Count.ToString(CultureInfo.InvariantCulture) + "</dataValues>");
                for (int idx = 0; idx < this._dataValues.Count; idx++)
                {
                    sb.AppendLine("<dataValues" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"FourByteChunk\">");
                    FourByteChunk aFourByteChunk = (FourByteChunk)this._dataValues[idx];
                    aFourByteChunk.Reflection(sb);
                    sb.AppendLine("</dataValues" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

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

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }
Пример #2
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(FourByteChunk obj)
        {
            bool ivarsEqual = true;

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

            if (obj._otherParameters.Length != 4)
            {
                ivarsEqual = false;
            }

            if (ivarsEqual)
            {
                for (int idx = 0; idx < 4; idx++)
                {
                    if (this._otherParameters[idx] != obj._otherParameters[idx])
                    {
                        ivarsEqual = false;
                    }
                }
            }

            return(ivarsEqual);
        }
Пример #3
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._numberOfValues = dis.ReadUnsignedShort();

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Пример #4
0
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    dos.WriteUnsignedShort((ushort)this._dataValues.Count);

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Пример #5
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += 2;  // this._numberOfValues
            for (int idx = 0; idx < this._dataValues.Count; idx++)
            {
                FourByteChunk listElement = (FourByteChunk)this._dataValues[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

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

            marshalSize  = base.GetMarshalledSize();
            marshalSize += 4;  // this._requestID
            marshalSize += 1;  // this._requiredReliabilityService
            marshalSize += 2;  // this._pad1
            marshalSize += 1;  // this._pad2
            marshalSize += 2;  // this._eventType
            marshalSize += 4;  // this._time
            marshalSize += 4;  // this._numberOfRecords
            for (int idx = 0; idx < this._recordIDs.Count; idx++)
            {
                FourByteChunk listElement = (FourByteChunk)this._recordIDs[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

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

            if (dis != null)
            {
                try
                {
                    this._requestID = dis.ReadUnsignedInt();
                    this._requiredReliabilityService = dis.ReadUnsignedByte();
                    this._pad1            = dis.ReadUnsignedShort();
                    this._pad2            = dis.ReadUnsignedByte();
                    this._eventType       = dis.ReadUnsignedShort();
                    this._time            = dis.ReadUnsignedInt();
                    this._numberOfRecords = dis.ReadUnsignedInt();

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<RecordQueryReliablePdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<requestID type=\"uint\">" + this._requestID.ToString(CultureInfo.InvariantCulture) + "</requestID>");
                sb.AppendLine("<requiredReliabilityService type=\"byte\">" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + "</requiredReliabilityService>");
                sb.AppendLine("<pad1 type=\"ushort\">" + this._pad1.ToString(CultureInfo.InvariantCulture) + "</pad1>");
                sb.AppendLine("<pad2 type=\"byte\">" + this._pad2.ToString(CultureInfo.InvariantCulture) + "</pad2>");
                sb.AppendLine("<eventType type=\"ushort\">" + this._eventType.ToString(CultureInfo.InvariantCulture) + "</eventType>");
                sb.AppendLine("<time type=\"uint\">" + this._time.ToString(CultureInfo.InvariantCulture) + "</time>");
                sb.AppendLine("<recordIDs type=\"uint\">" + this._recordIDs.Count.ToString(CultureInfo.InvariantCulture) + "</recordIDs>");
                for (int idx = 0; idx < this._recordIDs.Count; idx++)
                {
                    sb.AppendLine("<recordIDs" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"FourByteChunk\">");
                    FourByteChunk aFourByteChunk = (FourByteChunk)this._recordIDs[idx];
                    aFourByteChunk.Reflection(sb);
                    sb.AppendLine("</recordIDs" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</RecordQueryReliablePdu>");
            }
            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
                {
                    dos.WriteUnsignedInt((uint)this._requestID);
                    dos.WriteUnsignedByte((byte)this._requiredReliabilityService);
                    dos.WriteUnsignedShort((ushort)this._pad1);
                    dos.WriteUnsignedByte((byte)this._pad2);
                    dos.WriteUnsignedShort((ushort)this._eventType);
                    dos.WriteUnsignedInt((uint)this._time);
                    dos.WriteUnsignedInt((uint)this._recordIDs.Count);

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

                    this.RaiseExceptionOccured(e);

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