00001 00009 #include "PKIFNameAndKeyWithScore.h" 00010 #include "Buffer.h" 00011 #include "Name.h" 00012 00020 CPKIFNameAndKeyWithScore::CPKIFNameAndKeyWithScore( 00022 IPKIFNameAndKeyPtr& nameAndKey) 00023 { 00024 m_nameAndKey = nameAndKey; 00025 m_score = 0; 00026 m_bIgnore = false; 00027 m_bNameIgnore = false; 00028 } 00036 CPKIFNameAndKeyWithScore::~CPKIFNameAndKeyWithScore() 00037 { 00038 } 00046 int CPKIFNameAndKeyWithScore::GetScore() const 00047 { 00048 return m_score; 00049 } 00057 void CPKIFNameAndKeyWithScore::AddToScore( 00059 int additionalPoints) 00060 { 00061 m_score += additionalPoints; 00062 } 00070 void CPKIFNameAndKeyWithScore::ClearScore() 00071 { 00072 m_score = 0; 00073 } 00074 00075 //functions to set, clear and get the ignore flag (used by builder) 00083 void CPKIFNameAndKeyWithScore::SetIgnore() 00084 { 00085 m_bIgnore = true; 00086 } 00094 void CPKIFNameAndKeyWithScore::ClearIgnore() 00095 { 00096 m_bIgnore = false; 00097 } 00105 bool CPKIFNameAndKeyWithScore::GetIgnore() const 00106 { 00107 return m_bIgnore; 00108 } 00116 void CPKIFNameAndKeyWithScore::SetNameIgnore() 00117 { 00118 m_bNameIgnore = true; 00119 } 00127 void CPKIFNameAndKeyWithScore::ClearNameIgnore() 00128 { 00129 m_bNameIgnore = false; 00130 } 00138 IPKIFNameAndKeyPtr CPKIFNameAndKeyWithScore::GetNameAndKey() const 00139 { 00140 return m_nameAndKey; 00141 } 00149 bool CPKIFNameAndKeyWithScore::operator==( 00151 const IPKIFNameAndKey& rhs) const 00152 { 00153 bool namesMatch = false; 00154 CPKIFNamePtr thatName = rhs.GetSubjectName(); 00155 IPKIFNameAndKeyPtr thisNK = this->GetNameAndKey(); 00156 CPKIFNamePtr thisName = thisNK->GetSubjectName(); 00157 00158 if(thisName != (CPKIFName*)NULL && thatName != (CPKIFName*)NULL) 00159 namesMatch = *thisName == *thatName; 00160 00161 bool keysMatch = false; 00162 CPKIFBufferPtr thatKey = rhs.GetKey(); 00163 CPKIFBufferPtr thisKey = thisNK->GetKey(); 00164 if(thisKey != (CPKIFBuffer*)NULL && thatKey != (CPKIFBuffer*)NULL) 00165 keysMatch = *thisKey == *thatKey; 00166 return namesMatch && keysMatch; 00167 } 00175 bool CPKIFNameAndKeyWithScore::operator==( 00177 const CPKIFNameAndKeyWithScore& rhs) const 00178 { 00179 IPKIFNameAndKeyPtr rhsNk = rhs.GetNameAndKey(); 00180 return *this == *rhsNk; 00181 }