예제 #1
0
        public virtual void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<VariableDatum>");
            try
            {
                sb.AppendLine("<variableDatumID type=\"uint\">" + this._variableDatumID.ToString(CultureInfo.InvariantCulture) + "</variableDatumID>");
                sb.AppendLine("<variableDatums type=\"uint\">" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + "</variableDatums>");
                for (int idx = 0; idx < this._variableDatums.Count; idx++)
                {
                    sb.AppendLine("<variableDatums" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"EightByteChunk\">");
                    EightByteChunk aEightByteChunk = (EightByteChunk)this._variableDatums[idx];
                    aEightByteChunk.Reflection(sb);
                    sb.AppendLine("</variableDatums" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

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

                this.RaiseExceptionOccured(e);

                if (PduBase.ThrowExceptions)
                {
                    throw e;
                }
            }
        }
예제 #2
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._variableDatumID     = dis.ReadUnsignedInt();
                    this._variableDatumLength = dis.ReadUnsignedInt();

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #3
0
        public virtual void Marshal(DataOutputStream dos)
        {
            if (dos != null)
            {
                try
                {
                    dos.WriteUnsignedInt((uint)this._variableDatumID);
                    dos.WriteUnsignedInt((uint)this._variableDatums.Count);

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

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #4
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(EightByteChunk obj)
        {
            bool ivarsEqual = true;

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

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

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

            return(ivarsEqual);
        }
예제 #5
0
        public virtual int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize += 4;  // this._variableDatumID
            marshalSize += 4;  // this._variableDatumLength
            for (int idx = 0; idx < this._variableDatums.Count; idx++)
            {
                EightByteChunk listElement = (EightByteChunk)this._variableDatums[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }