Inheritance diagram for nrEngine::IResourcePtr:
Public Member Functions | |
IResourcePtr (const IResourcePtr &resPtr) | |
IResourcePtr () | |
virtual | ~IResourcePtr () |
virtual bool | operator== (IResourcePtr &res) const |
virtual bool | operator== (const IResource *p) const |
virtual bool | operator!= (IResourcePtr &res) const |
virtual bool | operator!= (const IResource *res) const |
NR_FORCEINLINE bool | isNull () const |
NR_FORCEINLINE bool | valid () const |
Result | lockResource () |
Result | unlockResource () |
Result | lockEmpty () |
Result | unlockEmpty () |
IResource * | getBase () const |
Protected Member Functions | |
NR_FORCEINLINE SharedPtr< ResourceHolder > | getResourceHolder () const |
IResourcePtr (SharedPtr< ResourceHolder > holder) | |
Protected Attributes | |
SharedPtr< ResourceHolder > | mHolder |
Shared pointer holding the holder of the resource. | |
Friends | |
class | IResourceLoader |
Resource Manager is a friend, so it can freely work with this pointers. | |
class | ResourceManager |
Also resource manager is a friend. |
This is a base class for resource pointers. You can use this pointers as normal pointers, except you can not use new,delete functions. We need this base class which is not templated to implement converting functions in derived classes
Definition at line 40 of file ResourcePtr.h.
nrEngine::IResourcePtr::IResourcePtr | ( | const IResourcePtr & | resPtr | ) |
Copy constructor
Definition at line 24 of file ResourcePtr.cpp.
References getResourceHolder(), and mHolder.
nrEngine::IResourcePtr::IResourcePtr | ( | ) |
Create an empty resource pointer, that do not point to anywhere
Definition at line 51 of file ResourcePtr.h.
virtual nrEngine::IResourcePtr::~IResourcePtr | ( | ) | [virtual] |
Virtual destructor
Definition at line 59 of file ResourcePtr.h.
nrEngine::IResourcePtr::IResourcePtr | ( | SharedPtr< ResourceHolder > | holder | ) | [protected] |
Create an instance of the resource pointer. This pointer is pointing to the resource stored by the holder. The constructor is private, so you can not use the new function to create the pointer.
Definition at line 181 of file ResourcePtr.h.
bool nrEngine::IResourcePtr::operator== | ( | IResourcePtr & | res | ) | const [virtual] |
Check if the given pointer is the same as this one.
Definition at line 29 of file ResourcePtr.cpp.
References nrEngine::ResourceHolder::getResource(), getResourceHolder(), isNull(), and nrEngine::IResource::isResourceEmpty().
Referenced by operator!=().
bool nrEngine::IResourcePtr::operator== | ( | const IResource * | p | ) | const [virtual] |
Check equality to normal pointers.
Definition at line 52 of file ResourcePtr.cpp.
References getResourceHolder(), and isNull().
bool nrEngine::IResourcePtr::operator!= | ( | IResourcePtr & | res | ) | const [virtual] |
Check whenver two pointers are not the same.
Definition at line 62 of file ResourcePtr.cpp.
References operator==().
bool nrEngine::IResourcePtr::operator!= | ( | const IResource * | res | ) | const [virtual] |
Check whenver two pointers are not the same.
Definition at line 67 of file ResourcePtr.cpp.
References operator==().
NR_FORCEINLINE bool nrEngine::IResourcePtr::isNull | ( | ) | const |
Check whenever this pointer is NULL - does not contain data
Definition at line 97 of file ResourcePtr.h.
Referenced by nrEngine::ResourceManager::createResource(), nrEngine::ScriptEngine::load(), nrEngine::ResourceManager::loadResource(), lockEmpty(), lockResource(), nrEngine::ResourceManager::lockResource(), operator==(), nrEngine::ResourceManager::reload(), nrEngine::ResourceManager::remove(), nrEngine::ScriptFunctionDec(), nrEngine::ResourceManager::unload(), unlockEmpty(), unlockResource(), and nrEngine::ResourceManager::unlockResource().
NR_FORCEINLINE bool nrEngine::IResourcePtr::valid | ( | ) | const |
Check whenever the pointer contains valid data. The method if opossite to isNull()
Definition at line 105 of file ResourcePtr.h.
Result nrEngine::IResourcePtr::lockResource | ( | ) |
Lock the resource to which one this pointer points, to prevent using of empty resource. See more information about locking of real resources in the documentation about ResourceManager::lockPure() or ResourceHolder::lockPure()
Definition at line 72 of file ResourcePtr.cpp.
References getResourceHolder(), isNull(), nrEngine::OK, nrEngine::RES_LOCK_STATE_STACK_IS_FULL, and nrEngine::RES_PTR_IS_NULL.
Referenced by nrEngine::ResourceManager::lockResource().
Result nrEngine::IResourcePtr::unlockResource | ( | ) |
Unlock the resource to which one this pointer points, to prevent using of empty resource. See more information about locking of real resources in the documentation about ResourceManager::unlockpure()
Definition at line 84 of file ResourcePtr.cpp.
References getResourceHolder(), isNull(), nrEngine::OK, and nrEngine::RES_PTR_IS_NULL.
Result nrEngine::IResourcePtr::lockEmpty | ( | ) |
Lock an empty resource, so that even if resource is loaded, empty resource will be used.
Definition at line 95 of file ResourcePtr.cpp.
References getResourceHolder(), isNull(), nrEngine::OK, nrEngine::RES_LOCK_STATE_STACK_IS_FULL, and nrEngine::RES_PTR_IS_NULL.
Result nrEngine::IResourcePtr::unlockEmpty | ( | ) |
Unlock empty resource
Definition at line 107 of file ResourcePtr.cpp.
References getResourceHolder(), isNull(), nrEngine::OK, and nrEngine::RES_PTR_IS_NULL.
IResource * nrEngine::IResourcePtr::getBase | ( | ) | 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 118 of file ResourcePtr.cpp.
References mHolder, and NR_ASSERT.
Referenced by nrEngine::ResourcePtr< ResType >::operator->(), and nrEngine::ResourceManager::remove().
NR_FORCEINLINE SharedPtr<ResourceHolder> nrEngine::IResourcePtr::getResourceHolder | ( | ) | const [protected] |
Get the holder to which one this pointer shows
Definition at line 171 of file ResourcePtr.h.
Referenced by IResourcePtr(), lockEmpty(), lockResource(), operator==(), unlockEmpty(), unlockResource(), and nrEngine::ResourceManager::unlockResource().
friend class IResourceLoader [friend] |
Resource Manager is a friend, so it can freely work with this pointers.
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 160 of file ResourcePtr.h.