示例#1
0
        /// <summary>
        /// Overridden by subclasses to build an equivalence test chain.
        /// </summary>
        protected override bool IsEquivalent(Cell other, Fingerprint fingerprint)
        {
            if (!base.IsEquivalent(other, fingerprint))
            {
                return(false);
            }
            Event o       = (Event)other;
            var   touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                if (_handle != o._handle)
                {
                    return(false);
                }
            }
            if (touched[1])
            {
                if (_waitHandle != o._waitHandle)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        protected override bool IsEquivalent(Cell other, Fingerprint fingerprint)
        {
            if (!base.IsEquivalent(other, fingerprint))
            {
                return(false);
            }
            PeriodicEvent o       = (PeriodicEvent)other;
            var           touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                if (key_ != o.key_)
                {
                    return(false);
                }
            }
            if (touched[1])
            {
                if (intParam_ != o.intParam_)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
        protected override bool IsEquivalent(Cell other, Fingerprint fingerprint)
        {
            if (!base.IsEquivalent(other, fingerprint))
            {
                return(false);
            }
            LinkSessionDisconnected o = (LinkSessionDisconnected)other;
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                if (linkName_ != o.linkName_)
                {
                    return(false);
                }
            }
            if (touched[1])
            {
                if (handle_ != o.handle_)
                {
                    return(false);
                }
            }
            if (touched[2])
            {
                if (context_ != o.context_)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#4
0
        public override int GetHashCode(Fingerprint fingerprint)
        {
            var hash = new Hash(base.GetHashCode(fingerprint));

            if (fingerprint.Length <= tag.Offset)
            {
                return(hash.Code);
            }
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                hash.Update(tag.Offset + 0);
                hash.Update(linkName_);
            }
            if (touched[1])
            {
                hash.Update(tag.Offset + 1);
                hash.Update(handle_);
            }
            if (touched[2])
            {
                hash.Update(tag.Offset + 2);
                hash.Update(context_);
            }
            return(hash.Code);
        }
示例#5
0
        /// <summary>
        /// Overridden by subclasses to build a deserialization chain.
        /// </summary>
        public override void Deserialize(Deserializer deserializer)
        {
            base.Deserialize(deserializer);
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[1])
            {
                deserializer.Read(out _waitHandle);
            }
        }
示例#6
0
        /// <summary>
        /// Overridden by subclasses to build a serialization chain.
        /// </summary>
        public override void Serialize(Serializer serializer,
                                       Type targetType, ref bool flag)
        {
            base.Serialize(serializer, targetType, ref flag);
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[1])
            {
                serializer.Write(_waitHandle);
            }
            if (targetType != null && targetType == typeof(Event))
            {
                flag = false;
            }
        }
示例#7
0
        /// <summary>
        /// Overridden by subclasses to build an encoded length computation chain.
        /// </summary>
        public override int GetLength(Type targetType, ref bool flag)
        {
            int length  = base.GetLength(targetType, ref flag);
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[1])
            {
                length += Serializer.GetLength(_waitHandle);
            }
            if (targetType != null && targetType == typeof(Event))
            {
                flag = false;
            }
            return(length);
        }
示例#8
0
        /// <summary>
        /// Overridden by subclasses to build a hash code generator chain.
        /// </summary>
        public override int GetHashCode(Fingerprint fingerprint)
        {
            Hash hash    = new Hash(base.GetHashCode(fingerprint));
            var  touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                hash.Update(tag.Offset + 0);
                hash.Update(_handle);
            }
            if (touched[1])
            {
                hash.Update(tag.Offset + 1);
                hash.Update(_waitHandle);
            }
            return(hash.Code);
        }
示例#9
0
        public override int GetHashCode(Fingerprint fingerprint)
        {
            var hash = new Hash(base.GetHashCode(fingerprint));

            if (fingerprint.Length <= tag.Offset)
            {
                return(hash.Code);
            }
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                hash.Update(tag.Offset + 0);
                hash.Update(result_);
            }
            return(hash.Code);
        }
示例#10
0
        protected override bool IsEquivalent(Cell other, Fingerprint fingerprint)
        {
            if (!base.IsEquivalent(other, fingerprint))
            {
                return(false);
            }
            HandshakeAck o       = (HandshakeAck)other;
            var          touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                if (result_ != o.result_)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#11
0
        protected override bool IsEquivalent(Cell other, Fingerprint fingerprint)
        {
            if (!base.IsEquivalent(other, fingerprint))
            {
                return(false);
            }
            HandshakeResp o       = (HandshakeResp)other;
            var           touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                if (!data_.EqualsEx(o.data_))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#12
0
        public override void Serialize(Serializer serializer,
                                       Type targetType, ref bool flag)
        {
            base.Serialize(serializer, targetType, ref flag);
            if (!flag)
            {
                return;
            }
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                serializer.Write(result_);
            }
            if (targetType != null && targetType == typeof(HandshakeAck))
            {
                flag = false;
            }
        }
示例#13
0
        public override int GetLength(Type targetType, ref bool flag)
        {
            int length = base.GetLength(targetType, ref flag);

            if (!flag)
            {
                return(length);
            }
            var touched = new Capo <bool>(fingerprint, tag.Offset);

            if (touched[0])
            {
                length += Serializer.GetLength(result_);
            }
            if (targetType != null && targetType == typeof(HandshakeAck))
            {
                flag = false;
            }
            return(length);
        }