getLogLevel() public static méthode

Get the log level.
public static getLogLevel ( ) : MamaLogLevel
Résultat MamaLogLevel
Exemple #1
0
        /// <summary>
        /// This function will store the supplied wrapper and return an object
        /// that can be passed into the native layer as a closure.
        /// This should then be passed to the RemoveWrapper function to access
        /// the object whenever the native callback is invoked.
        /// </summary>
        /// <param name="wrapper">
        /// The wrapper object to store.
        /// </param>
        /// <returns>
        /// The handle that can be passed to the native layer.
        /// </returns>
        internal IntPtr StoreWrapper(MamaCallbackWrapper <TCallback, TDelegate> wrapper)
        {
            // Returns
            long ret = 0;

            // Acquire the mutex
            mStoreMutex.WaitOne();
            try
            {
                // Get the next Id
                mNextId++;

                // This will become the handle
                ret = mNextId;

                // Add the wrapper to the store using the Id as the key
                mStore.Add(ret, wrapper);
            }

            finally
            {
                // Release the mutex
                mStoreMutex.ReleaseMutex();
            }

            // Write a log
            if (MamaLogLevel.MAMA_LOG_LEVEL_FINEST == Mama.getLogLevel())
            {
                // Write details of the object that has bee added
                string message = string.Format("MamaCallbackStore: Wrapper stored for key {0} for callback {1}.", ret, wrapper.Callback.ToString());
                Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINEST, message);

                // Write the number of items
                message = string.Format("MamaCallbackStore: Store now contains {0} items.", mStore.Count);
                Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINEST, message);
            }

            /* Return the next Id as the handle. */
            return(new IntPtr(ret));
        }
Exemple #2
0
        /// <summary>
        /// This function will remove a wrapper object from the store and return it
        /// to the caller. This object should then be disposed by the caller.
        /// </summary>
        /// <param name="handle">
        /// Handle returned from the StoreWrapper function.
        /// </param>
        /// <returns>
        /// The callback wrapper associated with the supplied handle.
        /// </returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Thrown if the corresponding wrapper is not in the store.
        /// </exception>
        internal MamaCallbackWrapper <TCallback, TDelegate> RemoveWrapper(IntPtr handle)
        {
            // Returns
            MamaCallbackWrapper <TCallback, TDelegate> ret = null;

            // The object handle is the key
            long key = handle.ToInt64();

            // Acquire the mutex
            mStoreMutex.WaitOne();
            try
            {
                // Get the wrapper from the store
                ret = mStore[key];

                // Remove the object from the store
                mStore.Remove(key);
            }

            finally
            {
                // Release the mutex
                mStoreMutex.ReleaseMutex();
            }

            // Write a log
            if (MamaLogLevel.MAMA_LOG_LEVEL_FINEST == Mama.getLogLevel())
            {
                // Write details of the object that has been removed
                string message = string.Format("MamaCallbackStore: Wrapper removed for key {0} for callback {1}.", key, ret.Callback.ToString());
                Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINEST, message);

                // Write the number of items
                message = string.Format("MamaCallbackStore: Store now contains {0} items.", mStore.Count);
                Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINEST, message);
            }

            return(ret);
        }