Inheritance diagram for nrEngine::ResourcePtr< ResType >:
Public Member Functions | |
ResourcePtr () | |
ResourcePtr (const IResourcePtr &res) | |
NR_FORCEINLINE ResType * | operator-> () const |
NR_FORCEINLINE ResType * | get () |
NR_FORCEINLINE ResType & | operator * () const |
This is a smart pointer that can be used to access resources manages by the resource manager. This pointer will automaticly be pointing to empty resource if the resource was unloaded by the manager.
You can create more than one resource pointer to a resource. Each access to such a resource through the manager will create a new one for you. However the pointers are pointing to one resource holder. Each resource holder is controlled/managed by the manager. So if you for example unload a resource to which one you has pointers, the manager will replace the resource holding by the holder with empty one. So if you try to access the resource you can still access them, but they are empty. Our systems also allows you to delete the manager from the memory, but the pointers will stay valid. So you can also remove the manager after you loaded all resources. However you can then do not manage the resources, so this is a way you should not do it !!!
Definition at line 216 of file ResourcePtr.h.
nrEngine::ResourcePtr< ResType >::ResourcePtr | ( | ) |
Create an empty resource pointer. Such a pointer does not point to anything. So using of not initialized pointers will give you an exception
Definition at line 224 of file ResourcePtr.h.
nrEngine::ResourcePtr< ResType >::ResourcePtr | ( | const IResourcePtr< ResType > & | res | ) |
Copy constructor to allow copying from base class
Definition at line 229 of file ResourcePtr.h.
NR_FORCEINLINE ResType* nrEngine::ResourcePtr< ResType >::operator-> | ( | ) | const |
Access to the resource to which one this pointer points. This access need 1 static_cast, 3 function calls until it returns the resource. So this function is running in O(1) and is pretty efficient
Definition at line 236 of file ResourcePtr.h.
References nrEngine::IResourcePtr::getBase(), nrEngine::Log::LL_ERROR, nrEngine::Log::LOG_ENGINE, and NR_ASSERT.
NR_FORCEINLINE ResType* nrEngine::ResourcePtr< ResType >::get | ( | ) |
Get the object stored by this pointer. NOTE: The instance is controlled by the pointer, so do not delete it
Definition at line 252 of file ResourcePtr.h.
NR_FORCEINLINE ResType& nrEngine::ResourcePtr< ResType >::operator * | ( | ) | const |
Access to the resource to which one this pointer points. This access need 1 static_cast, 3 function calls until it returns the resource. So this function is running in O(1) and is pretty efficient
Definition at line 262 of file ResourcePtr.h.