#ifndef SCENEOBJECTFABRIC_H
#define SCENEOBJECTFABRIC_H
#include "storage.h"
#include <string>

class SceneObject;
/**
Фабрика объектов

	@author Messenger of death aka Denis A. Birukov <messengerofdeath@gmail.com>
*/
class SceneObjectFabric
{

	public:
		SceneObjectFabric();
		virtual ~SceneObjectFabric();

		SceneObject* operator[] ( std::string name );
		static void add_fabric(std::string name, SceneObjectFabric* fabric);
		virtual SceneObject* operator() () {return 0;};
	protected:
		static Storage<std::string, SceneObjectFabric*> _fabrics_;
};

template<class T> class ObjectFabric : public SceneObjectFabric
{
	public: 
		SceneObject* operator() ()
		{
			return new T;
		}
};

#endif
