StringIdTable.h
Go to the documentation of this file.00001 00011 #ifndef __StringIdTable_H__ 00012 #define __StringIdTable_H__ 00013 00014 // Includes 00015 00016 // Forward declares 00017 00018 // StringIdTable 00019 class StringIdTable 00020 { 00021 private: 00022 // The StringIdTable is only used internally by the StringId class 00023 friend class StringId; 00024 00034 static StringIdTable& GetInstance(); 00035 00040 StringIdTable(); 00041 00045 ~StringIdTable(); 00046 00055 unsigned int CalculateHash( 00056 const char* idString 00057 ) const; 00058 00059 00068 const char* FindIdString( 00069 unsigned int hash, 00070 const char* idString 00071 ); 00072 00073 private: 00082 char* StringIdTable::StoreString( 00083 unsigned int hash, 00084 const char* string 00085 ); 00086 00087 // The following will generate a compiler error if there is an attempt to create a second instance of the class 00088 StringIdTable(const StringIdTable&); 00089 const StringIdTable& operator=(const StringIdTable&); 00090 00091 00092 private: 00093 int idStringTableSlots_; 00094 int idStringTableItemCount_; 00095 char** idStringTable_; 00096 00097 00098 static const int stringStorageBlockSize_=4*1024; 00099 00101 struct StringStorageBlock 00102 { 00103 char* head; 00104 char* tail; 00105 }; 00106 00107 StringStorageBlock* stringStorageBlocks_; 00108 int stringStorageBlockMaxCount_; 00109 int stringStorageBlockCount_; 00110 }; 00111 00112 #endif /* __StringIdTable_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
