|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
RAII wrapper around Handle that auto-releases on destruction. More...
#include <Handle.hpp>
Public Types | |
| using | ReleaseFunc = std::function<void(Handle<T>)> |
Public Member Functions | |
| SharedHandle ()=default | |
| Handle< T > | get () const |
| Gets the underlying raw handle (no ownership transfer). | |
| bool | isValid () const |
| Checks if valid. | |
| operator bool () const | |
| void | reset () |
| Manually release (all copies become invalid). | |
Static Public Member Functions | |
| static SharedHandle | make (Handle< T > handle, ReleaseFunc release) |
| Creates a SharedHandle that will auto-release. | |
RAII wrapper around Handle that auto-releases on destruction.
Calls a release function when the last SharedHandle copy is destroyed. Use for scoped resource ownership. The underlying Handle can be extracted with get() for hot-path access.
| T | The resource type |
Definition at line 135 of file Handle.hpp.
| using esengine::resource::SharedHandle< T >::ReleaseFunc = std::function<void(Handle<T>)> |
Definition at line 137 of file Handle.hpp.
|
default |
|
inline |
Gets the underlying raw handle (no ownership transfer).
Definition at line 151 of file Handle.hpp.
|
inline |
Checks if valid.
Definition at line 154 of file Handle.hpp.
Referenced by esengine::resource::SharedHandle< esengine::Shader >::operator bool().
|
inlinestatic |
Creates a SharedHandle that will auto-release.
Definition at line 142 of file Handle.hpp.
|
inlineexplicit |
Definition at line 155 of file Handle.hpp.
|
inline |
Manually release (all copies become invalid).
Definition at line 158 of file Handle.hpp.