experiments/evorobot/src/abstracttest.cpp

00001 /********************************************************************************
00002  *  FARSA Experiments Library                                                   *
00003  *  Copyright (C) 2007-2012                                                     *
00004  *  Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it>                         *
00005  *  Stefano Nolfi <stefano.nolfi@istc.cnr.it>                                   *
00006  *  Onofrio Gigliotta <onofrio.gigliotta@istc.cnr.it>                           *
00007  *  Gianluca Massera <emmegian@yahoo.it>                                        *
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 2 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 St, Fifth Floor, Boston, MA  02110-1301  USA  *
00022  ********************************************************************************/
00023 
00024 #include "abstracttest.h"
00025 
00026 namespace farsa {
00027 
00028 void AvailableTestList::addTest(QString name, AbstractTest *test)
00029 {
00030     m_map[name] = test;
00031 }
00032 
00033 QStringList AvailableTestList::getList()
00034 {
00035     return m_map.keys();
00036 }
00037 
00038 AbstractTest* AvailableTestList::getTest(QString name)
00039 {
00040     QMap<QString, AbstractTest*>::iterator it = m_map.find(name);
00041 
00042     if (it != m_map.end()) {
00043         return it.value();
00044     } else {
00045         return NULL;
00046     }
00047 }
00048 
00049 QMap<QString, AbstractTest*> AvailableTestList::m_map;
00050 
00051 } //end namespace farsa