Home | nevrax.com |
|
goal_stack.hGo to the documentation of this file.00001 00007 /* Copyright, 2000 Nevrax Ltd. 00008 * 00009 * This file is part of NEVRAX NEL. 00010 * NEVRAX NEL is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU NLIACeral Public License as published by 00012 * the Free Software Foundation; either version 2, or (at your option) 00013 * any later version. 00014 00015 * NEVRAX NEL is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * NLIACeral Public License for more details. 00019 00020 * You should have received a copy of the GNU General Public License 00021 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00023 * MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef NL_GOALSTACK 00027 #define NL_GOALSTACK 00028 00029 #include "nel/ai/agent/baseai.h" 00030 #include "nel/ai/logic/goal.h" 00031 00032 namespace NLAILOGIC 00033 { 00034 class CGoalStack : public NLAIAGENT::IObjectIA 00035 { 00036 private: 00037 std::vector<NLAILOGIC::CGoal *> _Goals; 00038 sint32 _MaxGoals; 00039 00040 public: 00041 struct greater : public std::binary_function<CGoal *, CGoal *, bool> { 00042 bool operator()(const CGoal *x, const CGoal *y) const 00043 { 00044 return x->priority() > y->priority(); 00045 } 00046 }; 00047 00048 static const NLAIC::CIdentType IdGoalStack; 00049 const NLAIC::CIdentType &getType() const; 00050 00051 public: 00052 CGoalStack(); 00053 CGoalStack(const CGoalStack &); 00054 ~CGoalStack(); 00055 00056 virtual IObjectIA::CProcessResult runActivity(); 00057 virtual void addGoal(CGoal *); 00058 virtual void removeGoal(CGoal *); 00059 virtual void removeGoal(); 00060 virtual CGoal *getTopGoal(); 00061 00062 virtual const std::vector<CGoal *> &getStack(); 00063 00064 virtual CGoal *operator[](sint32); 00065 virtual void getDebugString(std::string &) const; 00066 00067 virtual const NLAIC::IBasicType *clone() const; 00068 virtual const NLAIC::IBasicType *newInstance() const; 00069 virtual void save(NLMISC::IStream &os); 00070 virtual void load(NLMISC::IStream &is); 00071 virtual bool isTrue() const; 00072 virtual float truthValue() const; 00073 virtual const IObjectIA::CProcessResult &run(); 00074 virtual bool isEqual(const CGoal &a) const; 00075 virtual bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const; 00076 00077 void setMaxGoals(sint32); 00078 00079 virtual NLAIAGENT::tQueue isMember(const NLAIAGENT::IVarName *,const NLAIAGENT::IVarName *,const NLAIAGENT::IObjectIA &) const; 00080 virtual NLAIAGENT::IObjectIA::CProcessResult runMethodeMember(sint32, sint32, NLAIAGENT::IObjectIA *); 00081 virtual NLAIAGENT::IObjectIA::CProcessResult runMethodeMember(sint32 index, NLAIAGENT::IObjectIA *p); 00082 sint32 getMethodIndexSize() const; 00083 00084 }; 00085 } // NLAILOGIC 00086 00087 #endif // NL_GOALSTACK |