00001 #ifndef MMANN_FCS_STATE_STORAGE
00002 #define MMANN_FCS_STATE_STORAGE
00003
00011
00012 #include "CompareAlgorithms.h"
00013 #include "HashAlgorithms.h"
00014 #include "AGenericTree.h"
00015 #include "FCInternalHash.h"
00016 #include "GLIBHash.h"
00017 #include "FCIndirectState.h"
00018 #include "FCSIndirectStateWithLocations.h"
00019 #include "FCSIndirectStateCompareAlgorithm.h"
00020 #include "FCState.h"
00021
00023 #define PREV_STATES_SORT_MARGIN 32
00024
00025 #define PREV_STATES_GROW_BY 128
00026
00027 #define HASH_TABLE_SIZE 2048
00028
00029 #define TALON_CACHE_SIZE 512
00030
00032 class AFCSGenericStateStorage
00033 {
00034 public:
00036 virtual ~AFCSGenericStateStorage();
00037
00043 virtual bool CheckAndInsert(FCSStateWithLocations** ExistingState, FCSStateWithLocations* NewState) = 0;
00044 };
00045
00047 class FCTreeStateStorage : public AFCSGenericStateStorage
00048 {
00049 public:
00051 FCTreeStateStorage();
00052
00054 virtual ~FCTreeStateStorage();
00055
00061 virtual bool CheckAndInsert(FCSStateWithLocations** ExistingState, FCSStateWithLocations* NewState);
00062
00063 protected:
00065 AGenericTree<FCSStateWithLocations, void>* m_Tree;
00066 };
00067
00069 class FCAVLTreeStateStorage : public FCTreeStateStorage
00070 {
00071 public:
00073 FCAVLTreeStateStorage(ACompareNodesAlgorithm<FCSStateWithLocations, void>* Compare);
00074
00076 virtual ~FCAVLTreeStateStorage();
00077 };
00078
00080 class FCAVLRedBlackTreeStateStorage : public FCTreeStateStorage
00081 {
00082 public:
00084 FCAVLRedBlackTreeStateStorage(ACompareNodesAlgorithm<FCSStateWithLocations, void>* Compare);
00085
00087 virtual ~FCAVLRedBlackTreeStateStorage();
00088 };
00089
00091 class FCRedBlackTreeStateStorage : public FCTreeStateStorage
00092 {
00093 public:
00095 FCRedBlackTreeStateStorage(ACompareNodesAlgorithm<FCSStateWithLocations, void>* Compare);
00096
00098 virtual ~FCRedBlackTreeStateStorage();
00099 };
00100
00102 class FCGLIBTreeStateStorage : public FCTreeStateStorage
00103 {
00104 public:
00106 FCGLIBTreeStateStorage(ACompareNodesAlgorithm<FCSStateWithLocations, void>* Compare);
00107
00109 virtual ~FCGLIBTreeStateStorage();
00110 };
00111
00113 class FCHashStateStorage : public AFCSGenericStateStorage
00114 {
00115 public:
00117 FCHashStateStorage();
00118
00120 virtual ~FCHashStateStorage();
00121
00127 virtual bool CheckAndInsert(FCSStateWithLocations** ExistingState, FCSStateWithLocations* NewState);
00128
00129 protected:
00131 AGenericHash<FCSStateWithLocations, void>* m_Hash;
00132 };
00133
00135 class FCGLIBHashStateStorage : public FCHashStateStorage
00136 {
00137 public:
00138
00140 FCGLIBHashStateStorage(int SizeWanted, ACompareNodesAlgorithm<FCSStateWithLocations, void>* Compare,
00141 AHashAlgorithm<FCSStateWithLocations>* Hash);
00142
00144 virtual ~FCGLIBHashStateStorage();
00145 };
00146
00148 class FCInternalHashStateStorage : public FCHashStateStorage
00149 {
00150 public:
00152 FCInternalHashStateStorage(int SizeWanted, ACompareNodesAlgorithm<FCSStateWithLocations, void>* CompareAlgorithm,
00153 AHashAlgorithm<FCSStateWithLocations>* Hash);
00154
00156 virtual ~FCInternalHashStateStorage();
00157 };
00158
00160 class FCIndirectStateStorage : public AFCSGenericStateStorage
00161 {
00162 public:
00164 FCIndirectStateStorage();
00165
00167 virtual ~FCIndirectStateStorage();
00168
00174 virtual bool CheckAndInsert(FCSStateWithLocations** ExistingState, FCSStateWithLocations* NewState);
00175
00176 protected:
00178 FCSIndirectStateWithLocations<FCSStateWithLocations>* m_IndirectPreviousStatesMargin[PREV_STATES_SORT_MARGIN];
00179
00181 int m_NumberOfPreviousStatesMargin;
00182
00184 FCSIndirectStateWithLocations<FCSStateWithLocations>** m_IndirectPreviousStates;
00186 int m_NumberOfIndirectPreviousStates;
00188 int m_MaxNumberOfIndirectPreviousStates;
00189
00191 FCSIndirectStatesCompareAlgorithm<FCSIndirectStateWithLocations<FCSStateWithLocations>*> m_Compare;
00192 };
00193
00194
00195
00196
00197
00198 #endif