Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.ap
Commits
e157d775
Commit
e157d775
authored
Feb 13, 2014
by
André Anjos
💬
Browse files
Implementing __call__()
parent
a741fae5
Changes
1
Hide whitespace changes
Inline
Side-by-side
xbob/ap/energy.cpp
View file @
e157d775
...
...
@@ -249,6 +249,39 @@ static PyGetSetDef PyBobApEnergy_getseters[] = {
{
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
=
{
PyVarObject_HEAD_INIT
(
0
,
0
)
s_energy_str
,
/*tp_name*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment