Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AIKBHashTable.h
Go to the documentation of this file.
1 // Copyright (C) 2007 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef AIKBHASH_TABLE_H
22 #define AIKBHASH_TABLE_H
23 
24 #include "AIKB.h"
25 
26 #include "../Utils_LIB/UHash.h"
27 
28 namespace OpenSkyNet {
29  namespace AI {
33  class KBHashTable : public KB {
35  int _size;
36  public:
37  KBHashTable() : _records(OpenSkyNet::Utils::INITIAL_TABLE_SIZE,
38  std::list<Record>()), _size(0) {}
39  KBHashTable(int maxRecords_, unsigned int reservedRecords_,
40  unsigned int initParamsSizeOfReservedRecords_) : KB(maxRecords_,
41  reservedRecords_,initParamsSizeOfReservedRecords_),
42  _records(OpenSkyNet::Utils::INITIAL_TABLE_SIZE,
43  std::list<Record>()), _size(0) {}
44  virtual ~KBHashTable() {}
45 
48  virtual bool add(const Record& record_, bool disallowIfPremNameExists_=false);
49  virtual void remove(const Record& record_, bool all_, int numOfParamsToCheck_=-1);
50  virtual const std::list<Record>& find(const Record& record_);
51  virtual bool isEmpty() const;
52  virtual void clear();
53  virtual int size() const;
54  virtual float calcStateScore(int stateId_) const;
56  };
57  }
58 }
59 
60 #endif //AIKBHASH_TABLE_H
Definition: AIBase.h:148
const uint INITIAL_TABLE_SIZE
Definition: UHash.h:34
KBHashTable()
Definition: AIKBHashTable.h:37
virtual const std::list< Record > & find(const Record &record_)
Definition: AIKBHashTable.cpp:52
virtual float calcStateScore(int stateId_) const
Definition: AIKBHashTable.cpp:70
Definition: AIKB.h:33
Definition: AIKBHashTable.h:33
virtual void clear()
Definition: AIKBHashTable.cpp:61
virtual ~KBHashTable()
Definition: AIKBHashTable.h:44
virtual bool isEmpty() const
Definition: AIKBHashTable.cpp:57
virtual int size() const
Definition: AIKBHashTable.cpp:66
virtual bool add(const Record &record_, bool disallowIfPremNameExists_=false)
Definition: AIKBHashTable.cpp:9
KBHashTable(int maxRecords_, unsigned int reservedRecords_, unsigned int initParamsSizeOfReservedRecords_)
Definition: AIKBHashTable.h:39