00001 00009 #include "RowDoesContainPolicyInSet.h" 00010 #include "PolicyInformation.h" 00012 struct RowDoesContainPolicyInSetImpl 00013 { 00014 CPKIFPolicyInformationListPtr m_policySet; 00015 }; 00017 00024 RowDoesContainPolicyInSet::RowDoesContainPolicyInSet () 00025 : m_impl (new RowDoesContainPolicyInSetImpl) 00026 { 00027 } 00035 RowDoesContainPolicyInSet::RowDoesContainPolicyInSet (const RowDoesContainPolicyInSet& r) 00036 { 00037 m_impl = new RowDoesContainPolicyInSetImpl; 00038 m_impl->m_policySet = r.m_impl->m_policySet; 00039 } 00047 RowDoesContainPolicyInSet::~RowDoesContainPolicyInSet () 00048 { 00049 delete m_impl; 00050 m_impl = 0; 00051 } 00052 00060 bool RowDoesContainPolicyInSet::operator ()(const CPKIFPolicyInformationListPtr& test) 00061 { 00062 //the "path depth" column is all we are interested in as far as the test list is concerned 00063 //"path depth" is the node returned by back() 00064 CPKIFPolicyInformationPtr testPol = test->back(); 00065 00066 //iterate over the set that was associated with this class prior to invoking find_if 00067 //return true if the the set contains testPol 00068 CPKIFPolicyInformationList::iterator currentPolicy; 00069 CPKIFPolicyInformationList::iterator end = m_impl->m_policySet->end(); 00070 for(currentPolicy = m_impl->m_policySet->begin(); currentPolicy != end; ++currentPolicy) 00071 { 00072 if(*(*currentPolicy) == *testPol) 00073 return true; 00074 } 00075 00076 return false; 00077 } 00085 void RowDoesContainPolicyInSet::SetPolicySet( 00087 CPKIFPolicyInformationListPtr& certPols) 00088 { 00089 m_impl->m_policySet = certPols; 00090 }