From fb55fd6737902ed6270c2518bdc81a6971f9b3a1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 10 Apr 2013 00:21:31 -0700 Subject: gras: formalize the weak container api w/ docs address issue #69, we now have a set_container call, which is now formally part of the api. Anyone can call set_container for custom container types. GRAS supports shared ptr and pyobject out of the box. --- python/gras/GRAS_HierBlock.i | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'python/gras') diff --git a/python/gras/GRAS_HierBlock.i b/python/gras/GRAS_HierBlock.i index 2ffb349..65eb8d1 100644 --- a/python/gras/GRAS_HierBlock.i +++ b/python/gras/GRAS_HierBlock.i @@ -35,11 +35,11 @@ //////////////////////////////////////////////////////////////////////// // weak element overload for python //////////////////////////////////////////////////////////////////////// -%inline %{ +%{ -struct WeakElementPyObject : gras::WeakElement +struct WeakContainerPyObject : gras::WeakContainer { - WeakElementPyObject(PyObject *o): + WeakContainerPyObject(PyObject *o): o(o) { //NOP @@ -53,11 +53,13 @@ struct WeakElementPyObject : gras::WeakElement inline void set_weak_py_self(gras::Element &elem, PyObject *o) { - elem.weak_self.reset(new WeakElementPyObject(o)); + elem.set_container(new WeakContainerPyObject(o)); } %} +void set_weak_py_self(gras::Element &elem, PyObject *o); + //////////////////////////////////////////////////////////////////////// // Make a special top block with python safe unlocking wait //////////////////////////////////////////////////////////////////////// -- cgit