File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ namespace Oxide . Pooling
2+ {
3+ /// <inheritdoc cref="IPoolProvider"/>
4+ /// <typeparam name="T">The item type this pool manages</typeparam>
5+ public interface IArrayPoolProvider < out T > : IPoolProvider < T [ ] >
6+ {
7+ /// <summary>
8+ /// Takes a single <see cref="T"/> array from this pool
9+ /// </summary>
10+ /// <param name="length"></param>
11+ /// <returns><see cref="T"/>[]</returns>
12+ T [ ] Take ( int length ) ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace Oxide . Pooling
4+ {
5+ /// <summary>
6+ /// A factory interface used for managing registered <see cref="IPoolProvider"/>'s
7+ /// </summary>
8+ public interface IPoolFactory
9+ {
10+ /// <summary>
11+ /// Get the pooling provider for a specific type
12+ /// </summary>
13+ /// <typeparam name="T">The handled type</typeparam>
14+ /// <returns>The <see cref="IPoolProvider"/> that handles the requested type</returns>
15+ IPoolProvider < T > GetProvider < T > ( ) ;
16+
17+ /// <summary>
18+ /// Check if this factory has registered <see cref="IPoolProvider"/> for a type
19+ /// </summary>
20+ /// <typeparam name="T">The type to check for</typeparam>
21+ /// <returns>Will return true if a <see cref="IPoolProvider"/> is registered</returns>
22+ bool IsHandledType < T > ( ) ;
23+
24+ /// <summary>
25+ /// Registers a <see cref="IPoolProvider"/> with this factory
26+ /// </summary>
27+ /// <param name="provider">The created provider</param>
28+ /// <param name="args">Additional parameters used to instantiate the <see cref="IPoolProvider"/></param>
29+ /// <typeparam name="TProvider">The <see cref="IPoolProvider"/></typeparam>
30+ /// <returns>A disposable object that will unregister the <see cref="IPoolProvider"/> when disposed</returns>
31+ IDisposable RegisterProvider < TProvider > ( out TProvider provider , params object [ ] args ) where TProvider : IPoolProvider ;
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ namespace Oxide . Pooling
2+ {
3+ /// <summary>
4+ /// A interface used for managing pooled items
5+ /// </summary>
6+ public interface IPoolProvider
7+ {
8+ /// <summary>
9+ /// Returns a item to the pool
10+ /// </summary>
11+ /// <param name="item">The item to return</param>
12+ void Return ( object item ) ;
13+ }
14+
15+ /// <inheritdoc cref="IPoolProvider"/>
16+ /// <typeparam name="T">The item type this pool manages</typeparam>
17+ public interface IPoolProvider < out T > : IPoolProvider
18+ {
19+ /// <summary>
20+ /// Takes a single <see cref="T"/> from this pool
21+ /// </summary>
22+ /// <returns><see cref="T"/></returns>
23+ T Take ( ) ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments