public Multi(int[] bufferSizes, int[] cacheSizes, bool clear = true, IAllocEvents allocEvents = null, IAllocEvents cacheEvents = null) { if (bufferSizes == null || bufferSizes.Length <= 0) { throw new ArgumentException("Buffer sizes array is null or empty", nameof(bufferSizes)); } if (cacheSizes == null || cacheSizes.Length <= 0) { throw new ArgumentException("Cache sizes array is null or empty", nameof(bufferSizes)); } if (bufferSizes.Length != cacheSizes.Length) { throw new ArgumentException("Cache sizes array length must match Buffer sizes array length", nameof(cacheSizes)); } if (bufferSizes.Distinct().Count() != bufferSizes.Length) { throw new ArgumentException("Duplicated Buffer sizes are not allowed", nameof(bufferSizes)); } _managers = Enumerable.Range(0, bufferSizes.Length - 1) .Select(i => new Standard <T>(clear, bufferSizes[i], allocEvents, cacheEvents, cacheSizes[i])) .OrderBy(m => m.BufferSize) .ToArray(); _bufferSizes = _managers.Select(m => m.BufferSize).ToArray(); }
public Standard(bool clear = true, int bufferSize = DefaultBufferSize, IAllocEvents allocEvents = null, IAllocEvents cacheEvents = null, int cacheSize = DefaultCacheSize) { if (bufferSize <= 0) { throw new ArgumentException("Buffer size must be bigger than 0", nameof(bufferSize)); } _standard = new StandardInternal <IntPtr>(new UnmanagedAllocator(), clear, bufferSize, cacheSize, allocEvents, cacheEvents); }
public Standard(bool clear = true, IAllocEvents allocEvents = null, IAllocEvents cacheEvents = null, int cacheSize = DefaultCacheSize) : this(clear, GetBufferSize(), allocEvents, cacheEvents, cacheSize) { }
public Simple(IAllocEvents allocEvents = null) { _events = allocEvents; }
internal BuffersHashSet(int bufferSize, IAllocEvents events) { _bufferSize = bufferSize; _events = events; }
public StandardInternal(IAllocator <T> allocator, bool clear, int bufferSize, int cacheSize, IAllocEvents allocEvents, IAllocEvents cacheEvents) { if (bufferSize <= 0) { throw new ArgumentException("Buffer size must be bigger than 0", nameof(bufferSize)); } _allocator = allocator; _clear = clear; _bufferSize = bufferSize; _buffers = new BuffersHashSet <T>(bufferSize, allocEvents); _cache = new BuffersStack <T>(bufferSize, cacheEvents, cacheSize); }
internal BuffersStack(int bufferSize, IAllocEvents events, int maxSize) { _bufferSize = bufferSize; _events = events; _maxCount = maxSize / bufferSize; }
public Simple(bool clear = true, IAllocEvents allocEvents = null) { _clear = clear; _events = allocEvents; }