1 /* 2 * cASLibrary.cc 3 * Avida 4 * 5 * Created by David on 1/16/06. 6 * Copyright 1999-2011 Michigan State University. All rights reserved. 7 * 8 * 9 * This file is part of Avida. 10 * 11 * Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License 12 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 13 * 14 * Avida is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License along with Avida. 18 * If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 #include "cASLibrary.h" 23 24 ~cASLibrary()25cASLibrary::~cASLibrary() 26 { 27 for (int i = 0; i < m_obj_tbl.GetSize(); i++) delete m_obj_tbl[i]; 28 29 tArray<const cASFunction*> fun_objs; 30 m_fun_dict.GetValues(fun_objs); 31 for (int i = 0; i < fun_objs.GetSize(); i++) delete fun_objs[i]; 32 } 33 34 RegisterFunction(const cASFunction * func)35bool cASLibrary::RegisterFunction(const cASFunction* func) 36 { 37 const cASFunction* old_func = NULL; 38 bool found = m_fun_dict.Find(func->GetName(), old_func); 39 40 if (found) { 41 return false; 42 } else { 43 m_fun_dict.Add(func->GetName(), func); 44 return true; 45 } 46 } 47