|
EnTT 3.13.1
|
Basic resource handle. More...
#include <resource.hpp>
Public Types | |
| using | element_type = Type |
| Resource type. | |
| using | handle_type = std::shared_ptr<element_type> |
| Handle type. | |
Public Member Functions | |
| resource () noexcept | |
| Default constructor. | |
| resource (handle_type res) noexcept | |
| Creates a handle from a weak pointer, namely a resource. | |
| resource (const resource &) noexcept=default | |
| Default copy constructor. | |
| resource (resource &&) noexcept=default | |
| Default move constructor. | |
| template<typename Other > | |
| resource (const resource< Other > &other, element_type &res) noexcept | |
| Aliasing constructor. | |
| template<typename Other , typename = std::enable_if_t<is_acceptable_v<Other>>> | |
| resource (const resource< Other > &other) noexcept | |
| Copy constructs a handle which shares ownership of the resource. | |
| template<typename Other , typename = std::enable_if_t<is_acceptable_v<Other>>> | |
| resource (resource< Other > &&other) noexcept | |
| Move constructs a handle which takes ownership of the resource. | |
| resource & | operator= (const resource &) noexcept=default |
| Default copy assignment operator. | |
| resource & | operator= (resource &&) noexcept=default |
| Default move assignment operator. | |
| template<typename Other > | |
| std::enable_if_t< is_acceptable_v< Other >, resource & > | operator= (const resource< Other > &other) noexcept |
| Copy assignment operator from foreign handle. | |
| template<typename Other > | |
| std::enable_if_t< is_acceptable_v< Other >, resource & > | operator= (resource< Other > &&other) noexcept |
| Move assignment operator from foreign handle. | |
| element_type & | operator* () const noexcept |
| Returns a reference to the managed resource. | |
| operator element_type & () const noexcept | |
| Returns a reference to the managed resource. | |
| element_type * | operator-> () const noexcept |
| Returns a pointer to the managed resource. | |
| operator bool () const noexcept | |
| Returns true if a handle contains a resource, false otherwise. | |
| const handle_type & | handle () const noexcept |
| Returns the underlying resource handle. | |
Basic resource handle.
A handle wraps a resource and extends its lifetime. It also shares the same resource with all other handles constructed from the same element.
As a rule of thumb, resources should never be copied nor moved. Handles are the way to go to push references around.
| Type | Type of resource managed by a handle. |
Definition at line 22 of file resource.hpp.
| using entt::resource< Type >::element_type = Type |
Resource type.
Definition at line 31 of file resource.hpp.
| using entt::resource< Type >::handle_type = std::shared_ptr<element_type> |
Handle type.
Definition at line 33 of file resource.hpp.
|
inlinenoexcept |
Default constructor.
Definition at line 36 of file resource.hpp.
|
inlineexplicitnoexcept |
Creates a handle from a weak pointer, namely a resource.
| res | A weak pointer to a resource. |
Definition at line 43 of file resource.hpp.
|
inlinenoexcept |
Aliasing constructor.
| Other | Type of resource managed by the received handle. |
| other | The handle with which to share ownership information. |
| res | Unrelated and unmanaged resources. |
Definition at line 59 of file resource.hpp.
|
inlinenoexcept |
Copy constructs a handle which shares ownership of the resource.
| Other | Type of resource managed by the received handle. |
| other | The handle to copy from. |
Definition at line 68 of file resource.hpp.
|
inlinenoexcept |
Move constructs a handle which takes ownership of the resource.
| Other | Type of resource managed by the received handle. |
| other | The handle to move from. |
Definition at line 77 of file resource.hpp.
|
inlinenoexcept |
Returns the underlying resource handle.
Definition at line 155 of file resource.hpp.
|
inlineexplicitnoexcept |
Returns true if a handle contains a resource, false otherwise.
Definition at line 147 of file resource.hpp.
|
inlinenoexcept |
Returns a reference to the managed resource.
Definition at line 131 of file resource.hpp.
|
inlinenoexcept |
Returns a reference to the managed resource.
Definition at line 126 of file resource.hpp.
|
inlinenoexcept |
Returns a pointer to the managed resource.
Definition at line 139 of file resource.hpp.
|
defaultnoexcept |
Default copy assignment operator.
|
inlinenoexcept |
Copy assignment operator from foreign handle.
| Other | Type of resource managed by the received handle. |
| other | The handle to copy from. |
Definition at line 100 of file resource.hpp.
|
defaultnoexcept |
Default move assignment operator.
|
inlinenoexcept |
Move assignment operator from foreign handle.
| Other | Type of resource managed by the received handle. |
| other | The handle to move from. |
Definition at line 113 of file resource.hpp.
Definition at line 24 of file resource.hpp.