Search Results for

    Show / Hide Table of Contents

    Class SimpleListManagedPool

    A System.Object SimpleList<T> backed pool implementation.

    Inheritance
    System.Object
    SimpleListManagedPool
    Implements
    IManagedPool
    Namespace: GDX.Collections.Pooling
    Syntax
    public sealed class SimpleListManagedPool : IManagedPool

    Constructors

    | Improve this Doc View Source

    SimpleListManagedPool(Object, Func<SimpleListManagedPool, Object>, Int32, Int32, Object, Boolean, Boolean, Boolean, Boolean)

    Create a SimpleListManagedPool.

    Declaration
    public SimpleListManagedPool(object baseObject, Func<SimpleListManagedPool, object> createItemFunc, int minimumObjects = 10, int maximumObjects = 50, object containerObject = null, bool prewarmPool = true, bool allowCreateMore = true, bool allowReuseWhenCapped = false, bool allowManagedTearDown = false)
    Parameters
    Type Name Description
    System.Object baseObject

    The object which going to be cloned.

    System.Func<SimpleListManagedPool, System.Object> createItemFunc

    The function used to create new items for the pool.

    System.Int32 minimumObjects

    The minimum number of objects to be managed by the pool.

    System.Int32 maximumObjects

    The maximum number of objects to be managed by the pool.

    System.Object containerObject

    A reference to an object which should be used as the container for created items.

    System.Boolean prewarmPool

    Should this pool create its items during the constructor?

    System.Boolean allowCreateMore

    Can more items be created as needed when starved for items?

    System.Boolean allowReuseWhenCapped

    Should we reuse oldest items when starving for items?

    System.Boolean allowManagedTearDown

    Does the pool allow a managed tear down event call?

    Fields

    | Improve this Doc View Source

    BaseObject

    The object which the pool is based off of, used as a model when creating new items.

    Declaration
    public readonly object BaseObject
    Field Value
    Type Description
    System.Object
    | Improve this Doc View Source

    ContainerObject

    The object which serves as a container for all objects of the pool.

    Declaration
    public readonly object ContainerObject
    Field Value
    Type Description
    System.Object
    Remarks

    Used more by implementations of pools, then this base class.

    | Improve this Doc View Source

    destroyedItem

    An event invoked when an item is destroyed by the SimpleListManagedPool.

    Declaration
    public Action<object> destroyedItem
    Field Value
    Type Description
    System.Action<System.Object>
    | Improve this Doc View Source

    Flags

    A BitArray8 used to store pool based flags, as well as provide additional spots for implementations.

    Declaration
    public BitArray8 Flags
    Field Value
    Type Description
    BitArray8
    Remarks

    Index 0-3 (GDX.Collections.Pooling.SimpleListManagedPool.k_AllowCreateMoreFlag, GDX.Collections.Pooling.SimpleListManagedPool.k_AllowManagedTeardownFlag, GDX.Collections.Pooling.SimpleListManagedPool.k_AllowReuseFlag, and GDX.Collections.Pooling.SimpleListManagedPool.k_PrewarmPoolFlag) are used by the SimpleListManagedPool itself, leaving 4-7 for additional use.

    | Improve this Doc View Source

    InCachedCount

    A cached count of the number of items contained in InItems.

    Declaration
    public int InCachedCount
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    InItems

    A collection of items that are currently contained in the pool for use when spawning items upon request.

    Declaration
    public SimpleList<object> InItems
    Field Value
    Type Description
    SimpleList<System.Object>
    | Improve this Doc View Source

    OutCachedCount

    A cached count of the number of items contained in GDX.Collections.Pooling.SimpleListManagedPool.m_OutItems.

    Declaration
    public int OutCachedCount
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    returnedItem

    An event invoked when an item is returned to the SimpleListManagedPool.

    Declaration
    public Action<SimpleListManagedPool, object> returnedItem
    Field Value
    Type Description
    System.Action<SimpleListManagedPool, System.Object>
    | Improve this Doc View Source

    spawnedItem

    An event invoked when an item is spawned from the SimpleListManagedPool.

    Declaration
    public Action<SimpleListManagedPool, object> spawnedItem
    Field Value
    Type Description
    System.Action<SimpleListManagedPool, System.Object>
    | Improve this Doc View Source

    tearingDown

    An event invoked when a pool is tearing down, before the items are pooled.

    Declaration
    public Action<SimpleListManagedPool> tearingDown
    Field Value
    Type Description
    System.Action<SimpleListManagedPool>

    Methods

    | Improve this Doc View Source

    CreateItem()

    Create a pooled item and add it to the IManagedPool.

    Declaration
    public void CreateItem()
    | Improve this Doc View Source

    Finalize()

    The SimpleListManagedPool destructor which unregisters itself from ManagedPools.

    Declaration
    protected void Finalize()
    | Improve this Doc View Source

    ForceRemove(Object)

    Remove an item from an IManagedPool immediately, removing it from tracking and not calling any actions on it.

    Declaration
    public void ForceRemove(object item)
    Parameters
    Type Name Description
    System.Object item

    The target System.Object to attempt to remove.

    | Improve this Doc View Source

    Get(Boolean)

    Get the next available item from an IManagedPool.

    Declaration
    public object Get(bool triggerOnSpawnedFromPool = true)
    Parameters
    Type Name Description
    System.Boolean triggerOnSpawnedFromPool
    Returns
    Type Description
    System.Object

    An item if available, otherwise null.

    | Improve this Doc View Source

    GetBaseObject()

    Return the System.Object which the pool is built from.

    Declaration
    public object GetBaseObject()
    Returns
    Type Description
    System.Object

    The System.Object the IManagedPool is modelled around.

    | Improve this Doc View Source

    GetKey()

    Get the unique identifier for the IManagedPool.

    Declaration
    public uint GetKey()
    Returns
    Type Description
    System.UInt32

    A unique identifier.

    | Improve this Doc View Source

    HasMinimumPooledItems()

    Does the IManagedPool contain the minimum number of items.

    Declaration
    public bool HasMinimumPooledItems()
    Returns
    Type Description
    System.Boolean

    true/false if enough items are found contained in the IManagedPool.

    | Improve this Doc View Source

    IsAllowedManagedTearDown()

    Should theIManagedPool destroy itself when ManagedPools requests a tear down?

    Declaration
    public bool IsAllowedManagedTearDown()
    Returns
    Type Description
    System.Boolean

    true/false if flagged to allow for managed tear down / clean up.

    | Improve this Doc View Source

    IsManaged(Object)

    Is the item managed by this IManagedPool?

    Declaration
    public 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 item is managed by the IManagedPool.

    | Improve this Doc View Source

    IsPooled(Object)

    Is the provided item found in the IManagedPool's internal available pool of objects?

    Declaration
    public bool IsPooled(object item)
    Parameters
    Type Name Description
    System.Object item

    The item to evaluate.

    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Return(Object)

    Return the item to the IManagedPool's internal collection.

    Declaration
    public void Return(object item)
    Parameters
    Type Name Description
    System.Object item

    The item to return to the IManagedPool.

    | Improve this Doc View Source

    ReturnAll(Boolean)

    Return all spawned System.Objects to the IManagedPool.

    Declaration
    public 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

    | Improve this Doc View Source

    TearDown()

    Destroy all System.Objects associated with the IManagedPool.

    Declaration
    public void TearDown()

    Implements

    IManagedPool
    • Improve this Doc
    • View Source
    In This Article
    Back to top Built on 2024-01-01 against 1f69a68.
    Generated by Dox+DocFX.