//--------------------------------------------------------------------------- // @function: // CGroupExpression::PccLookupAll // // @doc: // Lookup all valid cost contexts matching given optimization context // //--------------------------------------------------------------------------- DrgPcc * CGroupExpression::PdrgpccLookupAll ( IMemoryPool *pmp, COptimizationContext *poc ) { GPOS_ASSERT(NULL != poc); DrgPcc *pdrgpcc = GPOS_NEW(pmp) DrgPcc(pmp); CCostContext *pccFound = NULL; BOOL fValid = false; { ShtAcc shta(Sht(), poc); pccFound = shta.PtLookup(); fValid = (NULL != pccFound && pccFound->Cost() != GPOPT_INVALID_COST && !pccFound->FPruned()); } while (NULL != pccFound) { if (fValid) { pccFound->AddRef(); pdrgpcc->Append(pccFound); } { ShtAcc shta(Sht(), poc); pccFound = shta.PtNext(pccFound); fValid = (NULL != pccFound && pccFound->Cost() != GPOPT_INVALID_COST && !pccFound->FPruned()); } } return pdrgpcc; }