예제 #1
0
            public static int ForwardEvent(MamaQueueEventCallback callback, object closure, IntPtr nativeHandle, MamaQueue sender)
            {
                // Create a new forwarder object to manage the .Net callback objects
                EnqueueEventForwarder forwarder = new EnqueueEventForwarder(callback, closure, sender);

                /* Invoke the native method, the index into the array will be passed as the clousure.
                 */
                return(NativeMethods.mamaQueue_enqueueEvent(nativeHandle, forwarder.NativeCallback, new IntPtr(forwarder.mIndex)));
            }
예제 #2
0
            /// <summary>
            /// Constructor initialises all member variables.
            /// </summary>
            /// <param name="callback">
            /// The callback object that will be invoked whenever an event is processed.
            /// </param>
            /// <param name="closure">
            /// Utility object.
            /// </param>
            /// <param name="sender">
            /// The queue.
            /// </param>
            public EnqueueEventForwarder(MamaQueueEventCallback callback, object closure, MamaQueue sender)
            {
                // Save arguments in member variables.
                mCallback = callback;
                mClosure  = closure;
                mSender   = sender;

                // Save a reference to this object in the static list
                mIndex = AddForwarder(this);
            }
예제 #3
0
        /// <summary>
        /// This function will enqueue an event on the mama queue.
        /// </summary>
        /// <param name="callback">
        /// This callback will be invoked by the thread pumping the queue.
        /// </param>
        /// <param name="closure">
        /// Utility object that will be passed back to the callback.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the callback object is null.
        /// </exception>
        public void enqueueEvent(MamaQueueEventCallback callback, object closure)
        {
            // Verify that the callback object has been supplied
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            // Make sure the queue has been created
            EnsurePeerCreated();

            // Create a new forwarder object to manage the .Net callback objects
            int code = EnqueueEventForwarder.ForwardEvent(callback, closure, nativeHandle, this);

            // Chek that the return code
            CheckResultCode(code);
        }
예제 #4
0
파일: MamaQueue.cs 프로젝트: jacobraj/MAMA
            public static int ForwardEvent(MamaQueueEventCallback callback, object closure, IntPtr nativeHandle, MamaQueue sender)
            {
                // Create a new forwarder object to manage the .Net callback objects
                EnqueueEventForwarder forwarder = new EnqueueEventForwarder(callback, closure, sender);

                /* Invoke the native method, the index into the array will be passed as the clousure.
                 */
                return NativeMethods.mamaQueue_enqueueEvent(nativeHandle, forwarder.NativeCallback, new IntPtr(forwarder.mIndex));
            }
예제 #5
0
파일: MamaQueue.cs 프로젝트: jacobraj/MAMA
            /// <summary>
            /// Constructor initialises all member variables.
            /// </summary>
            /// <param name="callback">
            /// The callback object that will be invoked whenever an event is processed.
            /// </param>            
            /// <param name="closure">
            /// Utility object.
            /// </param>
            /// <param name="sender">
            /// The queue.
            /// </param>
            public EnqueueEventForwarder(MamaQueueEventCallback callback, object closure, MamaQueue sender) 
			{
                // Save arguments in member variables.
                mCallback  = callback;
                mClosure   = closure;                
				mSender    = sender;

                // Save a reference to this object in the static list
                mIndex = AddForwarder(this);
            }
예제 #6
0
파일: MamaQueue.cs 프로젝트: jacobraj/MAMA
		/// <summary>
        /// This function will enqueue an event on the mama queue.
        /// </summary>
        /// <param name="callback">
        /// This callback will be invoked by the thread pumping the queue.
        /// </param>
        /// <param name="closure">
        /// Utility object that will be passed back to the callback.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the callback object is null.
        /// </exception>
        public void enqueueEvent(MamaQueueEventCallback callback, object closure)
        {
            // Verify that the callback object has been supplied
            if(callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            // Make sure the queue has been created
            EnsurePeerCreated();

            // Create a new forwarder object to manage the .Net callback objects
            int code = EnqueueEventForwarder.ForwardEvent(callback, closure, nativeHandle, this);

            // Chek that the return code
            CheckResultCode(code);
        }