Ejemplo n.º 1
0
 public bool HasFlags(
     ResultFlags hasFlags,
     bool all
     )
 {
     return(FlagOps.HasFlags(flags, hasFlags, all));
 }
Ejemplo n.º 2
0
 public ReadRangeAck(ObjectIdentifier objectIdentifier, PropertyIdentifier propertyIdentifier,
                     UnsignedInteger propertyArrayIndex, ResultFlags resultFlags, UnsignedInteger itemCount,
                     SequenceOf itemData, UnsignedInteger firstSequenceNumber)
 {
     ObjectIdentifier    = objectIdentifier;
     PropertyIdentifier  = propertyIdentifier;
     PropertyArrayIndex  = propertyArrayIndex;
     ResultFlags         = resultFlags;
     ItemCount           = itemCount;
     ItemData            = itemData;
     FirstSequenceNumber = firstSequenceNumber;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of <see cref="ReadResult"/> setting <see cref="IsCanceled"/> and <see cref="IsCompleted"/> flags.
        /// </summary>
        public ReadResult(ReadOnlySequence <byte> buffer, bool isCanceled, bool isCompleted)
        {
            _resultBuffer = buffer;
            _resultFlags  = ResultFlags.None;

            if (isCompleted)
            {
                _resultFlags |= ResultFlags.Completed;
            }
            if (isCanceled)
            {
                _resultFlags |= ResultFlags.Canceled;
            }
        }
Ejemplo n.º 4
0
        public ReadResult(ReadableBuffer buffer, bool isCancelled, bool isCompleted)
        {
            ResultBuffer = buffer;
            ResultFlags  = ResultFlags.None;

            if (isCompleted)
            {
                ResultFlags |= ResultFlags.Completed;
            }
            if (isCancelled)
            {
                ResultFlags |= ResultFlags.Cancelled;
            }
        }
        /// <summary>
        /// Creates a new instance of <see cref="FlushResult"/> setting <see cref="IsCanceled"/> and <see cref="IsCompleted"/> flags
        /// </summary>
        public FlushResult(bool isCanceled, bool isCompleted)
        {
            _resultFlags = ResultFlags.None;

            if (isCanceled)
            {
                _resultFlags |= ResultFlags.Canceled;
            }

            if (isCompleted)
            {
                _resultFlags |= ResultFlags.Completed;
            }
        }
Ejemplo n.º 6
0
 public ResultFlags SetFlags(
     ResultFlags flags,
     bool set
     )
 {
     if (set)
     {
         return(this.flags |= flags);
     }
     else
     {
         return(this.flags &= ~flags);
     }
 }
Ejemplo n.º 7
0
        ///////////////////////////////////////////////////////////////////////

        public static bool HasFlags(
            ResultFlags flags,
            ResultFlags hasFlags,
            bool all
            )
        {
            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != ResultFlags.None);
            }
        }
Ejemplo n.º 8
0
        public void Clear()
        {
            //
            // NOTE: Clear the error information only.
            //
            returnCode         = ReturnCode.Ok;
            previousReturnCode = ReturnCode.Ok;

            errorLine = 0;
            errorCode = null;
            errorInfo = null;

            exception = null;

            flags &= ~ResultFlags.Error; // we cleared error info.
        }
Ejemplo n.º 9
0
        public bool Save(
            Interpreter interpreter
            )
        {
            if (interpreter != null)
            {
                returnCode         = interpreter.ReturnCode;
                previousReturnCode = returnCode;

                errorLine = interpreter.ErrorLine; /* EXEMPT */
                errorCode = interpreter.ErrorCode;
                errorInfo = interpreter.ErrorInfo;

                flags |= ResultFlags.Error; // we now have error info.

                return(true);
            }

            return(false);
        }
Ejemplo n.º 10
0
        public void Reset(
            bool full
            )
        {
            //
            // NOTE: If we are doing a "full" reset then clear
            //       all the error information as well.
            //
            if (full)
            {
                Clear();
            }

            //
            // NOTE: For this object, we always null out the fields (i.e. the
            //       NoValue and NoClientData constants are defined to be null)
            //       because:
            //
            //       1. Typical usage of this method would be to recycle this
            //          object for use in an object pool, which really requires
            //          totally cleaned out (null) field values.
            //
            //       2. The existing semantics of this object do not offer any
            //          kind of guarantee that an uninitialized instance will
            //          convert to an empty string (unlike the Argument object).
            //
            value      = NoValue;
            clientData = NoClientData;

            //
            // NOTE: We no longer have a string result.
            //
            flags &= ~ResultFlags.String;

#if CACHE_RESULT_TOSTRING
            //
            // NOTE: We no longer have a cached string representation.
            //
            @string = null;
#endif
        }