高级会员
注册日期: 06-11
帖子: 1527
精华: 15
现金: 6353 标准币
资产: 6353 标准币
|
回复: node sample
6.CSMapHasher.cpp
// CSMapHasher.cpp: implementation of the CSMapHasher class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CSTypedef.h"
#include "CSMapHasher.h"
#include "CSClassTypeNode.h"
#include "CSClassTypeHandle.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
inline CS_Integer CSMapHasher::HashCode(const PCSClassTypeNode& K,const CS_Integer Upper)
{
// return (Abs( K->HashCode() ) % Upper ) + 1 ;
return ::HashCode( K->HashCode() , Upper ) ;
}
inline CS_Boolean CSMapHasher::IsEqual(const PCSClassTypeNode& K1,const PCSClassTypeNode& K2)
{
CS_Boolean k_equal ;
k_equal = ( K1 == K2 );
return k_equal ;
}
inline CS_Integer CSMapHasher::HashCode(const CS_CString K,const CS_Integer len ,const CS_Integer Upper )
{
return HASHCODE( K , len , Upper );
}
inline CS_Boolean CSMapHasher::IsEqual(const PCSClassTypeNode& K1,const CS_CString K2 ,const CS_Integer Len2)
{
return ISEQUAL( K1->Name() , K1->Length() ,K2 , Len2 ) ;
}
inline CS_Integer CSMapHasher::HashCode(const CS_CString K,const CS_Integer len ,const CS_Integer Upper ,CS_Integer& aHashCode )
{
return HASHCODE( K , len , Upper , aHashCode );
}
inline CS_Boolean CSMapHasher::IsEqual(const PCSClassTypeNode& K1,const CSClassTypeHandle& K2)
{
return ISEQUAL( K1->Name() , K1->Length() ,
K2->Name() , K2->Size() ) ;
}
|