Home | nevrax.com |
|
operator.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 General 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 * General 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_OPERATOR_H 00027 #define NL_OPERATOR_H 00028 00029 #include "nel/ai/agent/agent.h" 00030 #include "nel/ai/logic/boolval.h" 00031 #include "nel/ai/logic/goal.h" 00032 00033 namespace NLAILOGIC 00034 { 00035 class IBaseVar; 00036 class IBaseAssert; 00037 class CFactPattern ; 00038 class CVarSet; 00039 class CFact; 00040 class CFactBase; 00041 class CValueSet; 00042 class CClause; 00043 00044 class IBaseOperator : public IBaseBoolType { 00045 protected: 00046 00048 char *_Comment; 00050 IBaseAssert *_Goal; 00052 std::vector<IBaseAssert *> _Conds; 00054 std::vector<IBaseAssert *> _Concs; 00055 00056 public: 00057 00058 virtual std::list<CFact *> *test(std::list<CFact *> &) {return NULL;} 00059 virtual std::list<CFact *> *backward(std::list<CFact *> &) = 0; 00060 virtual std::list<CFact *> *forward(std::list<CFact *> &) = 0; 00061 virtual std::list<CFact *> *propagate(std::list<CFact *> &) = 0; 00062 00063 IBaseOperator(); 00064 IBaseOperator(const char *); 00065 virtual ~IBaseOperator(); 00066 IBaseOperator(const IBaseOperator &); 00067 00069 void setComment(char *); 00070 00072 virtual void setGoal(IBaseAssert *); 00073 00075 virtual bool isValid(CFactBase *) =0; 00076 00078 virtual float priority() const = 0; 00079 00083 virtual void success() = 0; 00084 virtual void failure() = 0; 00085 00088 virtual void success( IBaseOperator *) = 0; 00089 virtual void failure( IBaseOperator *) = 0; 00090 00091 const std::vector<IBaseAssert *> &getPrecondAsserts() const; 00092 const std::vector<IBaseAssert *> &getPostCondAsserts() const; 00093 00094 virtual void save(NLMISC::IStream &os); 00095 virtual void load(NLMISC::IStream &is); 00096 }; 00097 } 00098 #endif |