template<typename T>
handle class
wraps around a resource for sharing and management purposes.
resource handles are used to manage the lifetime of resources, and tracking dependencies (i.e. who uses what). It is supposed to be used with a core::
constructors, destructors, conversion operators
member-functions
Function documentation
template<typename T>
template<typename... Args, typename = typename std::enable_if< std::is_constructible<T, const T&, const UID&, cache&, Args...>::value>::type>
core:: resource:: handle<T>:: handle(deep_ copy_ t,
const handle& other,
Args && ... args)
Details
special form of the constructor that will create a detached clone of the handle you use as the source. this will create a new resource, that branches off from the current state the other resource is in. it invokes the copy constructor of the contained type, and so if it is not present, this will not compile.
template<typename T>
core:: resource:: handle<T>:: operator bool() const
Returns | true of the handle has a valid, loaded object. |
---|
template<typename T>
template<typename... Args>
bool core:: resource:: handle<T>:: load(Args && ... args)
Brief
loads the resource with the given arguments.
Details
loads the resource with the given arguments. In case the resource already exists, the arguments are ignored and the already loaded resource is returned instead.
Returns | true if the resource is loaded |
---|
template<typename T>
bool core:: resource:: handle<T>:: unload(bool force = false)
Details
>ill try to unload the resource. In case that this is the last handle to the resource, it will clean itself up and return success, otherwise it will fail and return false. It will also fail when the resource is not yet loaded, and it will not unload when it finally is loaded, you'll have to call this again.
Parameters | |
---|---|
force in | forcibly unload regardless of dependencies. |
Returns | true on success. |
template<typename T>
const UID& core:: resource:: handle<T>:: ID() const noexcept
Returns | the UID assigned to the handle |
---|
template<typename T>
const UID& core:: resource:: handle<T>:: RUID() const noexcept
Details
Returns | the resource UID, this is shared between all handles of different types that are based on the same resource. |
---|