#include <ResourceHandler.h>
Public Member Functions | |
virtual | ~ResourceHandler () |
void | check_load (const Key &key, ContentConstructionInformation construction_information) |
If a key is not paired with a Content object, create one using the information provided. | |
Content * | get (const Key &key) |
Get a pointer to the data stored for the given key, or 0 if the key is unused. | |
Static Public Member Functions | |
static ResourceHandler< Content, Key, ContentConstructionInformation > & | get_instance () |
Get an instance to the resource handler. | |
Private Member Functions | |
ResourceHandler () | |
ResourceHandler (const ResourceHandler &source) | |
ResourceHandler & | operator= (const ResourceHandler &source) |
Private Attributes | |
std::map< Key, Content * > | data |
For example textures and meshes.
Content the class for the objects we wish to store. Key the class for the identifier used to distinguish the objects. It must be orderable, i.e. it has an well-behaved
operator<(Key lvalue, Key rvalue).
Definition at line 32 of file ResourceHandler.h.
Engine::ResourceHandler< Content, Key, ContentConstructionInformation >::ResourceHandler | ( | ) | [private] |
Definition at line 72 of file ResourceHandler.h.
Engine::ResourceHandler< Content, Key, ContentConstructionInformation >::ResourceHandler | ( | const ResourceHandler< Content, Key, ContentConstructionInformation > & | source | ) | [private] |
Engine::ResourceHandler< Content, Key, ContentConstructionInformation >::~ResourceHandler | ( | ) | [virtual] |
Definition at line 77 of file ResourceHandler.h.
void Engine::ResourceHandler< Content, Key, ContentConstructionInformation >::check_load | ( | const Key & | key, | |
ContentConstructionInformation | construction_information | |||
) |
If a key is not paired with a Content object, create one using the information provided.
If the key is already present, nothing happens.
key | The key that should be attached. | |
construction_information | The argument to pass to the constructor of Content to create the object, if the key is not found. |
Definition at line 95 of file ResourceHandler.h.
Content * Engine::ResourceHandler< Content, Key, ConstructionInfo >::get | ( | const Key & | key | ) |
Get a pointer to the data stored for the given key, or 0 if the key is unused.
key | The key to look up. |
Definition at line 108 of file ResourceHandler.h.
ResourceHandler< Content, Key, ConstructionInfo > & Engine::ResourceHandler< Content, Key, ConstructionInfo >::get_instance | ( | ) | [static] |
Get an instance to the resource handler.
As the class is templatised, there will be exactly one object per combination of Content, Key and ConstructionInfo types: be careful not to mix Key types when you don't want to. For constructors that take multiple parameters, you'll have to make another class for the paramters. If you want to store objects with a different constructor argument signature in the same ResourceHandler, you'll need to make an abstract class like that and redesign the class.
Definition at line 88 of file ResourceHandler.h.
ResourceHandler& Engine::ResourceHandler< Content, Key, ContentConstructionInformation >::operator= | ( | const ResourceHandler< Content, Key, ContentConstructionInformation > & | source | ) | [private] |
std::map<Key, Content *> Engine::ResourceHandler< Content, Key, ContentConstructionInformation >::data [private] |
Definition at line 68 of file ResourceHandler.h.
Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.