Home | nevrax.com |
|
bool_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 #ifndef NL_BOOL_OPERATOR_H 00026 #define NL_BOOL_OPERATOR_H 00027 00028 #include "nel/ai/logic/operator.h" 00029 #include "nel/ai/logic/ai_assert.h" 00030 00031 namespace NLAILOGIC { 00032 00033 class CBoolOperator : public IBaseOperator 00034 { 00035 private: 00036 char *_Comment; 00037 std::vector<bool> _CondsVal; 00038 std::vector<bool> _ConcsVal; 00039 public: 00040 CBoolOperator(); 00041 CBoolOperator(char *n); 00042 CBoolOperator(CBoolOperator &); 00043 00044 virtual void addPrecondition(IBaseAssert *, bool); 00045 virtual void addPostcondition(IBaseAssert *, bool); 00046 00047 void forward( std::vector<bool> &); 00048 virtual bool isTrue() const; 00049 std::list<CFact *> *backward(std::list<IBaseAssert *> &, std::list<bool> &); 00050 virtual bool isValid(CFactBase *); 00051 00052 static const NLAIC::CIdentType IdBoolOperator; 00053 virtual const NLAIC::CIdentType &getType() const; 00054 00055 virtual const NLAIC::IBasicType *clone() const; 00056 virtual const NLAIC::IBasicType *newInstance() const; 00057 virtual void save(NLMISC::IStream &os); 00058 virtual void load(NLMISC::IStream &is); 00059 virtual void getDebugString(std::string &) const; 00060 virtual bool isEqual(const CBoolOperator &) const; 00061 virtual const NLAIAGENT::IObjectIA::CProcessResult &run(); 00062 bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const; 00063 virtual float truthValue() const; 00064 00065 virtual std::list<CFact *> *backward(std::list<CFact *> &); 00066 virtual std::list<CFact *> *forward(std::list<CFact *> &); 00067 virtual std::list<CFact *> *propagate(std::list<CFact *> &); 00068 00069 virtual float priority() const; 00070 virtual void success(); 00071 virtual void failure(); 00072 virtual void success(IBaseOperator *); 00073 virtual void failure(IBaseOperator *); 00074 }; 00075 } 00076 #endif |