A* Pathfinding Project  4.2.6
The A* Pathfinding Project for Unity 3D
PathPool Class Reference

Pools path objects to reduce load on the garbage collector. More...

Detailed Description

Pools path objects to reduce load on the garbage collector.

Static Public Member Functions

static T GetPath< T > ()
 Get a path from the pool or create a new one if the pool is empty. More...
 
static int GetSize (Type type)
 Number of pooled instances of a path of the specified type. More...
 
static int GetTotalCreated (Type type)
 Total created instances of paths of the specified type. More...
 
static void Pool (Path path)
 Adds a path to the pool. More...
 

Static Private Attributes

static readonly Dictionary< Type, Stack< Path > > pool = new Dictionary<Type, Stack<Path> >()
 
static readonly Dictionary< Type, int > totalCreated = new Dictionary<Type, int>()
 

Member Function Documentation

◆ GetPath< T >()

static T GetPath< T > ( )
static

Get a path from the pool or create a new one if the pool is empty.

Type Constraints
T :Path 
T :new() 

◆ GetSize()

static int GetSize ( Type  type)
static

Number of pooled instances of a path of the specified type.

◆ GetTotalCreated()

static int GetTotalCreated ( Type  type)
static

Total created instances of paths of the specified type.

◆ Pool()

static void Pool ( Path  path)
static

Adds a path to the pool.

This function should not be used directly. Instead use the Path.Claim and Path.Release functions.

Member Data Documentation

◆ pool

readonly Dictionary<Type, Stack<Path> > pool = new Dictionary<Type, Stack<Path> >()
staticprivate

◆ totalCreated

readonly Dictionary<Type, int> totalCreated = new Dictionary<Type, int>()
staticprivate

The documentation for this class was generated from the following file: