本文整理汇总了C++中MapInfo::codeGenerated方法的典型用法代码示例。如果您正苦于以下问题:C++ MapInfo::codeGenerated方法的具体用法?C++ MapInfo::codeGenerated怎么用?C++ MapInfo::codeGenerated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapInfo
的用法示例。
在下文中一共展示了MapInfo::codeGenerated方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: codeGen
short Assign::codeGen(Generator * generator)
{
Attributes ** attr;
// If this Assign has already been codeGenned, then bug out early.
//
MapInfo * assignMapInfo = generator->getMapInfoAsIs(getValueId());
if (assignMapInfo && assignMapInfo->isCodeGenerated())
return 0;
// If the left child (lvalue) is already in the map table, then
// add the Assign value Id to the map table with the same attributes
// as the let child. Mark the Assign node as codeGenned. Also, allocate
// space for the attributes.
//
MapInfo *leftChildMapInfo = generator->getMapInfoAsIs
(child(0)->castToItemExpr()->getValueId());
if (leftChildMapInfo)
{
if (! assignMapInfo)
assignMapInfo =
generator->addMapInfoToThis(generator->getLastMapTable(),
getValueId(),
leftChildMapInfo->getAttr());
assignMapInfo->codeGenerated();
attr = new(generator->wHeap()) Attributes*[2];
// Set the result attribute
//
attr[0] = assignMapInfo->getAttr();
}
// Otherwise, go ahead and generate the Assign attributes (which also
// allocates space for the Assign result). Add the left child to the
// map table with the same attributes as the Assign node.
//
else
{
generator->getExpGenerator()->genItemExpr(this, &attr, 2, 0);
generator->addMapInfoToThis(generator->getLastMapTable(),
child(0)->castToItemExpr()->getValueId(),
attr[0]);
}
attr[0]->resetShowplan();
// Now, generate code for the right child (rvalue).
//
generator->getExpGenerator()->setClauseLinked(FALSE);
child(1)->codeGen(generator);
attr[1] = generator->getAttr(child(1));
generator->getExpGenerator()->setClauseLinked(FALSE);
ex_conv_clause * conv_clause =
new(generator->getSpace()) ex_conv_clause
(getOperatorType(), attr, generator->getSpace());
generator->getExpGenerator()->linkClause(this, conv_clause);
return 0;
}
示例2:
void
generateMarkedEntries(Generator *generator, ValueIdSet &marks)
{
for(ValueId vid = marks.init(); marks.next(vid); marks.advance(vid)) {
MapInfo *mapInfo =
generator->getMapInfoAsIs(vid);
if(mapInfo)
mapInfo->codeGenerated();
}
}
示例3:
ex_expr *
PhysSequence::generateChildProjectExpression(Generator *generator,
MapTable *mapTable,
MapTable *localMapTable,
const ValueIdSet &childProjectIds) const
{
ex_expr * projectExpr = NULL;
if(NOT childProjectIds.isEmpty())
{
// Generate the clauses for the expression
//
generator->getExpGenerator()->generateSetExpr(childProjectIds,
ex_expr::exp_ARITH_EXPR,
&projectExpr);
// Add the projected values to the local map table.
//
ValueId valId;
for(valId = childProjectIds.init();
childProjectIds.next(valId);
childProjectIds.advance(valId))
{
// Get the attribute information from the convert destination.
//
Attributes *newAttr = mapTable->getMapInfo(valId)->getAttr();
// Add the original value to the local map table with the
// attribute information from the convert desination.
//
MapInfo *mapInfo = localMapTable->addMapInfoToThis
(valId.getItemExpr()->child(0)->getValueId(), newAttr);
// Nothing more needs to be done for this item.
//
mapInfo->codeGenerated();
}
}
return projectExpr;
} // PhysSequence::generateChildProjectExpression
示例4: markAsPreCodeGenned
//.........这里部分代码省略.........
CollHeap *wHeap = generator->wHeap();
ItemExpr *itmChild = child(0)->castToItemExpr();
ItemExpr *itmWindow = child(1)->castToItemExpr();
// What scalar operation needs to be done.
//
OperatorTypeEnum operation;
if(getOperatorType() == ITM_MOVING_MIN) operation = ITM_SCALAR_MIN;
else operation = ITM_SCALAR_MAX;
// Allocate a HostVar for local storage of the index.
//
ItemExpr *itmLocalCounter
= new(wHeap) HostVar("_sys_LocalCounter",
new(wHeap) SQLInt(wHeap, TRUE,FALSE),
TRUE);
// Expression to initailize the iterator.
//
ItemExpr *itmLocalCounterInitialize
= new(wHeap) Assign(itmLocalCounter,
new(wHeap) ConstValue(0),
FALSE);
// Expression to increment the iterator.
//
ItemExpr *itmLocalCounterIncrement
= new(wHeap) Assign(itmLocalCounter,
new(wHeap) BiArith(ITM_PLUS,
itmLocalCounter,
new (wHeap) ConstValue(1)),
FALSE);
// Allocate a HostVar for referencing the result before it is computed.
//
ItemExpr *itmResult
= new(wHeap) HostVar("_sys_Result",
getValueId().getType().newCopy(wHeap),
TRUE);
// Expression to initialize the result.
//
ItemExpr *itmResultInitialize
= new(wHeap) Assign(itmResult,
new(wHeap) ConstValue());
// Expression to compute the min/max.
//
ItemExpr *itmOffsetExpr = new(wHeap) ItmSeqOffset( itmChild, itmLocalCounter);
((ItmSeqOffset *)itmOffsetExpr)->setIsOLAP(isOLAP());
ItemExpr *itmResultUpdate
= new(wHeap) Assign(itmResult,
new(wHeap) ItmScalarMinMax(operation,
itmResult,
itmOffsetExpr));
// Construct code blocks for the initialization and body for the while-loop
//
ItemExpr *itmInit
= new(wHeap) ItmBlockFunction(itmLocalCounterInitialize,
itmResultInitialize);
ItemExpr *itmBody
= new(wHeap) ItmBlockFunction(itmResultUpdate,
itmLocalCounterIncrement);
// Construct the While loop (i < window)
//
ItemExpr *itmLoopCondition = new(wHeap) BiRelat
(ITM_LESS, itmLocalCounter, itmWindow);
ItemExpr *itmWhile
= new(wHeap) ItmWhileFunction(itmBody,
itmLoopCondition);
// Construct the blocks to contain the initialization and looping.
// The result is the final value of the min/max.
//
ItemExpr *itmBlock = new(wHeap) ItmBlockFunction
(new(wHeap) ItmBlockFunction(itmInit, itmWhile),
itmResult);
// Replace the item for this value id with the new item expression.
//
getValueId().replaceItemExpr(itmBlock);
// Run the new expression through type and value Id synthesis.
//
itmBlock->synthTypeAndValueId(TRUE);
// Map the reference to the result to the actual result in the map table.
//
Attributes *attr = generator->getMapInfo(itmBlock->getValueId())->getAttr();
MapInfo *mapInfo = generator->addMapInfo(itmResult->getValueId(), attr);
itmResult->markAsPreCodeGenned();
mapInfo->codeGenerated();
// Return the preCodeGen of the new expression.
//
return itmBlock->preCodeGen(generator);
}
示例5: GenAssert
//.........这里部分代码省略.........
// Expression to increment the iterator.
//
ItemExpr *itmLocalCounterIncrement
= new(wHeap) Assign(itmLocalCounter,
new(wHeap) BiArith(ITM_PLUS,
itmLocalCounter,
new (wHeap) ConstValue(1)),
FALSE);
// Allocate a HostVar for referencing the result before it is computed.
//
ItemExpr *itmResult
= new(wHeap) HostVar("_sys_Result",
getValueId().getType().newCopy(wHeap),
TRUE);
// Expression to initialize the result.
//
ItemExpr *itmResultInitialize
= new(wHeap) Assign(itmResult,
new(wHeap) ConstValue());
// Expression to compute the min/max.
//
ItemExpr * invCouter= new(wHeap) BiArith(ITM_MINUS,
new (wHeap) ConstValue(0),
itmLocalCounter);
ItemExpr * itmOffsetExpr = new(wHeap) ItmSeqOffset( itmChild, invCouter);
//ItemExpr * itmOffsetIsNotNull = new (wHeap) UnLogic(ITM_IS_NOT_NULL, itmOffsetExpr);
((ItmSeqOffset *)itmOffsetExpr)->setIsOLAP(isOLAP());
ItemExpr *itmResultUpdate
= new(wHeap) Assign(itmResult,
new(wHeap) ItmScalarMinMax(operation,
itmResult,
itmOffsetExpr));
// Construct code blocks for the initialization and body for the while-loop
//
ItemExpr *itmInit
= new(wHeap) ItmBlockFunction(itmLocalCounterInitialize,
itmResultInitialize);
ItemExpr *itmBody
= new(wHeap) ItmBlockFunction(itmResultUpdate,
itmLocalCounterIncrement);
// Construct the While loop (i < window)
//
ItemExpr *itmLoopCondition = new(wHeap) BiRelat
(ITM_LESS_EQ, itmLocalCounter, new(wHeap) ConstValue(frameEnd_));
if (isFrameEndUnboundedFollowing()) //(frameEnd_ == INT_MAX)// not needed in other cases -- can cause issues fo the preceding part
{
ItemExpr * itmOffset1 = new(wHeap) ItmSeqOffset( itmChild, invCouter,NULL,TRUE);
ItemExpr * itmOffset1IsNotNull = new (wHeap) UnLogic(ITM_IS_NOT_NULL, itmOffset1);
((ItmSeqOffset *)itmOffset1)->setIsOLAP(isOLAP());
itmLoopCondition = itmOffset1IsNotNull;
//new (wHeap) BiLogic( ITM_AND,
// itmLoopCondition,
// itmOffset1IsNotNull);
}
ItemExpr *itmWhile
= new(wHeap) ItmWhileFunction(itmBody,
itmLoopCondition);
// Construct the blocks to contain the initialization and looping.
// The result is the final value of the min/max.
//
ItemExpr *itmBlock = new(wHeap) ItmBlockFunction
(new(wHeap) ItmBlockFunction(itmInit, itmWhile),
itmResult);
// Replace the item for this value id with the new item expression.
//
getValueId().replaceItemExpr(itmBlock);
// Run the new expression through type and value Id synthesis.
//
itmBlock->synthTypeAndValueId(TRUE);
// Map the reference to the result to the actual result in the map table.
//
Attributes *attr = generator->getMapInfo(itmBlock->getValueId())->getAttr();
MapInfo *mapInfo = generator->addMapInfo(itmResult->getValueId(), attr);
itmResult->markAsPreCodeGenned();
mapInfo->codeGenerated();
// Return the preCodeGen of the new expression.
//
return itmBlock->preCodeGen(generator);
}
示例6: changeValues
//.........这里部分代码省略.........
0, 2, offExpr, itmChild);
}
break;
case ITM_RUNNING_CHANGE:
{
// The running change (or 'rows since changed') can have a
// composite child (a list of values)
// Convert the list of values to a list of offset of values.
//
ItemExpr *offChild = itmChild;
if (itmChild->getOperatorType() == ITM_ITEM_LIST)
{
// child is a multi-valued expression, transform into multiple
//
ExprValueId treePtr = itmChild;
ItemExprTreeAsList changeValues(&treePtr,
ITM_ITEM_LIST,
RIGHT_LINEAR_TREE);
offChild = new(wHeap) ItmSeqOffset( changeValues[0], 1);
((ItmSeqOffset *)offChild)->setIsOLAP(isOLAP());
// add Offset expressions for all the items of the list
//
CollIndex nc = changeValues.entries();
for (CollIndex i = 1; i < nc; i++)
{
ItemExpr *off = new(generator->wHeap()) ItmSeqOffset( changeValues[i], 1);
((ItmSeqOffset *)off)->setIsOLAP(isOLAP());
offChild = new(generator->wHeap()) ItemList(offChild, off);
}
} else {
offChild = new(wHeap) ItmSeqOffset( offChild, 1);
((ItmSeqOffset *)offChild)->setIsOLAP(isOLAP());
}
((ItmSeqOffset *)offExpr)->setNullRowIsZero(TRUE);
ItemExpr *prevValue = offExpr;
// Compare the value(s) to the previous value(s). Use special
// NULLs flags to treat NULLs as values. Two NULL values are
// considered equal here.
//
ItemExpr *pred = new (wHeap) BiRelat(ITM_EQUAL,
itmChild,
offChild,
TRUE); // Special NULLs
// running change =
// (value(s) == prev(value(s))) ? prev(running change)+1 : 1
//
// Compute base value.
//
itmNewSeqFunc = new (wHeap)
IfThenElse(pred, prevValue, new (wHeap) SystemLiteral(0));
itmNewSeqFunc = new (wHeap) Case(NULL, itmNewSeqFunc);
// Force the evaluation of the offset expression so that the
// result can be reused by subsequent references.
//
itmNewSeqFunc = new(wHeap) ItmBlockFunction(offChild, itmNewSeqFunc);
// Increment the base value.
//
itmNewSeqFunc = new (wHeap) BiArith(ITM_PLUS,
itmNewSeqFunc,
new(wHeap) SystemLiteral(1));
}
break;
}
// Get value Ids and types for all of the items. Must do this typing before
// replacing this value Id's item expression -- otherwise, the typing
// will give a result different than the type already computed for this
// sequence function.
//
GenAssert(itmNewSeqFunc, "ItmSeqRunningFunction::preCodeGen -- Unexpected Operator Type!");
itmNewSeqFunc->synthTypeAndValueId(TRUE);
// Replace the original value ID with the new expression.
//
getValueId().replaceItemExpr(itmNewSeqFunc);
// Map the reference to the result to the actual result in the map table.
//
Attributes *attr = generator->getMapInfo
(itmNewSeqFunc->getValueId())->getAttr();
MapInfo *mapInfo = generator->addMapInfo(itmResult->getValueId(), attr);
itmResult->markAsPreCodeGenned();
mapInfo->codeGenerated();
// Return the preCodeGen of the new expression.
//
return itmNewSeqFunc->preCodeGen(generator);
}