|
|
| 143 |
return NULL; |
143 |
return NULL; |
| 144 |
} |
144 |
} |
| 145 |
|
145 |
|
|
|
146 |
PyObject * |
| 147 |
_wrap_Simulator_ScheduleWithContext(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, |
| 148 |
PyObject **return_exception) |
| 149 |
{ |
| 150 |
PyObject *exc_type, *traceback; |
| 151 |
PyObject *py_obj_context; |
| 152 |
uint32_t py_context; |
| 153 |
PyObject *py_time; |
| 154 |
PyObject *py_callback; |
| 155 |
PyObject *user_args; |
| 156 |
PythonEventImpl *py_event_impl; |
| 157 |
|
| 158 |
if (kwargs && PyObject_Length(kwargs) > 0) { |
| 159 |
PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); |
| 160 |
goto error; |
| 161 |
} |
| 162 |
|
| 163 |
if (PyTuple_GET_SIZE(args) < 3 ) { |
| 164 |
PyErr_SetString(PyExc_TypeError, "ns3.Simulator.ScheduleWithContext needs at least 3 arguments"); |
| 165 |
goto error; |
| 166 |
} |
| 167 |
|
| 168 |
py_obj_context = PyTuple_GET_ITEM(args, 0); |
| 169 |
py_time = PyTuple_GET_ITEM(args, 1); |
| 170 |
py_callback = PyTuple_GET_ITEM(args, 2); |
| 171 |
|
| 172 |
if (!PyLong_Check(py_obj_context)) { |
| 173 |
PyErr_SetString(PyExc_TypeError, "Parameter 1 should be uint32_t"); |
| 174 |
goto error; |
| 175 |
} |
| 176 |
if (!PyObject_IsInstance(py_time, (PyObject*) &PyNs3Time_Type)) { |
| 177 |
PyErr_SetString(PyExc_TypeError, "Parameter 2 should be a ns3.Time instance"); |
| 178 |
goto error; |
| 179 |
} |
| 180 |
if (!PyCallable_Check(py_callback)) { |
| 181 |
PyErr_SetString(PyExc_TypeError, "Parameter 3 should be callable"); |
| 182 |
goto error; |
| 183 |
} |
| 184 |
|
| 185 |
py_context = PyLong_AsUnsignedLong(py_obj_context); |
| 186 |
|
| 187 |
user_args = PyTuple_GetSlice(args, 3, PyTuple_GET_SIZE(args)); |
| 188 |
py_event_impl = new PythonEventImpl (py_callback, user_args); |
| 189 |
Py_DECREF(user_args); |
| 190 |
|
| 191 |
ns3::Simulator::ScheduleWithContext(py_context, *((PyNs3Time *) py_time)->obj,py_event_impl); |
| 192 |
|
| 193 |
//Python functions always expect a return type. In case of C/C++ void function this return type should be None (a.k.a Py_None) |
| 194 |
//It is necesary to increment the reference count to the Py_None object before returning it because it is going to be decremented later on. |
| 195 |
Py_INCREF(Py_None); |
| 196 |
return Py_None; |
| 197 |
|
| 198 |
error: |
| 199 |
PyErr_Fetch(&exc_type, return_exception, &traceback); |
| 200 |
Py_XDECREF(exc_type); |
| 201 |
Py_XDECREF(traceback); |
| 202 |
return NULL; |
| 203 |
} |
| 146 |
|
204 |
|
| 147 |
PyObject * |
205 |
PyObject * |
| 148 |
_wrap_Simulator_ScheduleDestroy (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, |
206 |
_wrap_Simulator_ScheduleDestroy (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, |