当前位置: 首页>>代码示例>>C++>>正文


C++ CExpression类代码示例

本文整理汇总了C++中CExpression的典型用法代码示例。如果您正苦于以下问题:C++ CExpression类的具体用法?C++ CExpression怎么用?C++ CExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mxPopupMenu

void mxExpressionTray::ShowRightClickMenu( int mx, int my )
{
	CExpClass *active = expressions->GetActiveClass();
	if ( !active )
		return;

	mxPopupMenu *pop = new mxPopupMenu();
	Assert( pop );

	CExpression *exp = NULL;
	if ( m_nClickedCell != -1 )
	{
		exp = active->GetExpression( m_nClickedCell );
	}

	pop->add( "New Expression...", IDC_CONTEXT_NEWEXP );
	if ( exp )
	{
		pop->addSeparator();
		pop->add( va( "Edit '%s'...", exp->name ), IDC_CONTEXT_EDITEXP );
		pop->add( va( "Save '%s'", exp->name ), IDC_CONTEXT_SAVEEXP );

		if ( exp->CanUndo() || exp->CanRedo() )
		{
			pop->add( va( "Revert '%s'", exp->name ), IDC_CONTEXT_REVERT );
		}
		pop->addSeparator();
		pop->add( va( "Delete '%s'", exp->name ), IDC_CONTEXT_DELETEXP );
		pop->addSeparator();
		pop->add( va( "Re-create thumbnail for '%s'", exp->name ), IDC_CONTEXT_CREATEBITMAP );
	}

	pop->popup( this, mx, my );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:34,代码来源:mxexpressiontray.cpp

示例2: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CXformExpandNAryJoin::AddSpecifiedJoinOrder
//
//	@doc:
//		Expand NAry join in the specified order of inputs
//
//---------------------------------------------------------------------------
void
CXformExpandNAryJoin::AddSpecifiedJoinOrder
(
    IMemoryPool *pmp,
    CExpression *pexpr,
    CXformResult *pxfres
)
{
    GPOS_ASSERT(COperator::EopLogicalNAryJoin == pexpr->Pop()->Eopid());

    const ULONG ulArity = pexpr->UlArity();
    if (4 > ulArity)
    {
        return;
    }

    // create a join order with same order of given relations
    (*pexpr)[0]->AddRef();
    (*pexpr)[1]->AddRef();
    CExpression *pexprJoin = CUtils::PexprLogicalJoin<CLogicalInnerJoin>(pmp, (*pexpr)[0], (*pexpr)[1], CPredicateUtils::PexprConjunction(pmp, NULL));
    for (ULONG ul = 2; ul < ulArity - 1; ul++)
    {
        (*pexpr)[ul]->AddRef();
        pexprJoin = CUtils::PexprLogicalJoin<CLogicalInnerJoin>(pmp, pexprJoin, (*pexpr)[ul], CPredicateUtils::PexprConjunction(pmp, NULL));
    }
    CExpression *pexprScalar = (*pexpr)[ulArity - 1];
    pexprScalar->AddRef();
    CExpression *pexprSelect = CUtils::PexprLogicalSelect(pmp, pexprJoin, pexprScalar);
    CExpression *pexprNormalized = CNormalizer::PexprNormalize(pmp, pexprSelect);
    pexprSelect->Release();
    pxfres->Add(pexprNormalized);
}
开发者ID:godouxm,项目名称:gporca,代码行数:40,代码来源:CXformExpandNAryJoin.cpp

示例3: Deselect

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : exp - 
//-----------------------------------------------------------------------------
void mxExpressionTray::Select( int exp, bool deselect /*=true*/ )
{
	int oldcell = m_nCurCell;

	if ( deselect )
	{
		Deselect();
	}

	m_nPrevCell = oldcell;
	m_nCurCell = exp;

	if ( m_nCurCell >= 0 )
	{
		CExpClass *active = expressions->GetActiveClass();
		if ( active )
		{
			CExpression *exp = active->GetExpression( m_nCurCell );
			if ( exp )
			{
				exp->SetSelected( true );
			}
		}
	}

	redraw();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:31,代码来源:mxexpressiontray.cpp

示例4: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CStatsPredUtils::Pdrgpstatsjoin
//
//	@doc:
//		Helper function to extract array of statistics join filter from
//		an expression
//---------------------------------------------------------------------------
DrgPstatsjoin *
CStatsPredUtils::Pdrgpstatsjoin
	(
	IMemoryPool *pmp,
	CExpressionHandle &exprhdl,
	CExpression *pexprScalarInput,
	DrgPcrs *pdrgpcrsOutput, // array of output columns of join's relational inputs
	CColRefSet *pcrsOuterRefs
	)
{
	GPOS_ASSERT(NULL != pdrgpcrsOutput);

	// remove implied predicates from join condition to avoid cardinality under-estimation
	CExpression *pexprScalar = CPredicateUtils::PexprRemoveImpliedConjuncts(pmp, pexprScalarInput, exprhdl);

	// extract all the conjuncts
	CStatsPred *pstatspredUnsupported = NULL;
	DrgPstatsjoin *pdrgpstatsjoin = PdrgpstatsjoinExtract
										(
										pmp,
										pexprScalar,
										pdrgpcrsOutput,
										pcrsOuterRefs,
										&pstatspredUnsupported
										);

	// TODO:  May 15 2014, handle unsupported predicates for LASJ, LOJ and LS joins
	// clean up
	CRefCount::SafeRelease(pstatspredUnsupported);
	pexprScalar->Release();

	return pdrgpstatsjoin;
}
开发者ID:d,项目名称:gporca,代码行数:41,代码来源:CStatsPredUtils.cpp

示例5: GPOS_NEW

//---------------------------------------------------------------------------
//	@function:
//		CConstraint::PexprScalarConjDisj
//
//	@doc:
//		Construct a conjunction or disjunction scalar expression from an
//		array of constraints
//
//---------------------------------------------------------------------------
CExpression *
CConstraint::PexprScalarConjDisj
(
    IMemoryPool *pmp,
    DrgPcnstr *pdrgpcnstr,
    BOOL fConj
)
const
{
    DrgPexpr *pdrgpexpr = GPOS_NEW(pmp) DrgPexpr(pmp);

    const ULONG ulLen = pdrgpcnstr->UlLength();
    for (ULONG ul = 0; ul < ulLen; ul++)
    {
        CExpression *pexpr = (*pdrgpcnstr)[ul]->PexprScalar(pmp);
        pexpr->AddRef();
        pdrgpexpr->Append(pexpr);
    }

    if (fConj)
    {
        return CPredicateUtils::PexprConjunction(pmp, pdrgpexpr);
    }

    return CPredicateUtils::PexprDisjunction(pmp, pdrgpexpr);
}
开发者ID:hsyuan,项目名称:gporca,代码行数:35,代码来源:CConstraint.cpp

示例6: at

//---------------------------------------------------------------------------
//	@function:
//		COptimizer::PrintQuery
//
//	@doc:
//		Helper function to print query expression
//
//---------------------------------------------------------------------------
void
COptimizer::PrintQuery
	(
	IMemoryPool *pmp,
	CExpression *pexprTranslated,
	CQueryContext *pqc
	)
{
	CAutoTrace at(pmp);
	at.Os() << std::endl << "Algebrized query: " << std::endl << *pexprTranslated;

	DrgPexpr *pdrgpexpr = COptCtxt::PoctxtFromTLS()->Pcteinfo()->PdrgPexpr(pmp);
	const ULONG ulCTEs = pdrgpexpr->UlLength();
	if (0 < ulCTEs)
	{
		at.Os() << std::endl << "Common Table Expressions: ";
		for (ULONG ul = 0; ul < ulCTEs; ul++)
		{
			at.Os() << std::endl << *(*pdrgpexpr)[ul];
		}
	}
	pdrgpexpr->Release();

	CExpression *pexprPreprocessed = pqc->Pexpr();
	(void) pexprPreprocessed->PdpDerive();
	at.Os() << std::endl << "Algebrized preprocessed query: " << std::endl << *pexprPreprocessed;
}
开发者ID:d,项目名称:gporca,代码行数:35,代码来源:COptimizer.cpp

示例7: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CNormalizer::SplitConjunctForSeqPrj
//
//	@doc:
//		Split the given conjunct into pushable and unpushable predicates
//		for a sequence project expression
//
//---------------------------------------------------------------------------
void
CNormalizer::SplitConjunctForSeqPrj
	(
	IMemoryPool *pmp,
	CExpression *pexprSeqPrj,
	CExpression *pexprConj,
	DrgPexpr **ppdrgpexprPushable,
	DrgPexpr **ppdrgpexprUnpushable
	)
{
	GPOS_ASSERT(NULL != pexprSeqPrj);
	GPOS_ASSERT(NULL != pexprConj);
	GPOS_ASSERT(NULL != ppdrgpexprPushable);
	GPOS_ASSERT(NULL != ppdrgpexprUnpushable);

	*ppdrgpexprPushable =  GPOS_NEW(pmp) DrgPexpr(pmp);
	*ppdrgpexprUnpushable = GPOS_NEW(pmp) DrgPexpr(pmp);
	DrgPexpr *pdrgpexprPreds = CPredicateUtils::PdrgpexprConjuncts(pmp, pexprConj);
	const ULONG ulPreds = pdrgpexprPreds->UlLength();
	for (ULONG ul = 0; ul < ulPreds; ul++)
	{
		CExpression *pexprPred = (*pdrgpexprPreds)[ul];
		pexprPred->AddRef();
		if (FPushableThruSeqPrjChild(pexprSeqPrj, pexprPred))
		{
			(*ppdrgpexprPushable)->Append(pexprPred);
		}
		else
		{
			(*ppdrgpexprUnpushable)->Append(pexprPred);
		}
	}
	pdrgpexprPreds->Release();
}
开发者ID:godouxm,项目名称:gporca,代码行数:43,代码来源:CNormalizer.cpp

示例8: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CXformInnerJoin2DynamicBitmapIndexGetApply::Transform
//
//	@doc:
//		Actual transformation
//
//---------------------------------------------------------------------------
void
CXformInnerJoin2DynamicBitmapIndexGetApply::Transform
	(
	CXformContext *pxfctxt,
	CXformResult *pxfres,
	CExpression *pexpr
	)
	const
{
	GPOS_ASSERT(NULL != pxfctxt);
	GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr));
	GPOS_ASSERT(FCheckPattern(pexpr));

	IMemoryPool *pmp = pxfctxt->Pmp();

	// extract components
	CExpression *pexprOuter = (*pexpr)[0];
	CExpression *pexprInner = (*pexpr)[1];
	CExpression *pexprScalar = (*pexpr)[2];

	GPOS_ASSERT(COperator::EopLogicalDynamicGet == pexprInner->Pop()->Eopid());
	CLogicalDynamicGet *popDynamicGet = CLogicalDynamicGet::PopConvert(pexprInner->Pop());
	CreateHomogeneousIndexApplyAlternatives
		(
		pmp,
		pexpr->Pop()->UlOpId(),
		pexprOuter,
		pexprInner,
		pexprScalar,
		popDynamicGet->Ptabdesc(),
		popDynamicGet,
		pxfres,
		IMDIndex::EmdindBitmap
		);
}
开发者ID:HanumathRao,项目名称:gporca,代码行数:43,代码来源:CXformInnerJoin2DynamicBitmapIndexGetApply.cpp

示例9:

//---------------------------------------------------------------------------
//	@function:
//		CXformTest::PexprStarJoinTree
//
//	@doc:
//		Generate a randomized star join tree
//
//---------------------------------------------------------------------------
CExpression *
CXformTest::PexprStarJoinTree
	(
	IMemoryPool *pmp,
	ULONG ulTabs
	)
{
	
	CExpression *pexprLeft = CTestUtils::PexprLogicalGet(pmp);
	
	for (ULONG ul = 1; ul < ulTabs; ul++)
	{
		CDrvdPropRelational *pdprelLeft = CDrvdPropRelational::Pdprel(pexprLeft->PdpDerive());
		CColRef *pcrLeft = pdprelLeft->PcrsOutput()->PcrAny();
	
		CExpression *pexprRight = CTestUtils::PexprLogicalGet(pmp);

		CDrvdPropRelational *pdprelRight = CDrvdPropRelational::Pdprel(pexprRight->PdpDerive());
		CColRef *pcrRight = pdprelRight->PcrsOutput()->PcrAny();
		
		CExpression *pexprPred = CUtils::PexprScalarEqCmp(pmp, pcrLeft, pcrRight);
		
		pexprLeft = CUtils::PexprLogicalJoin<CLogicalInnerJoin>(pmp, pexprLeft, pexprRight, pexprPred);
	}
	
	return pexprLeft;	
}
开发者ID:HanumathRao,项目名称:gporca,代码行数:35,代码来源:CXformTest.cpp

示例10: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CQueryContext::MapComputedToUsedCols
//
//	@doc:
//		Walk the expression and add the mapping between computed column
//		and its used columns
//
//---------------------------------------------------------------------------
void
CQueryContext::MapComputedToUsedCols
(
    CColumnFactory *pcf,
    CExpression *pexpr
)
{
    GPOS_ASSERT(NULL != pexpr);

    if (COperator::EopLogicalProject == pexpr->Pop()->Eopid())
    {
        CExpression *pexprPrL = (*pexpr)[1];

        const ULONG ulArity = pexprPrL->UlArity();
        for (ULONG ul = 0; ul < ulArity; ul++)
        {
            CExpression *pexprPrEl = (*pexprPrL)[ul];
            pcf->AddComputedToUsedColsMap(pexprPrEl);
        }
    }

    // process children
    const ULONG ulChildren = pexpr->UlArity();
    for (ULONG ul = 0; ul < ulChildren; ul++)
    {
        MapComputedToUsedCols(pcf, (*pexpr)[ul]);
    }
}
开发者ID:hsyuan,项目名称:gporca,代码行数:37,代码来源:CQueryContext.cpp

示例11: GPOS_NEW

//---------------------------------------------------------------------------
//	@function:
//		CDistributionSpecHashed::PdsCopyWithRemappedColumns
//
//	@doc:
//		Return a copy of the distribution spec with remapped columns
//
//---------------------------------------------------------------------------
CDistributionSpec *
CDistributionSpecHashed::PdsCopyWithRemappedColumns
	(
	IMemoryPool *pmp,
	HMUlCr *phmulcr,
	BOOL fMustExist
	)
{
	DrgPexpr *pdrgpexpr = GPOS_NEW(pmp) DrgPexpr(pmp);
	const ULONG ulLen = m_pdrgpexpr->UlLength();
	for (ULONG ul = 0; ul < ulLen; ul++)
	{
		CExpression *pexpr = (*m_pdrgpexpr)[ul];
		pdrgpexpr->Append(pexpr->PexprCopyWithRemappedColumns(pmp, phmulcr, fMustExist));
	}

	if (NULL == m_pdshashedEquiv)
	{
		return GPOS_NEW(pmp) CDistributionSpecHashed(pdrgpexpr, m_fNullsColocated);
	}

	// copy equivalent distribution
	CDistributionSpec *pds = m_pdshashedEquiv->PdsCopyWithRemappedColumns(pmp, phmulcr, fMustExist);
	CDistributionSpecHashed *pdshashed = CDistributionSpecHashed::PdsConvert(pds);
	return GPOS_NEW(pmp) CDistributionSpecHashed(pdrgpexpr, m_fNullsColocated, pdshashed);
}
开发者ID:whatcat,项目名称:gporca,代码行数:34,代码来源:CDistributionSpecHashed.cpp

示例12: Release

CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks) {

	CExpression* newlhs = m_lhs->CheckLink(brokenlinks);

	if (newlhs)
	{
		if (newlhs==m_lhs) {
			// not changed
		} else {
			// changed
			//numchanges++;
			newlhs->AddRef();
			
			//m_lhs->Release();
			brokenlinks.push_back(new CBrokenLinkInfo(&m_lhs,m_lhs));

			m_lhs = newlhs;
		}
		return this;
	} else {
		//numchanges++;
		AddRef();

		return Release();
	}
	
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例13: CDouble

//---------------------------------------------------------------------------
//	@function:
//		CPhysical::GetSkew
//
//	@doc:
//		Helper to compute skew estimate based on given stats and
//		distribution spec
//
//---------------------------------------------------------------------------
CDouble
CPhysical::GetSkew
	(
	IStatistics *stats,
	CDistributionSpec *pds
	)
{
	CDouble dSkew = 1.0;
	if (CDistributionSpec::EdtHashed == pds->Edt())
	{
		CDistributionSpecHashed *pdshashed = CDistributionSpecHashed::PdsConvert(pds);
		const CExpressionArray *pdrgpexpr = pdshashed->Pdrgpexpr();
		const ULONG size = pdrgpexpr->Size();
		for (ULONG ul = 0; ul < size; ul++)
		{
			CExpression *pexpr = (*pdrgpexpr)[ul];
			if (COperator::EopScalarIdent == pexpr->Pop()->Eopid())
			{
				// consider only hashed distribution direct columns for now
				CScalarIdent *popScId = CScalarIdent::PopConvert(pexpr->Pop());
				ULONG colid = popScId->Pcr()->Id();
				CDouble dSkewCol = stats->GetSkew(colid);
				if (dSkewCol > dSkew)
				{
					dSkew = dSkewCol;
				}
			}
		}
	}

	return CDouble(dSkew);
}
开发者ID:b-xiang,项目名称:gporca,代码行数:41,代码来源:CPhysical.cpp

示例14: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CXformPushGbWithHavingBelowJoin::Transform
//
//	@doc:
//		Actual transformation
//
//---------------------------------------------------------------------------
void
CXformPushGbWithHavingBelowJoin::Transform
	(
	CXformContext *pxfctxt,
	CXformResult *pxfres,
	CExpression *pexpr
	)
	const
{
	GPOS_ASSERT(NULL != pxfctxt);
	GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr));
	GPOS_ASSERT(FCheckPattern(pexpr));

	IMemoryPool *mp = pxfctxt->Pmp();

	CExpression *pexprGb = (*pexpr)[0];
	CLogicalGbAgg *popGbAgg = CLogicalGbAgg::PopConvert(pexprGb->Pop());
	if (!popGbAgg->FGlobal())
	{
		// xform only applies to global aggs
		return;
	}

	CExpression *pexprResult = CXformUtils::PexprPushGbBelowJoin(mp, pexpr);

	if (NULL != pexprResult)
	{
		// add alternative to results
		pxfres->Add(pexprResult);
	}
}
开发者ID:b-xiang,项目名称:gporca,代码行数:39,代码来源:CXformPushGbWithHavingBelowJoin.cpp

示例15: GPOS_ASSERT

//---------------------------------------------------------------------------
//	@function:
//		CXformGbAggWithMDQA2Join::PexprExpandMDQAs
//
//	@doc:
//		Expand GbAgg with multiple distinct aggregates into a join of single
//		distinct aggregates,
//		return NULL if expansion is not done
//
//---------------------------------------------------------------------------
CExpression *
CXformGbAggWithMDQA2Join::PexprExpandMDQAs
	(
	IMemoryPool *pmp,
	CExpression *pexpr
	)
{
	GPOS_ASSERT(NULL != pexpr);
	GPOS_ASSERT(COperator::EopLogicalGbAgg == pexpr->Pop()->Eopid());

	COperator *pop = pexpr->Pop();
	if (CLogicalGbAgg::PopConvert(pop)->FGlobal())
	{
		BOOL fHasMultipleDistinctAggs = CDrvdPropScalar::Pdpscalar((*pexpr)[1]->PdpDerive())->FHasMultipleDistinctAggs();
		if (fHasMultipleDistinctAggs)
		{
			CExpression *pexprExpanded = PexprMDQAs2Join(pmp, pexpr);

			// recursively process the resulting expression
			CExpression *pexprResult = PexprTransform(pmp, pexprExpanded);
			pexprExpanded->Release();

			return pexprResult;
		}
	}

	return NULL;
}
开发者ID:HanumathRao,项目名称:gporca,代码行数:38,代码来源:CXformGbAggWithMDQA2Join.cpp


注:本文中的CExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。