Class RefCount<T>
Manages reference counting for a given object. Extensions can override Release() to do custom logic when reference counting hits 0.
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public class RefCount<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
RefCount(T)
Manages reference counting for a given object. Extensions can override Release() to do custom logic when reference counting hits 0.
Declaration
public RefCount(T @object)
Parameters
Type | Name | Description |
---|---|---|
T | object |
Fields
m_object
Manages reference counting for a given object. Extensions can override Release() to do custom logic when reference counting hits 0.
Declaration
protected readonly T m_object
Field Value
Type | Description |
---|---|
T |
Methods
DecRef()
Decrements the reference counting of this object. When reference counting hits 0, calls Release().
Declaration
public void DecRef()
Get()
Manages reference counting for a given object. Extensions can override Release() to do custom logic when reference counting hits 0.
Declaration
public T Get()
Returns
Type | Description |
---|---|
T |
GetRefCount()
Returns the current reference count.
Declaration
public int GetRefCount()
Returns
Type | Description |
---|---|
int |
IncRef()
Increments the reference count. Calls to this method must be matched with calls to DecRef().
Declaration
public void IncRef()
Release()
Called when reference counting hits 0. By default this method does nothing, but extensions can override to e.g. release resources attached to object that is managed by this class.
Declaration
protected virtual void Release()