Public Member Functions | |
~ResourceHolder () | |
Friends | |
class | IResourceLoader |
class | IResourcePtr |
class | ResourceManager |
This is a holder class which is holding a resource of different type. Resource pointers are pointing to this holder, so by referencing the pointer you do not have to ask the manager to get the resource, but directly to access it through this holder. So actually resource manager manages holders and not resources or pointers directly.
We use such a system to be more efficient by dereferncing the resource pointer. Other and more trivial way is to ask the manager for resource by giving him the handle. This end in a look up of handle tables and returning the resource pointer. If we use holders, pointers will directly access that holders and each holder is showing to one resource. So we do not have to do any lookups.
This class is working transparent to the whole resource management system, so you actually do not have to know how this class works and you also do not have to derive any classes from it.
This system was get from Game Programming Gems 4, and was expanded to be more flexible and more efficient.
Definition at line 55 of file ResourceHolder.h.
nrEngine::ResourceHolder::~ResourceHolder | ( | ) |
Remove the object from the memory and also delete the resource which is holded by this holder. The destructor should be declared as public so it can be used by smart pointers
Definition at line 25 of file ResourceHolder.cpp.