Esempio n. 1
0
/*         false if bind is not successfull.                           */
bool PyFunction::bind(const bp::object& dict, std::string funcname)
{
#if BOOST_VERSION >= 104100
    if(bp::extract<bool>(dict.contains(funcname)))
#else
    if(PyDict_Contains(dict.ptr(), bp::object(funcname).ptr()))
#endif
    {
        _func = dict[funcname];
        _isValid = true;
    }
    else
    {
        _isValid = false;
        std::cerr << "[PyFunction] Error binding function '" << funcname << "'." << std::endl;
    }

    return _isValid;
}