/*
 * Resources.h
 *
 *  Created on: 2009-07-08
 *      Author: wasyl
 */

#ifndef RESOURCES_H_
#define RESOURCES_H_

#include <string>
#include <map>

#include "Resource.h"

class Resources
{
private:
	static std::map<std::string, ResourceBase*> sResources;
	Resources(){};

public:
	static void blah() {  }
	template <class T> static T *get(const char *filename)
	{
		if (sResources[filename] == NULL)
			sResources[filename] = new Resource<T>(filename);
		return ((Resource<T>*)sResources[filename])->grab();
	}

	template <class T> static void load(T *&container, const char *filename)
	{
		if (sResources[filename] == NULL)
				sResources[filename] = new Resource<T>(filename);
		container = ((Resource<T>*)sResources[filename])->grab();
	}
};

#endif /* RESOURCES_H_ */
