Skip to content
Snippets Groups Projects
Commit e157d775 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Implementing __call__()

parent a741fae5
Branches
Tags
No related merge requests found
...@@ -249,6 +249,39 @@ static PyGetSetDef PyBobApEnergy_getseters[] = { ...@@ -249,6 +249,39 @@ static PyGetSetDef PyBobApEnergy_getseters[] = {
{0} /* Sentinel */ {0} /* Sentinel */
}; };
static int PyBobApEnergy_Call
(PyBobApEnergyObject* self, PyObject *args, PyObject* kwds) {
/* Parses input arguments in a single shot */
static const char* const_kwlist[] = {"input", 0};
static char** kwlist = const_cast<char**>(const_kwlist);
PyBlitzArrayObject* input = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kwlist,
&PyBlitzArray_Converter, &input)) return 0;
//STOPPED HERE
try {
self->cxx = new bob::ap::Energy(sampling_frequency, win_length_ms, win_shift_ms);
if (!self->cxx) {
PyErr_Format(PyExc_MemoryError, "cannot create new object of type `%s' - no more memory", Py_TYPE(self)->tp_name);
return -1;
}
self->parent.cxx = self->cxx;
}
catch (std::exception& ex) {
PyErr_SetString(PyExc_RuntimeError, ex.what());
return -1;
}
catch (...) {
PyErr_Format(PyExc_RuntimeError, "cannot create new object of type `%s' - unknown exception thrown", Py_TYPE(self)->tp_name);
return -1;
}
return 0; ///< SUCCESS
}
PyTypeObject PyBobApEnergy_Type = { PyTypeObject PyBobApEnergy_Type = {
PyVarObject_HEAD_INIT(0, 0) PyVarObject_HEAD_INIT(0, 0)
s_energy_str, /*tp_name*/ s_energy_str, /*tp_name*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment