コード例 #1
0
 public void Dispose()
 {
     m_Mode                  = CallbackMode.Unassigned;
     m_CallbackNoArgs        = null;
     m_CallbackNativeArg     = null;
     m_CallbackWithCastedArg = null;
     m_CastedArgInvoker      = null;
 }
コード例 #2
0
        public void Set(Action inAction)
        {
            if (inAction == null)
            {
                throw new ArgumentNullException("inAction");
            }

            m_Mode = CallbackMode.NoArg;
            m_CallbackNativeArg     = null;
            m_CallbackWithCastedArg = null;
            m_CastedArgInvoker      = null;
            m_CallbackNoArgs        = inAction;
        }
コード例 #3
0
        private CastableAction(Action <T> inAction)
        {
            if (inAction == null)
            {
                throw new ArgumentNullException("inAction");
            }

            m_Mode = CallbackMode.NativeArg;
            m_CallbackNativeArg     = inAction;
            m_CallbackWithCastedArg = null;
            m_CastedArgInvoker      = null;
            m_CallbackNoArgs        = null;
        }
コード例 #4
0
        public void Set <U>(Action <U> inAction)
        {
            if (inAction == null)
            {
                throw new ArgumentNullException("inAction");
            }

            m_Mode = CallbackMode.CastedArg;
            m_CallbackNativeArg     = null;
            m_CallbackWithCastedArg = inAction;
            m_CastedArgInvoker      = CastedActionInvoker <U> .Invoker;
            m_CallbackNoArgs        = null;
        }
コード例 #5
0
        public void Set(Func <TOutput> inFunc)
        {
            if (inFunc == null)
            {
                throw new ArgumentNullException("inFunc");
            }

            m_Mode = CallbackMode.NoArg;
            m_CallbackNativeArg     = null;
            m_CallbackWithCastedArg = null;
            m_CastedArgInvoker      = null;
            m_CallbackNoArgs        = inFunc;
        }
コード例 #6
0
        private CastableFunc(Func <TInput, TOutput> inFunc)
        {
            if (inFunc == null)
            {
                throw new ArgumentNullException("inFunc");
            }

            m_Mode = CallbackMode.NativeArg;
            m_CallbackNativeArg     = inFunc;
            m_CallbackWithCastedArg = null;
            m_CastedArgInvoker      = null;
            m_CallbackNoArgs        = null;
        }
コード例 #7
0
        public void Set <U>(Func <U, TOutput> inFunc)
        {
            if (inFunc == null)
            {
                throw new ArgumentNullException("inFunc");
            }

            m_Mode = CallbackMode.CastedArg;
            m_CallbackNativeArg     = null;
            m_CallbackWithCastedArg = inFunc;
            m_CastedArgInvoker      = CastedFuncInvoker <U, TOutput> .Invoker;
            m_CallbackNoArgs        = null;
        }
コード例 #8
0
        private CastableAction(MulticastDelegate inCastedDelegate, CastedAction inCastedInvoker)
        {
            if (inCastedDelegate == null)
            {
                throw new ArgumentNullException("inCastedDelegate");
            }
            if (inCastedInvoker == null)
            {
                throw new ArgumentNullException("inCastedInvoker");
            }

            m_Mode = CallbackMode.CastedArg;
            m_CallbackNativeArg     = null;
            m_CallbackWithCastedArg = inCastedDelegate;
            m_CastedArgInvoker      = inCastedInvoker;
            m_CallbackNoArgs        = null;
        }
コード例 #9
0
        internal override object ProcessReply(ref RedisResult result, out CallbackMode callbackMode)
        {
            RedisResult[] subItems;
            if (!result.IsError && (subItems = result.ValueItems) != null)
            {
                // detect "message" and "pmessage" and don't dequeue for those
                switch (subItems.Length)
                {
                case 3:     // special-case message
                    if (subItems[0].IsMatch(message))
                    {
                        callbackMode = CallbackMode.Continuation;     // events are a lot like continuations
                        return(null);
                    }
                    break;

                case 4:     // special-case pmessage
                    if (subItems[0].IsMatch(pmessage))
                    {
                        callbackMode = CallbackMode.Continuation;     // events are a lot like continuations
                        return(null);
                    }
                    break;
                }
            }

            var next = PeekSent(false) as IMultiReplyMessage;

            if (next == null || next.Consume())
            {
                return(base.ProcessReply(ref result, out callbackMode));
            }
            // if we get here, we are dealing with a multi-reply message that is not yet satisfied; do nothing
            callbackMode = CallbackMode.SyncUnchecked; // won't actually be doing anything
            return(null);
        }