本文整理汇总了C++中NodeValue::size方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeValue::size方法的具体用法?C++ NodeValue::size怎么用?C++ NodeValue::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeValue
的用法示例。
在下文中一共展示了NodeValue::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleTableCases
bool OperationNodeScript::handleTableCases(int index, const NodeValue& vright, const QString &operation,
const QString& relation, SymbolTable &symbols, ExecutionContext *ctx) {
if ( index >= vright.size())
return false;
QString expr;
if ( SymbolTable::isNumerical(vright[index]) && SymbolTable::isDataLink(_value[index])){
expr = QString("%1(%2,%3,%4,%5)").arg(operation).arg(_value.toString(index)).
arg(additionalInfo(ctx,_value.toString(index))).
arg(vright.toDouble(index)).arg(relation);
} else if (SymbolTable::isNumerical(_value[index]) && SymbolTable::isDataLink(vright[index])){
expr = QString("%1(%2,%3,%4, %5)").arg(operation).arg(vright.toString(index)).
arg(additionalInfo(ctx,vright.toString(index))).
arg(_value.toDouble(index)).arg(relation);
} else if (SymbolTable::isDataLink(_value[index]) && SymbolTable::isDataLink(vright[index])) {
expr = QString("%1(%2,%3,%4,%5)").arg(operation).arg(vright.toString(index)).arg(_value.toString(index)).arg(relation);
} else if (SymbolTable::isDataLink(vright[index]) && SymbolTable::isNumerical(_value[index])) {
expr = QString("%1(%2,%3,%4,%5)").arg(operation).arg(vright.toString(index)).arg(_value.toDouble(index)).arg(relation);
}
bool ok = Ilwis::commandhandler()->execute(expr, ctx,symbols);
if ( !ok || ctx->_results.size() != 1)
return false;
_value = {ctx->_results[0], NodeValue::ctID};
return true;
}
示例2: typesUsed
IlwisTypes OperationNodeScript::typesUsed(int index, const NodeValue& vright, SymbolTable &symbols) const {
if ( index >= vright.size())
return itUNKNOWN;
IlwisTypes tp1 = symbols.ilwisType(vright[index], vright.id(index));
IlwisTypes tp2 = symbols.ilwisType(_value[index], _value.id(index));
if ( tp1 == itUNKNOWN || tp2 == itUNKNOWN)
return itUNKNOWN;
return tp1 | tp2;
}
示例3: evaluate
bool AssignmentNode::evaluate(SymbolTable& symbols, int scope, ExecutionContext *ctx)
{
if ( _expression.isNull())
return false;
try{
bool ok = _expression->evaluate(symbols, scope, ctx);
if ( ok) {
// we save the additional info as we might need it but for the rest clear
// the results as the result of the assignment node is a newly filled ctx
auto additionalInfo = ctx->_additionalInfo;
ctx->clear(true);
NodeValue val = _expression->value();
for(int i = 0; i < val.size(); ++i) {
Symbol sym = symbols.getSymbol(val.id(i),SymbolTable::gaREMOVEIFANON);
IlwisTypes tp = sym.isValid() ? sym._type : itUNKNOWN;
QString result = _outParms->id(i);
if ( hasType(tp, itILWISOBJECT | itCOLUMN)) {
if ( hasType(tp, itRASTER)) {
ok &= copyObject<RasterCoverage>(sym, result,symbols);
}
else if (hasType(tp, itFEATURE))
ok &= copyObject<FeatureCoverage>(sym, result,symbols);
else if (hasType(tp, itCOORDSYSTEM))
ok &= copyObject<CoordinateSystem>(sym, result,symbols);
else if ( hasType(tp, itDOMAIN)){
ok &= copyObject<Domain>(sym, result,symbols);
} else if ( hasType(tp, itGEOREF)){
ok &= copyObject<GeoReference>(sym, result,symbols);
} else if (hasType(tp, itTABLE | itCOLUMN)){
ok &= copyObject<Table>(sym, result,symbols,true);
QSharedPointer<Selector> selector = _outParms->selector(result);
if (!selector.isNull()){
QString varName = selector->variable();
ITable source = sym._var.value<ITable>();
QString oldColName = additionalInfo[source->name()].toString();
QVariant newT= symbols.getValue(result);
ITable newTable = newT.value<ITable>();
ColumnDefinition& coldef = newTable->columndefinitionRef(oldColName);
if ( coldef.isValid()){
coldef.name(varName);
}
}
}
if(!ok) {
throw ErrorObject(QString(TR(ERR_OPERATION_FAILID1).arg("assignment")));
}
QSharedPointer<ASTNode> specifier = _outParms->specifier(_outParms->id(i));
if ( !specifier.isNull()) {
if ( specifier->noOfChilderen()!= 1)
return ERROR2(ERR_NO_OBJECT_TYPE_FOR_2, "Output object", "expression");
store2Format(specifier, sym, result);
}
ctx->_results.push_back(result);
} else {
sym = symbols.getSymbol(result,SymbolTable::gaREMOVEIFANON);
tp = sym.isValid() ? sym._type : itUNKNOWN;
if ( tp == itUNKNOWN) {
tp = Domain::ilwType(val);
}
}
//ctx->addOutput(symbols,_expression->value(),result, tp, Resource());
}
}
return ok;
} catch(const ErrorObject&){
}
return false;
}