本文整理汇总了C++中HqlExprArray类的典型用法代码示例。如果您正苦于以下问题:C++ HqlExprArray类的具体用法?C++ HqlExprArray怎么用?C++ HqlExprArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HqlExprArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: peepholeOptimize
IHqlExpression * peepholeOptimize(BuildCtx & ctx, IHqlExpression * expr)
{
switch (expr->getOperator())
{
case no_eq:
case no_ne:
case no_le:
case no_lt:
case no_ge:
case no_gt:
return peepholeOptimizeCompare(ctx, expr);
case no_and:
case no_or:
case no_not:
{
HqlExprArray args;
bool same = true;
ForEachChild(i, expr)
{
IHqlExpression * cur = expr->queryChild(i);
IHqlExpression * optimized = peepholeOptimize(ctx, expr);
args.append(*optimized);
if (cur != optimized)
same = false;
}
if (!same)
return expr->clone(args);
break;
}
}
示例2: extractOutputs
void HqlCppLibrary::extractOutputs()
{
HqlExprArray symbols;
scopeExpr->queryScope()->getSymbols(symbols);
IHqlScope * scope = scopeExpr->queryScope();
HqlDummyLookupContext dummyctx(NULL);
ForEachItemIn(i, symbols)
{
IHqlExpression & cur = symbols.item(i);
if (isExported(&cur))
{
_ATOM name = cur.queryName();
OwnedHqlExpr value = scope->lookupSymbol(name, LSFpublic, dummyctx);
if (value && !value->isFunction())
{
if (value->isDataset() || value->isDatarow() || value->queryType()->isScalar())
{
OwnedHqlExpr null = createNullExpr(value);
outputs.append(*cur.cloneAllAnnotations(null));
}
}
}
}
示例3: checkAssignOk
void CChildLinkedDatasetColumnInfo::buildDeserialize(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector, IHqlExpression * helper, IAtom * serializeFormat)
{
if (isConditional())
checkAssignOk(translator, ctx, selector, queryZero(), sizeof(size32_t) + sizeof(byte * *));
OwnedHqlExpr addressSize = getColumnAddress(translator, ctx, selector, sizetType, 0);
OwnedHqlExpr addressData = getColumnAddress(translator, ctx, selector, queryType(), sizeof(size32_t));
IHqlExpression * record = column->queryRecord();
CHqlBoundTarget boundTarget;
boundTarget.count.setown(convertAddressToValue(addressSize, sizetType));
boundTarget.expr.setown(convertAddressToValue(addressData, queryType()));
IIdAtom * func = NULL;
HqlExprArray args;
args.append(*translator.createSerializer(ctx, record, serializeFormat, deserializerAtom));
if (column->isDictionary())
{
if (serializeFormat == diskAtom)
{
func = deserializeChildDictionaryFromDatasetFromStreamId;
StringBuffer lookupHelperName;
translator.buildDictionaryHashClass(record, lookupHelperName);
args.append(*createQuoted(lookupHelperName.str(), makeBoolType()));
}
else
func = deserializeChildDictionaryFromStreamId;
}
else
func = deserializeChildRowsetFromStreamId;
args.append(*LINK(helper));
OwnedHqlExpr call = translator.bindFunctionCall(func, args, queryType());
translator.buildExprAssign(ctx, boundTarget, call);
}
示例4: createLocationAttr
IHqlExpression * createLocationAttr(ISourcePath * sourcePath, int lineno, int column, int position)
{
HqlExprArray args;
args.append(*getSizetConstant(lineno));
args.append(*getSizetConstant(column));
args.append(*getSizetConstant(position));
if (sourcePath)
args.append(*createUnknown(no_attr, makeNullType(), filenameAtom, LINK(sourcePath)));
return createAttribute(_location_Atom, args);
}
示例5: getRootScopes
static void getRootScopes(HqlScopeArray & rootScopes, IHqlScope * scope)
{
HqlExprArray rootSymbols;
scope->getSymbols(rootSymbols);
ForEachItemIn(i, rootSymbols)
{
IHqlExpression & cur = rootSymbols.item(i);
IHqlScope * scope = cur.queryScope();
if (scope)
rootScopes.append(*LINK(scope));
}
示例6: buildDeserializeChildLoop
void CColumnInfo::buildDeserializeChildLoop(HqlCppTranslator & translator, BuildCtx & loopctx, IReferenceSelector * selector, IHqlExpression * helper, IAtom * serializeForm)
{
OwnedHqlExpr endMarker = loopctx.getTempDeclare(sizetType, NULL);
HqlExprArray args;
args.append(*LINK(helper));
OwnedHqlExpr beginCall = translator.bindTranslatedFunctionCall(deserializerBeginNestedId, args);
loopctx.addAssign(endMarker, beginCall);
args.append(*LINK(helper));
args.append(*LINK(endMarker));
OwnedHqlExpr loopCall = createBoolExpr(no_not, translator.bindTranslatedFunctionCall(deserializerFinishedNestedId, args));
loopctx.addLoop(loopCall, NULL, false);
}
示例7: addMemberSelector
IHqlExpression * addMemberSelector(IHqlExpression * expr, IHqlExpression * selector)
{
if (!expr)
return NULL;
if (expr->getOperator() == no_variable)
return createValue(no_pselect, expr->getType(), LINK(selector), LINK(expr));
if (expr->numChildren() == 0)
return LINK(expr);
HqlExprArray args;
ForEachChild(i, expr)
args.append(*addMemberSelector(expr->queryChild(i), selector));
return expr->clone(args);
}
示例8: cvtIndexListToPairs
void cvtIndexListToPairs(HqlExprArray & target, IHqlExpression * from)
{
unsigned max = from->numChildren();
unsigned idx;
target.ensure(max);
for (idx = 0; idx < max; idx++)
{
IHqlExpression * v1 = from->queryChild(idx);
IHqlExpression * v2 = createConstant(createIntValue(idx+1, LINK(unsignedType)));
ITypeInfo * type = v2->queryType();
target.append(* createValue(no_mapto, LINK(type), LINK(v1), v2));
}
}
示例9: cvtInListToPairs
void cvtInListToPairs(HqlExprArray & target, IHqlExpression * from, bool valueIfMatch)
{
unsigned max = from->numChildren();
unsigned idx;
IHqlExpression * tValue = queryBoolExpr(valueIfMatch);
ITypeInfo * type = queryBoolType();
target.ensure(max);
for (idx = 0; idx < max; idx++)
{
IHqlExpression * v1 = from->queryChild(idx);
target.append(* createValue(no_mapto, LINK(type), LINK(v1), LINK(tValue)));
}
}
示例10: ForEachChild
ForEachChild(i, record)
{
IHqlExpression * cur = record->queryChild(i);
switch (cur->getOperator())
{
case no_record:
expandFieldNames(errorProcessor, out, cur, prefix, sep, formatFunc);
break;
case no_ifblock:
expandFieldNames(errorProcessor, out, cur->queryChild(1), prefix, sep, formatFunc);
break;
case no_field:
{
StringBuffer lowerName;
lowerName.append(cur->queryName()).toLowerCase();
if (formatFunc)
{
HqlExprArray args;
args.append(*createConstant(lowerName.str()));
OwnedHqlExpr bound = createBoundFunction(NULL, formatFunc, args, NULL, true);
OwnedHqlExpr folded = foldHqlExpression(errorProcessor, bound, NULL, HFOthrowerror|HFOfoldimpure|HFOforcefold);
assertex(folded->queryValue());
lowerName.clear();
getStringValue(lowerName, folded);
}
switch (cur->queryType()->getTypeCode())
{
case type_record:
case type_row:
{
unsigned len = prefix.length();
prefix.append(lowerName).append(".");
expandFieldNames(errorProcessor, out, cur->queryRecord(), prefix, sep, formatFunc);
prefix.setLength(len);
break;
}
default:
{
if (out.length())
out.append(sep);
out.append(prefix).append(lowerName);
break;
}
}
break;
}
}
}
示例11: getNumUniqueExpressions
unsigned getNumUniqueExpressions(const HqlExprArray & exprs)
{
TransformMutexBlock block;
ExpressionStatsInfo info;
ForEachItemIn(i, exprs)
calcNumUniqueExpressions(&exprs.item(i),info);
return info.count;
}
示例12: expandUnnamedFunnel
static void expandUnnamedFunnel(HqlExprArray & inputs, IHqlExpression * expr)
{
while ((expr->getOperator() == no_addfiles) && (expr->queryBody() == expr))
{
expandUnnamedFunnel(inputs, expr->queryChild(0));
expr = expr->queryChild(1);
}
inputs.append(*LINK(expr));
}
示例13: createLogicalGraph
void LogicalGraphCreator::createLogicalGraph(HqlExprArray & exprs)
{
graph.setown(createPTree("graph"));
// beginSubGraph(NULL, false);
ForEachItemIn(i, exprs)
createRootGraphActivity(&exprs.item(i));
// endSubGraph();
wu->createGraph("Logical", NULL, GraphTypeEcl, graph.getClear(), 0);
}
示例14: checkConsistent
void ScopeConsistencyChecker::checkConsistent(IHqlExpression * root, const HqlExprArray & _activeTables)
{
ForEachItemIn(i, _activeTables)
activeTables.append(OLINK(_activeTables.item(i)));
if (root->isDataset())
pushScope();
analyse(root, 0);
if (root->isDataset())
popScope();
}
示例15: queryActiveTableSelector
IHqlExpression * HqlCppCaseInfo::buildIndexedMap(BuildCtx & ctx, IHqlExpression * test, unsigned lower, unsigned upper)
{
ITypeInfo * compareType = test->queryType()->queryPromotedType();
type_t compareTypeCode = compareType->getTypeCode();
HqlExprArray values;
IHqlExpression * dft = queryActiveTableSelector(); // value doesn't matter as long as it will not occur
unsigned num = (upper-lower+1);
values.ensure(num);
unsigned idx;
for (idx = 0; idx < num; idx++)
values.append(*LINK(dft));
ForEachItemIn(idx2, pairs)
{
IHqlExpression & cur = pairs.item(idx2);
IValue * value = cur.queryChild(0)->queryValue();
unsigned replaceIndex;
switch (compareTypeCode)
{
case type_int:
replaceIndex = (int)value->getIntValue()-lower;
break;
case type_string:
{
StringBuffer temp;
value->getStringValue(temp);
replaceIndex = (int)(unsigned char)temp.charAt(0)-lower;
break;
}
default:
throwUnexpectedType(compareType);
}
IHqlExpression * mapTo = cur.queryChild(1);
if (mapTo->getOperator() != no_constant)
throwUnexpected();
if (replaceIndex >= num)
translator.reportWarning(CategoryIgnored, HQLWRN_CaseCanNeverMatch, "CASE entry %d can never match the test condition", replaceIndex);
else
values.replace(*LINK(mapTo),replaceIndex);
}