Home | nevrax.com |
|
classifier.hGo to the documentation of this file.00001 00007 /* Copyright, 2001 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_CLASSIFIER_H 00027 #define NL_CLASSIFIER_H 00028 00029 #include "nel/misc/types_nl.h" 00030 #include <list> 00031 #include <map> 00032 00033 namespace NLAINIMAT 00034 { 00035 00042 class CClassifierSystem 00043 { 00044 private : 00045 // It's an atomic condition in the condition part of a CClassifier 00046 class CClassifierConditionCell 00047 { 00048 public : 00049 CClassifierConditionCell(std::map<std::string, char>::iterator itSensor, char value); 00050 bool isActivable() const; 00051 00052 private : 00053 std::map<std::string, char>::iterator _itSensor; // A reference to the sensor associate with this condition. 00054 char _value; // The condition value; 00055 }; 00056 00057 // A classifier is a three parts components (condition, priority, behavior). 00058 class CClassifier 00059 { 00060 public: 00061 ~CClassifier(); 00062 00063 public : 00064 std::list<CClassifierConditionCell*> Condition; 00065 sint16 Priority; 00066 std::string Behavior; 00067 }; 00068 00069 private : 00070 std::map<std::string, char> _sensors; // The sensors are the inputs of the classifier system. 00071 std::list<CClassifier*> _classifiers; // The classifiers are the rules of the classifier system. 00072 00073 public : 00075 ~CClassifierSystem(); 00076 00083 void addClassifier(std::map<std::string, char> conditionsMap, sint16 priority, const char* behavior); 00084 00090 std::string selectBehavior(std::map<std::string, char> sensorMap); 00091 }; 00092 00093 00094 } // NLAINIMAT 00095 00096 00097 #endif // NL_CLASSIFIER_H 00098 00099 /* End of classifier.h */ |