示例#1
0
Value Operator::value_calculate(Value v, EvalContext context)
{
    static const char* c_capture_name = "predicate_operator_capture";

    if (! m_data) {
        BOOST_THROW_EXCEPTION(
            einval() << errinfo_what(
                "Evaluation without pre evaluation!"
            )
        );
    }

    IronBee::Field capture = IronBee::Field::create_no_copy_list<void *>(
        context.memory_pool(),
        c_capture_name,
        sizeof(c_capture_name) - 1,
        List<void *>::create(context.memory_pool())
    );

    int success = 0;
    try {
        success = m_data->op.execute_instance(
            m_data->instance_data,
            context,
            v,
            capture
        );
    }
    catch (const error& e) {
        string old_what = *boost::get_error_info<errinfo_what>(e);
        e << errinfo_what(
            "Predicate operator failure for " +
            to_s() + " : " + old_what
        );
        throw e;
    }

    if (success) {
        return capture;
    }
    else {
        return Value();
    }
}
示例#2
0
Value Transformation::value_calculate(Value v, EvalContext context)
{
    if (! m_data) {
        BOOST_THROW_EXCEPTION(
            einval() << errinfo_what(
                "Reset without pre evaluation!"
            )
        );
    }

    return m_data->transformation.execute(context.memory_pool(), v);
}