8 #ifndef INCLUDED_PYIMATHUTIL_H
9 #define INCLUDED_PYIMATHUTIL_H
44 PyAcquireLock &
operator = (PyAcquireLock& other) =
delete;
46 PyAcquireLock &
operator = (PyAcquireLock&& other) =
delete;
49 PyGILState_STATE _gstate;
68 PyReleaseLock &
operator = (PyReleaseLock& other) =
delete;
70 PyReleaseLock &
operator = (PyReleaseLock&& other) =
delete;
99 _object =
new T(value);
113 _object =
new T(*other._object);
119 if (&other ==
this)
return *
this;
121 *_object = *other._object;
128 if (&other ==
this)
return true;
130 return *_object == *other._object;
136 if (&other ==
this)
return false;
138 return *_object != *other._object;
141 T &
get() {
return *_object; }
142 const T &
get()
const {
return *_object; }
160 template <
class policy0,
class policy1,
class policy2>
166 if (!PyTuple_Check (result))
168 PyErr_SetString (PyExc_TypeError,
169 "selectable_postcall: retval was not a tuple");
172 if (PyTuple_Size(result) != 2)
174 PyErr_SetString (PyExc_IndexError,
175 "selectable_postcall: retval was not a tuple of length 2");
180 PyObject* object0 = PyTuple_GetItem (result, 0);
181 PyObject* object1 = PyTuple_GetItem (result, 1);
183 if (!PyInt_Check (object0))
185 PyErr_SetString (PyExc_TypeError,
186 "selectable_postcall: tuple item 0 was not an integer choice");
190 const long usePolicy = PyInt_AsLong (object0);
197 return policy0::postcall (args, object1);
198 else if (usePolicy == 1)
199 return policy1::postcall (args, object1);
201 return policy2::postcall (args, object1);
PYIMATH_EXPORT ~PyReleaseLock()
PYIMATH_EXPORT PyReleaseLock()
bool operator==(const PySafeObject &other) const
GLsizei const GLfloat * value
PySafeObject(const T &value)
**But if you need a result
PYIMATH_EXPORT PyAcquireLock()
PyAcquireLock & operator=(PyAcquireLock &other)=delete
bool operator!=(const PySafeObject &other) const
PYIMATH_EXPORT ~PyAcquireLock()
const PySafeObject & operator=(const PySafeObject &other)
static PyObject * postcall(PyObject *args, PyObject *result)
PySafeObject(const PySafeObject &other)
**If you just want to fire and args
PyReleaseLock & operator=(PyReleaseLock &other)=delete