本文整理汇总了C++中ExprTree::Flatten方法的典型用法代码示例。如果您正苦于以下问题:C++ ExprTree::Flatten方法的具体用法?C++ ExprTree::Flatten怎么用?C++ ExprTree::Flatten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExprTree
的用法示例。
在下文中一共展示了ExprTree::Flatten方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindExpr
bool AttributeReference::
_Flatten( EvalState &state, Value &val, ExprTree*&ntree, int*) const
{
ExprTree *tree;
ExprTree *dummy;
const ClassAd *curAd;
bool rval;
ntree = NULL; // Just to be safe... wenger 2003-12-11.
// find the expression and the evalstate
curAd = state.curAd;
switch( FindExpr( state, tree, dummy, false ) ) {
case EVAL_FAIL:
return false;
case EVAL_ERROR:
val.SetErrorValue();
state.curAd = curAd;
return true;
case EVAL_UNDEF:
if( expr && state.flattenAndInline ) {
ExprTree *expr_ntree = NULL;
Value expr_val;
if( state.depth_remaining <= 0 ) {
val.SetErrorValue();
state.curAd = curAd;
return false;
}
state.depth_remaining--;
rval = expr->Flatten(state,expr_val,expr_ntree);
state.depth_remaining++;
if( rval && expr_ntree ) {
ntree = MakeAttributeReference(expr_ntree,attributeStr);
if( ntree ) {
state.curAd = curAd;
return true;
}
}
delete expr_ntree;
}
if( !(ntree = Copy( ) ) ) {
CondorErrno = ERR_MEM_ALLOC_FAILED;
CondorErrMsg = "";
state.curAd = curAd;
return( false );
}
state.curAd = curAd;
return true;
case EVAL_OK:
{
// Don't flatten or inline a classad that's referred to
// by an attribute.
if ( tree->GetKind() == CLASSAD_NODE ) {
ntree = Copy( );
val.SetUndefinedValue( );
return true;
}
if( state.depth_remaining <= 0 ) {
val.SetErrorValue();
state.curAd = curAd;
return false;
}
state.depth_remaining--;
rval = tree->Flatten( state, val, ntree );
state.depth_remaining++;
// don't inline if it didn't flatten to a value, and clear cache
// do inline if FlattenAndInline was called
if( ntree ) {
if( state.flattenAndInline ) { // NAC
return true; // NAC
} // NAC
delete ntree;
ntree = Copy( );
val.SetUndefinedValue( );
}
state.curAd = curAd;
return rval;
}
default: CLASSAD_EXCEPT( "ClassAd: Should not reach here" );
}
return false;
}