1 /* 2 * cASLibrary.h 3 * Avida 4 * 5 * Created by David on 1/16/06. 6 * Copyright 2006-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 #ifndef cASLibrary_h 23 #define cASLibrary_h 24 25 #include "cASFunction.h" 26 #include "tDictionary.h" 27 28 29 class cASLibrary 30 { 31 private: 32 // -------- Internal Type Declarations -------- 33 struct sObjectEntry; 34 35 36 // -------- Internal Variables -------- 37 tArray<sObjectEntry*> m_obj_tbl; 38 tDictionary<int> m_obj_dict; 39 tDictionary<const cASFunction*> m_fun_dict; 40 41 42 // -------- Private Constructors -------- 43 cASLibrary(const cASLibrary&); // @not_implemented 44 cASLibrary& operator=(const cASLibrary&); // @not_implemented 45 46 47 public: cASLibrary()48 cASLibrary() { ; } 49 ~cASLibrary(); 50 51 bool LookupObject(const cString& obj_name, int& obj_id); LookupFunction(const cString & name,const cASFunction * & func)52 bool LookupFunction(const cString& name, const cASFunction*& func) { return m_fun_dict.Find(name, func); } 53 HasFunction(const cString & name)54 bool HasFunction(const cString& name) const { return m_fun_dict.HasEntry(name); } 55 56 bool RegisterFunction(const cASFunction* func); 57 58 59 private: 60 // -------- Internal Type Definitions -------- 61 struct sObjectEntry 62 { 63 cString name; 64 sObjectEntrysObjectEntry65 sObjectEntry(const cString& in_name) : name(in_name) { ; } 66 }; 67 68 }; 69 70 #endif 71