summaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/model.cpp b/model.cpp
index 67e4561..0087c05 100644
--- a/model.cpp
+++ b/model.cpp
@@ -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