本文整理汇总了C++中TreeNode::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::clone方法的具体用法?C++ TreeNode::clone怎么用?C++ TreeNode::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testDeath
void QueryParser::testDeath(string _zap)
{
try {
TreeNode *tree = parser->parse(_zap).release();
tree->putToString();
QParser::DeathRmver *rmver = new QParser::DeathRmver(this);
TreeNode *nt = tree->clone();
rmver->rmvDeath(nt);
} catch (...) {
}
}
示例2: testParse
int QueryParser::testParse (string query, TreeNode *&/*qTree*/) {
string zap = "EMP where SAL = (EMP where NAME=\"KUBA\").SAL;";
if (false && (query == zap)){
TreeNode *tree = parser->parse(zap).release();
//printf( "po parsowaniu treeNode: %d. \n", tree);
cout << "Odczyt z drzewka, ktore przekazuje:" << endl;
cout << "--------------------------------------" << endl;
tree->putToString();
cout << "\n--------------------------------------" << endl;
QParser::Optimiser *opt = new QParser::Optimiser();
int reslt;
cout << "now the following tree will be evaluated statically.." << endl;
TreeNode *nt = tree->clone();
if ((reslt = opt->stEvalTest(nt)) != 0)
fprintf (stderr, "static evaluation did not work out...\n");
else {
cout << "static evaluatioin OK, result: "<< reslt << endl;
fprintf (stderr, "now I will try to optimise the tree..\n");
cout << "OPTYMALIZUJE--------------------------------------------------------"<< endl;
//cout << "przed optymalizacjia" << endl;
//nt->putToString();
//cout << "-----------" << endl;
int ooptres = nt->optimizeTree();
cout << "KONIEC OPTYMALIZACJI-------------------------------------------------------"<< endl;
/*the nt tree needs to be 'rolled' up: (in case the nonalgopnode
we were operating on was the root... */
while (nt->getParent() != NULL) nt = nt->getParent();
fprintf (stderr, "__%d__", ooptres);
cout << "po JEDNYM PRZEBIEGU optymalizacji" << endl;
nt->putToString();
cout << "-----------" << endl;
fprintf (stderr, "end of optimisation.\n");
}
cout << "TEST END__---------------------------------------------------------------------------------" << endl;
}
cout << "koniec parseIt\n";
return 0;
}