SharedResource is a pattern that allocates only one instance of a class, with reference counting. SharedResource instance is automatically allocated/freed when needed. More...
SharedResource is a pattern that allocates only one instance of a class, with reference counting. SharedResource instance is automatically allocated/freed when needed.
Example :
Static Public Member Functions | |
static T * | AcquirePointer () |
Allocates the resource if needed, and increments the reference count by 1. More... | |
static T & | Acquire () |
Allocates the resource if needed, and increments the reference count by 1. More... | |
static T * | GetResourcePointer () |
Get the pointer on the currently allocated resource. More... | |
static T & | GetResource () |
Get the currently allocated resource. More... | |
static void | Release () |
Releases the shared ressource. More... | |
|
static |
Allocates the resource if needed, and increments the reference count by 1.
|
static |
Allocates the resource if needed, and increments the reference count by 1.
|
static |
Get the currently allocated resource.
|
static |
Get the pointer on the currently allocated resource.
|
static |
Releases the shared ressource.
Resource is freed when reference counting reaches 0.