Interface IManagedPool
An interface describing the functionality needed for a pool to be understood by ManagedPools.
Namespace: GDX.Collections.Pooling
Syntax
public interface IManagedPool
Methods
| Improve this Doc View SourceCreateItem()
Create a pooled item and add it to the IManagedPool.
Declaration
void CreateItem()
ForceRemove(Object)
Remove an item from an IManagedPool immediately, removing it from tracking and
not calling any actions on it.
Declaration
void ForceRemove(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | item | The target System.Object to attempt to remove. |
Get(Boolean)
Get the next available item from an IManagedPool.
Declaration
object Get(bool triggerOnSpawnedFromPool = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | triggerOnSpawnedFromPool |
Returns
| Type | Description |
|---|---|
| System.Object | An item if available, otherwise null. |
GetBaseObject()
Return the System.Object which the pool is built from.
Declaration
object GetBaseObject()
Returns
| Type | Description |
|---|---|
| System.Object | The System.Object the IManagedPool is modelled around. |
GetKey()
Get the unique identifier for the IManagedPool.
Declaration
uint GetKey()
Returns
| Type | Description |
|---|---|
| System.UInt32 | A unique identifier. |
HasMinimumPooledItems()
Does the IManagedPool contain the minimum number of items.
Declaration
bool HasMinimumPooledItems()
Returns
| Type | Description |
|---|---|
| System.Boolean | true/false if enough items are found contained in the IManagedPool. |
IsAllowedManagedTearDown()
Should theIManagedPool destroy itself when ManagedPools requests a tear down?
Declaration
bool IsAllowedManagedTearDown()
Returns
| Type | Description |
|---|---|
| System.Boolean | true/false if flagged to allow for managed tear down / clean up. |
IsManaged(Object)
Is the item managed by this IManagedPool?
Declaration
bool IsManaged(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | item | The System.Object to evaluate. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true/false if the |
IsPooled(Object)
Is the provided item found in the IManagedPool's internal available pool of
objects?
Declaration
bool IsPooled(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | item | The |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Return(Object)
Return the item to the IManagedPool's internal collection.
Declaration
void Return(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | item | The |
ReturnAll(Boolean)
Return all spawned System.Objects to the IManagedPool.
Declaration
void ReturnAll(bool shouldShrink = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | shouldShrink | Should the IManagedPool be shrunk to its original maximum size? |
Remarks
Shrinking the pools helps with pools that have grown out of necessity past their maximum size
TearDown()
Destroy all System.Objects associated with the IManagedPool.
Declaration
void TearDown()