summaryrefslogtreecommitdiff
path: root/python/gras
diff options
context:
space:
mode:
authorJosh Blum2013-04-10 00:21:31 -0700
committerJosh Blum2013-04-10 00:21:31 -0700
commitfb55fd6737902ed6270c2518bdc81a6971f9b3a1 (patch)
treec31dcb488f97f4c016ad326c726d5f42bcb6bca0 /python/gras
parentca4819c56e7f085c1358cd75a9f4635ce3ae2f1f (diff)
downloadsandhi-fb55fd6737902ed6270c2518bdc81a6971f9b3a1.tar.gz
sandhi-fb55fd6737902ed6270c2518bdc81a6971f9b3a1.tar.bz2
sandhi-fb55fd6737902ed6270c2518bdc81a6971f9b3a1.zip
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.
Diffstat (limited to 'python/gras')
-rw-r--r--python/gras/GRAS_HierBlock.i10
1 files changed, 6 insertions, 4 deletions
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
////////////////////////////////////////////////////////////////////////