#include "Layer.h" StackFactory * StackFactory::_instance = NULL; StackFactory * StackFactory::getInstance(){ return _instance ? _instance : _instance=new StackFactory(); } void StackFactory::registerLayerFactory(const std::string & type, LayerFactory * f) { _fs[type] = f; } Layer* StackFactory::createLayerStack(const char* str) { std::string type; std::string param; // parse str LayerFactory * f = _fs[type]; if(f){ return f->createLayer(type, param); } return NULL; }