/// <summary>
        /// CreateMemory creates the memory collection type based on the MEMTYPE parameter.
        /// </summary>
        /// <param name="type">Specifies the memory collection type to create.</param>
        /// <param name="nMax">Specifies the maximum count for the memory collection.</param>
        /// <param name="fAlpha">Specifies the alpha value used with prioritized memory collections.</param>
        /// <param name="strFile">Specifies the input/output file used with save and load memory collections.</param>
        /// <returns>The IMemoryCollection interface implemented by the memory collection created is returned.</returns>
        public static IMemoryCollection CreateMemory(MEMTYPE type, int nMax, float fAlpha = 0, string strFile = null)
        {
            switch (type)
            {
            case MEMTYPE.LOADING:
                if (string.IsNullOrEmpty(strFile))
                {
                    throw new Exception("You must specify a file.");
                }
                return(new FileMemoryCollection(nMax, true, false, strFile));

            case MEMTYPE.SAVING:
                if (string.IsNullOrEmpty(strFile))
                {
                    throw new Exception("You must specify a file.");
                }
                return(new FileMemoryCollection(nMax, false, true, strFile));

            case MEMTYPE.PRIORITY:
                return(new PrioritizedMemoryCollection(nMax, fAlpha));

            default:
                return(new RandomMemoryCollection(nMax));
            }
        }
Esempio n. 2
0
 public static bool sqlite3MemdebugNoType <T>(T X, MEMTYPE Y)
 {
     return(true);
 }
Esempio n. 3
0
        //public static void sqlite3MemdebugSetType<T>(T X, MEMTYPE Y);
        //public static bool sqlite3MemdebugHasType<T>(T X, MEMTYPE Y);
        //public static bool sqlite3MemdebugNoType<T>(T X, MEMTYPE Y);
#else
        public static void sqlite3MemdebugSetType <T>(T X, MEMTYPE Y)
        {
        }