LayerProcGen v0.1.0
Layer-based infinite procedural generation
Loading...
Searching...
No Matches
ObjectPool< T >

Inherits IPool< T >.

Public Member Functions

Get ()
 Gets an existing object from the pool, or creates one if none are available.
 
void Return (ref object obj)
 
void Return (ref T element)
 Returns the object to the pool and sets the reference to null.
 
void ReturnAll (ICollection< T > elements)
 Returns all the elements to the pool and calls Clear on the collection.
 
override string ToString ()
 

Static Public Member Functions

static T GlobalGet ()
 Gets an existing object from the singleton pool of type T, or creates one if none are available.
 
static void GlobalReturn (ref T element)
 Returns the object to the singleton pool of type T and sets the reference to null.
 
static void GlobalReturnAll (ICollection< T > elements)
 Returns all the elements to the singleton pool of type T and calls Clear on the collection.
 

Properties

int CountActive [get]
 
int CountAll [get]
 
int CountInactive [get]
 
static ObjectPool< T > instance [get]
 

Member Function Documentation

◆ Get()

T Get ( )

Gets an existing object from the pool, or creates one if none are available.

Implements IPool< T >.

◆ Return()

void Return ( ref T obj)

Returns the object to the pool and sets the reference to null.

Implements IPool< T >.

◆ ReturnAll()

void ReturnAll ( ICollection< T > elements)

Returns all the elements to the pool and calls Clear on the collection.

Parameters
elements

Property Documentation

◆ CountActive

int CountActive
get

Implements IPool< T >.

◆ CountAll

int CountAll
get

Implements IPool< T >.

◆ CountInactive

int CountInactive
get

Implements IPool< T >.