|
GEL
2
GEL is a library for Geometry and Linear Algebra
|
Resource manager class. More...
#include <ResourceManager.h>
Public Member Functions | |
| int | get_no_resources () const |
| void | erase_resource (RRListIter iter) |
| ResourcePtr< RES > | get_resource_ptr (const std::string &str) |
| ResourcePtr< RES > | register_resource (const std::string &str, RES *res, bool static_resource) |
Static Public Member Functions | |
| static ResourceManager & | get_instance () |
Resource manager class.
The ResourceManager is a singleton, and it uses Scott Meyers construct on first use idiom, i.e. the static function get_instance() will construct it when first called. There may be a problem with this idion if resources depend on each other. However, that is only when the program shuts down. See modern C++ design by Alexandrescu for more information.
I'll try to make everything in this class private and accessed by a simple interface of friend functions.
| ResourcePtr<RES> Util::ResourceManager< RES >::get_resource_ptr | ( | const std::string & | str | ) | [inline] |
Find a resource and return a ResourcePtr to it. Returns the 0 ResourcePtr if no string found.
| ResourcePtr<RES> Util::ResourceManager< RES >::register_resource | ( | const std::string & | str, |
| RES * | res, | ||
| bool | static_resource | ||
| ) | [inline] |
Add a resource with name passed as first argument and a pointer passed as 2nd argument. A ResourcePtr to the just inserted element is returned.
1.7.5.1