1 /* 2 * cTaskEntry.h 3 * Avida 4 * 5 * Called "task_entry.hh" prior to 12/5/05. 6 * Copyright 1999-2011 Michigan State University. All rights reserved. 7 * Copyright 1993-2003 California Institute of Technology. 8 * 9 * 10 * This file is part of Avida. 11 * 12 * Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License 13 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 14 * 15 * Avida is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License along with Avida. 19 * If not, see <http://www.gnu.org/licenses/>. 20 * 21 */ 22 23 #ifndef cTaskEntry_h 24 #define cTaskEntry_h 25 26 #ifndef cArgContainer_h 27 #include "cArgContainer.h" 28 #endif 29 #ifndef cString_h 30 #include "cString.h" 31 #endif 32 33 class cTaskLib; 34 class cTaskContext; 35 36 typedef double (cTaskLib::*tTaskTest)(cTaskContext&) const; 37 38 39 class cTaskEntry 40 { 41 private: 42 cString m_name; // Short keyword for task 43 cString m_desc; // For more human-understandable output... 44 int m_id; 45 tTaskTest m_test_fun; 46 cArgContainer* m_args; 47 48 public: cTaskEntry(const cString & name,const cString & desc,int in_id,tTaskTest fun,cArgContainer * args)49 cTaskEntry(const cString& name, const cString& desc, int in_id, tTaskTest fun, cArgContainer* args) 50 : m_name(name), m_desc(desc), m_id(in_id), m_test_fun(fun), m_args(args) 51 { 52 } ~cTaskEntry()53 ~cTaskEntry() 54 { 55 delete m_args; 56 } 57 GetName()58 const cString& GetName() const { return m_name; } GetDesc()59 const cString& GetDesc() const { return m_desc; } GetID()60 int GetID() const { return m_id; } GetTestFun()61 tTaskTest GetTestFun() const { return m_test_fun; } 62 HasArguments()63 bool HasArguments() const { return (m_args != NULL); } GetArguments()64 cArgContainer& GetArguments() const { return *m_args; } 65 }; 66 67 #endif 68