API reference
API reference
Select your platform
No SDKs available
No versions available

OVRObjectPool Class

Helper class to handle generic class object pools and avoid allocations in the SDK that would lead to garbage collection.

Static Methods

Dictionary< TKey, TValue > ()
Signature
static Dictionary< TKey, TValue > OVRObjectPool.Dictionary< TKey, TValue >()
Returns
Dictionary< TKey, TValue >
Get< T > ()
Gets an object of type T from it's respective pool.
If none is available a new one is created.
Signature
static T OVRObjectPool.Get< T >()
Returns
T  Object of type T
HashSet< T > ()
Signature
static HashSet< T > OVRObjectPool.HashSet< T >()
Returns
HashSet< T >
List< T > ()
Signature
static List< T > OVRObjectPool.List< T >()
Returns
List< T >
List< T > ( source )
Signature
static List< T > OVRObjectPool.List< T >(IEnumerable< T > source)
Parameters
source: IEnumerable< T >
Returns
List< T >
Queue< T > ()
Signature
static Queue< T > OVRObjectPool.Queue< T >()
Returns
Queue< T >
Return< T > ( obj )
Returns an object of type T to it's respective pool.
If the object is null or already present in the pool no changes are made.
After returning an object to the object pool using it is not allowed and leads to undefined behaviour, please Get<T> another object from the pool instead.
Signature
static void OVRObjectPool.Return< T >(T obj)
Parameters
obj: T
Returns
void
Return< T > ( set )
Signature
static void OVRObjectPool.Return< T >(HashSet< T > set)
Parameters
set: HashSet< T >
Returns
void
Return< T > ( stack )
Signature
static void OVRObjectPool.Return< T >(Stack< T > stack)
Parameters
stack: Stack< T >
Returns
void
Return< T > ( queue )
Signature
static void OVRObjectPool.Return< T >(Queue< T > queue)
Parameters
queue: Queue< T >
Returns
void
Stack< T > ()
Signature
static Stack< T > OVRObjectPool.Stack< T >()
Returns
Stack< T >

Inner Interface

IPoolObject Interface

Methods

OnGet ()
Signature
void OVRObjectPool.IPoolObject.OnGet()
Returns
void
OnReturn ()
Signature
void OVRObjectPool.IPoolObject.OnReturn()
Returns
void

Inner Structs

DictionaryScope Struct

Extends System.IDisposable

Constructors

DictionaryScope ( dictionary )
Signature
OVRObjectPool.DictionaryScope< TKey, TValue >.DictionaryScope(out Dictionary< TKey, TValue > dictionary)
Parameters
dictionary: out Dictionary< TKey, TValue >

Fields

_dictionary : readonly Dictionary< TKey, TValue >
Signature
readonly Dictionary<TKey, TValue> OVRObjectPool.DictionaryScope< TKey, TValue >._dictionary

Methods

Dispose ()
Signature
void OVRObjectPool.DictionaryScope< TKey, TValue >.Dispose()
Returns
void
TValue ()
Signature
OVRObjectPool.DictionaryScope< TKey, TValue >.TValue()

HashSetScope Struct

Extends System.IDisposable

Constructors

HashSetScope ( set )
Signature
OVRObjectPool.HashSetScope< T >.HashSetScope(out HashSet< T > set)
Parameters
set: out HashSet< T >

Fields

_set : readonly HashSet< T >
Signature
readonly HashSet<T> OVRObjectPool.HashSetScope< T >._set

Methods

Dispose ()
Signature
void OVRObjectPool.HashSetScope< T >.Dispose()
Returns
void

ItemScope Struct

Extends System.IDisposable

Constructors

ItemScope ( item )
Signature
OVRObjectPool.ItemScope< T >.ItemScope(out T item)
Parameters
item: out T

Fields

_item : readonly T
Signature
readonly T OVRObjectPool.ItemScope< T >._item

Methods

Dispose ()
Signature
void OVRObjectPool.ItemScope< T >.Dispose()
Returns
void

ListScope Struct

Extends System.IDisposable

Constructors

ListScope ( list )
Signature
OVRObjectPool.ListScope< T >.ListScope(out List< T > list)
Parameters
list: out List< T >
ListScope ( source , list )
Signature
OVRObjectPool.ListScope< T >.ListScope(IEnumerable< T > source, out List< T > list)
Parameters
source: IEnumerable< T >
list: out List< T >

Fields

_list : List< T >
Signature
List<T> OVRObjectPool.ListScope< T >._list

Methods

Dispose ()
Signature
void OVRObjectPool.ListScope< T >.Dispose()
Returns
void

QueueScope Struct

Extends System.IDisposable

Constructors

QueueScope ( queue )
Signature
OVRObjectPool.QueueScope< T >.QueueScope(out Queue< T > queue)
Parameters
queue: out Queue< T >

Fields

_queue : readonly Queue< T >
Signature
readonly Queue<T> OVRObjectPool.QueueScope< T >._queue

Methods

Dispose ()
Signature
void OVRObjectPool.QueueScope< T >.Dispose()
Returns
void

StackScope Struct

Extends System.IDisposable

Constructors

StackScope ( stack )
Signature
OVRObjectPool.StackScope< T >.StackScope(out Stack< T > stack)
Parameters
stack: out Stack< T >

Fields

_stack : readonly Stack< T >
Signature
readonly Stack<T> OVRObjectPool.StackScope< T >._stack

Methods

Dispose ()
Signature
void OVRObjectPool.StackScope< T >.Dispose()
Returns
void