GEL  2
GEL is a library for Geometry and Linear Algebra
Public Member Functions | Static Public Member Functions
Util::ResourceManager< RES > Class Template Reference

Resource manager class. More...

#include <ResourceManager.h>

List of all members.

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 ResourceManagerget_instance ()

Detailed Description

template<class RES>
class Util::ResourceManager< RES >

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.


Member Function Documentation

template<class RES >
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.

template<class RES >
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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations