void PrinterVisitor:: beginVisitMaterializeVariable( bool forVar, PlanIter_t inputVar, vector<PlanIter_t> const &varRefs ) { ostringstream iv_s; if ( forVar ) { thePrinter.startBeginVisit( "MaterializeForVariable", theId ); ForVarIterator *const i = static_cast<ForVarIterator*>( inputVar.getp() ); iv_s << i->getVarName()->getStringValue() << " : "; if ( !Properties::instance().getNoTreeIDs() ) iv_s << i; } else { thePrinter.startBeginVisit( "MaterializeLetVariable", theId ); LetVarIterator *const i = static_cast<LetVarIterator*>( inputVar.getp() ); iv_s << i->getVarName()->getStringValue() << " : " ; if ( !Properties::instance().getNoTreeIDs() ) iv_s << i; } string const ref_s( var_refs( varRefs ) ); thePrinter.addAttribute( "inputVar", iv_s.str() ); if ( !Properties::instance().getNoTreeIDs() ) thePrinter.addAttribute( "referenced-by", ref_s ); thePrinter.endBeginVisit( theId ); }
PlanIter_t FunctionItem::getImplementation(CompilerCB* ccb) { std::vector<PlanIter_t> args; expr* dummy = ccb->theEM-> create_function_item_expr(NULL, NULL, theFunctionItemInfo->theLoc, false, false); PlanIter_t udfCallIterator = theFunctionItemInfo->theFunction-> codegen(ccb, theFunctionItemInfo->theClosureSctx, theFunctionItemInfo->theLoc, args, *dummy); UDFunctionCallIterator* udfIter = static_cast<UDFunctionCallIterator*>(udfCallIterator.getp()); udfIter->setDynamic(); udfIter->setFunctionItem(this); return udfCallIterator; }
void PrinterVisitor:: beginVisitMaterializeVariable( bool forVar, PlanIter_t inputVar, vector<PlanIter_t> const &varRefs ) { ostringstream iv_s; if ( forVar ) { thePrinter.startBeginVisit( "MaterializeForVariable", theId ); ForVarIterator *const i = static_cast<ForVarIterator*>( inputVar.getp() ); iv_s << i->getVarName()->getStringValue(); if ( !Properties::instance().getNoTreeIDs() ) { #ifndef NDEBUG if ( Properties::instance().getStableIteratorIDs() ) iv_s << " : " << inputVar->getId(); else #endif iv_s << " : " << inputVar.getp(); } } else { thePrinter.startBeginVisit( "MaterializeLetVariable", theId ); LetVarIterator *const i = static_cast<LetVarIterator*>( inputVar.getp() ); iv_s << i->getVarName()->getStringValue(); if ( !Properties::instance().getNoTreeIDs() ) { #ifndef NDEBUG if ( Properties::instance().getStableIteratorIDs() ) iv_s << " : " << inputVar->getId(); else #endif iv_s << " : " << inputVar.getp(); } } thePrinter.addAttribute( "inputVar", iv_s.str() ); if ( !Properties::instance().getNoTreeIDs() ) printVarRefs( "referenced-by", varRefs ); thePrinter.endBeginVisit( theId ); }
/******************************************************************************* The getImplementation function assumes the dynChildren vector comes from a DynamicFnCallIterator, and as such, the first element of dynChildren is the function item itself, so it will be skipped. ********************************************************************************/ PlanIter_t FunctionItem::getImplementation( const std::vector<PlanIter_t>& dynChildren, CompilerCB* ccb) { std::vector<PlanIter_t> args; args.resize(theArgValues.size()); std::vector<PlanIter_t>::iterator argsIte = args.begin(); std::vector<PlanIter_t>::iterator ite = theArgValues.begin(); std::vector<PlanIter_t>::const_iterator ite2 = dynChildren.begin(); ++ite2; // skip the first child because it's the function item for( ; argsIte != args.end(); ++argsIte, ++ite) { if (*ite != NULL) { *argsIte = *ite; static_cast<PlanStateIteratorWrapper*>(ite->getp())->reset(); } else { *argsIte = *ite2; ++ite2; } } expr* dummy = ccb->theEM-> create_function_item_expr(NULL, NULL, theFunctionItemInfo->theLoc, false, false); PlanIter_t udfCallIterator = theFunctionItemInfo->theFunction-> codegen(ccb, theFunctionItemInfo->theClosureSctx, theFunctionItemInfo->theLoc, args, *dummy); UDFunctionCallIterator* udfIter = static_cast<UDFunctionCallIterator*>(udfCallIterator.getp()); udfIter->setDynamic(); udfIter->setFunctionItem(this); return udfCallIterator; }
XQueryImpl::PlanProxy::PlanProxy(PlanIter_t& root) : theRootIter(root.getp()) { }