# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

fo_assert.h

Go 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_FO_ASSERT_H
00027 #define NL_FO_ASSERT_H
00028 
00029 #include "nel/ai/logic/ai_assert.h"
00030 #include "nel/ai/agent/volatil_memory.h"
00031 
00032 namespace NLAILOGIC
00033 {
00034         class CFirstOrderAssert : public IBaseAssert 
00035         {
00036                 private:
00037                         std::vector< std::vector<sint32> >      _PosVars;               // Position des variables de l'assertion dans ces clauses
00038                         NLAIAGENT::CVolatilMemmory                      _Facts;                                         // Faits pour l'assertion
00039                         sint32 _NbVars;
00040 
00041                         std::vector<CClause *>                  _Clauses;
00042 
00043                         sint32 findAssert(IBaseAssert *);
00044 
00045                         std::vector< std::vector<sint32> > _PosVarsInputs;
00046 
00047                 public:
00048                         CFirstOrderAssert(const NLAIAGENT::IVarName &n, sint32 nb_vars = 0);
00049                         CFirstOrderAssert(const CFirstOrderAssert &);
00050                         virtual ~CFirstOrderAssert();
00051                         void connectClause(CClause *, std::vector<sint32> &);
00052                         void addFact(CVarSet *f);
00053                         void addFact(CValueSet *);
00054                         void removeFact(CFact *f);
00055                         void addClause(CClause *CClause, std::vector<sint32> &posvars);
00056                         const std::vector<CClause *> &getClauses();
00057                         void addInput(CClause *, std::vector<sint32> &posvars );
00058 
00059                         static const NLAIC::CIdentType IdFirstOrderAssert;
00060 
00061                         virtual const NLAIC::IBasicType *clone() const;
00062                         virtual const NLAIC::IBasicType *newInstance() const;
00063                         virtual void save(NLMISC::IStream &os);
00064                         virtual void load(NLMISC::IStream &is);
00065                         virtual void getDebugString(std::string &) const;
00066                         bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const;
00067                         virtual bool isEqual(const CFirstOrderAssert &) const;
00068                         virtual const IObjectIA::CProcessResult &run();
00069                         virtual bool isTrue() const;
00070                         virtual const NLAIC::CIdentType &getType() const;
00071 
00072                         virtual void init(NLAIAGENT::IObjectIA *);
00073                         virtual sint32 nbVars() const;
00074 
00075                         void backward(CValueSet *, std::list<CValueSet *> &);
00076 
00077                         std::list<CFact *> *backward(CFact *);
00078 
00079                         std::list<CFact *> *getFacts() const;
00080         };
00081 }
00082 #endif