HashTableKey_StringId.cpp
Go to the documentation of this file.00001 //*** HashTableKey_StringId.cpp *** 00002 00003 #include "HashTableKey_StringId.h" 00004 00005 00006 00007 HashTableKey_StringId::HashTableKey_StringId() 00008 { 00009 } 00010 00011 00012 //*** Constructor *** 00013 00014 HashTableKey_StringId::HashTableKey_StringId(StringId stringId): 00015 stringId_(stringId) 00016 { 00017 } 00018 00019 00020 //*** GetHash *** 00021 00022 unsigned int HashTableKey_StringId::GetHash() const 00023 { 00024 return stringId_.GetHash(); 00025 } 00026 00027 00028 //*** GetStringId *** 00029 00030 StringId HashTableKey_StringId::GetStringId() const 00031 { 00032 return stringId_; 00033 } 00034 00035 00036 //*** Compare *** 00037 00038 bool HashTableKey_StringId::Compare(const HashTableKey* key) const 00039 { 00040 // Make sure key is of the correct type 00041 if (key->GetType()!=GetType()) 00042 { 00043 return false; 00044 } 00045 // The keys are only the same if the two strings are the same (two 00046 // different strings might have the same hash value) 00047 return stringId_==(static_cast<const HashTableKey_StringId*>(key))->stringId_; 00048 } 00049 00050 00051 //*** GetType *** 00052 00053 StringId HashTableKey_StringId::GetType() const 00054 { 00055 static StringId type("HashTableKey_StringId"); 00056 return type; 00057 } 00058
Reproduction/republishing of any material on this site without permission is strictly prohibited.
