diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-07-03 15:33:54 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-07-03 15:33:54 +0200 |
commit | 5205d99629a9b15865e7a1950b49d8da40a91309 (patch) | |
tree | 91b3deb782dac4432d48935b0566805123951d92 /model.cpp | |
parent | 75a90df8bf7f38e746e021c23248e1607931132c (diff) |
Diffstat (limited to 'model.cpp')
-rw-r--r-- | model.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -101,4 +101,27 @@ void Tree::render() { leaves->render(); } +/* ModelManager */ + +ModelManager *ModelManager::model_mgr = NULL; + +void ModelManager::add_model(const std::string name, Model::p model) { + models.insert(std::pair<const std::string, Model::p>(name, model)); +} + +Model::p ModelManager::get_model(const std::string name) { + std::map<const std::string, Model::p>::iterator it = models.find(name); + if(it != models.end()) + return it->second; + + return Model::p(); +} + +ModelManager& ModelManager::get_instance() { + if(!model_mgr) + model_mgr = new ModelManager(); + + return *model_mgr; +} + } // namespace models |