Ejemplo n.º 1
0
Py::Object ParameterGrpPy::getGroup(const Py::Tuple& args)
{
    char *pstr;
    if (!PyArg_ParseTuple(args.ptr(), "s", &pstr))
        throw Py::Exception();

    // get the Handle of the wanted group
    Base::Reference<ParameterGrp> handle = _cParamGrp->GetGroup(pstr);
    if (handle.isValid()) {
        // crate a python wrapper class
        ParameterGrpPy *pcParamGrp = new ParameterGrpPy(handle);
        // increment the reff count
        return Py::asObject(pcParamGrp);
    }
    else {
        throw Py::RuntimeError("GetGroup failed");
    }
}
Ejemplo n.º 2
0
PyObject *ParameterGrpPy::PyGetGrp(PyObject *args)
{
    char *pstr;
    if (!PyArg_ParseTuple(args, "s", &pstr))     // convert args: Python->C 
        return NULL;                             // NULL triggers exception 
    PY_TRY {
        // get the Handle of the wanted group
        Base::Reference<ParameterGrp> handle = _cParamGrp->GetGroup(pstr);
        if(handle.isValid()){
            // crate a python wrapper class
            ParameterGrpPy *pcParamGrp = new ParameterGrpPy(handle);
            // increment the reff count
            //pcParamGrp->_INCREF();
            return pcParamGrp;
        }else{
            PyErr_SetString(PyExc_IOError, "GetGroup failed");
            return 0L;
        }
    }PY_CATCH;
}