Exemple #1
0
/* boilerplate to turn the queue into a real AbstractExpression tree;
   return the generated AE tree by reference to allow deletion (the queue
   is emptied by the tree building process) */
AbstractExpression * convertToExpression(queue<AE*> &e) {
    AE *tree = makeTree(NULL, e);
    json_spirit::Object json = tree->serializeValue();
    AbstractExpression * exp = AbstractExpression::buildExpressionTree(json);
    delete tree;
    return exp;
}
/* boilerplate to turn the queue into a real AbstractExpression tree;
   return the generated AE tree by reference to allow deletion (the queue
   is emptied by the tree building process) */
AbstractExpression * convertToExpression(queue<AE*> &e) {
    AE *tree = makeTree(NULL, e);
    Json::Value json = tree->serializeValue();
    Json::FastWriter writer;
    std::string jsonText = writer.write(json);

    PlannerDomRoot domRoot(jsonText.c_str());

    AbstractExpression * exp = AbstractExpression::buildExpressionTree(domRoot.rootObject());
    delete tree;
    return exp;
}