ToPS
StoreLoadedModel.cpp
00001 /*
00002  *       StoreLoadedModel.cpp
00003  *
00004  *       Copyright 2011 Andre Yoshiaki Kashiwabara <akashiwabara@usp.br>
00005  *                      Ígor Bonádio <ibonadio@ime.usp.br>
00006  *                      Vitor Onuchic <vitoronuchic@gmail.com>
00007  *                      Alan Mitchell Durham <aland@usp.br>
00008  *
00009  *       This program is free software; you can redistribute it and/or modify
00010  *       it under the terms of the GNU  General Public License as published by
00011  *       the Free Software Foundation; either version 3 of the License, or
00012  *       (at your option) any later version.
00013  *
00014  *       This program is distributed in the hope that it will be useful,
00015  *       but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *       GNU General Public License for more details.
00018  *
00019  *       You should have received a copy of the GNU General Public License
00020  *       along with this program; if not, write to the Free Software
00021  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00022  *       MA 02110-1301, USA.
00023  */
00024 
00025 #include "StoreLoadedModel.hpp"
00026 
00027 namespace tops {
00028        ProbabilisticModelPtr StoreLoadedModel::add(std::string  name, ProbabilisticModelPtr model) {
00029           _models[name] = model;
00030           return model;
00031       }
00032        ProbabilisticModelPtr StoreLoadedModel::get(std::string  name) {
00033           if(_models.find(name) == _models.end())
00034               return null;
00035           else
00036               return _models.find(name)->second;
00037       }
00038     StoreLoadedModel * StoreLoadedModel::_inst ;
00039     StoreLoadedModel * StoreLoadedModel::instance() {
00040         if(!_inst) {
00041             _inst = new StoreLoadedModel();
00042         }
00043         return _inst;
00044     }
00045 
00046 }