class
TResourceHandle
template<typename ResourceType, bool IsWeakHandle = false>Represents a handle to a resource.
Handles are similar to a smart pointers, but they have two advantages:
- When loading a resource asynchronously you can be immediately returned the handle that you may use throughout the engine. The handle will be made valid as soon as the resource is loaded.
- Handles can be serialized and deserialized, therefore saving/restoring references to their original resource.
Public
Constructors
TResourceHandle<ResourceType, IsWeakHandle>
TResourceHandle<ResourceType, IsWeakHandle>
TResourceHandle<ResourceType, IsWeakHandle>
Copy constructor.
TResourceHandle<ResourceType, IsWeakHandle>
Move constructor.
Methods
~TResourceHandle<ResourceType, IsWeakHandle>
Swap
Swaps the contents of this handle with another.
Get
Returns internal resource pointer and dereferences it.
Operators
operator TResourceHandle<b3d::Resource, IsWeakHandle>
Converts a specific handle to generic Resource handle.
operator->
Returns internal resource pointer.
operator*
Returns internal resource pointer and dereferences it.
operator=
Clears the handle making it invalid and releases any references held to the resource.
operator=
Copy assignment.
operator=
Move assignment.
operator int Bool_struct::*
Allows direct conversion of handle to bool.
Protected
Constructors
TResourceHandle<ResourceType, IsWeakHandle>
Constructs an invalid handle with the specified Id.
You must call AssociateResourceWithHandle() with the actual resource pointer to make the handle valid.
TResourceHandle<ResourceType, IsWeakHandle>
Constructs a new valid handle for the provided resource with the provided ID.
TResourceHandle<ResourceType, IsWeakHandle>
Constructs a new handle from existing handle data.