From 0651aff49ae7e066bc301faeecfbd519c4743849 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 3 Apr 2013 23:09:49 -0700 Subject: gras: figured out how to do the python reference --- include/gras/element.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include/gras/element.hpp') diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 40a24cf..f9a223d 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -19,6 +19,11 @@ struct ElementImpl; typedef boost::shared_ptr<ElementImpl> ElementBase; +struct WeakElement +{ + virtual boost::shared_ptr<void> lock(void) = 0; +}; + struct Block; struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> @@ -87,13 +92,13 @@ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> * Good for that factory function/shared ptr paradigm. */ template <typename T> - inline Element(const boost::shared_ptr<T> &elem); + Element(const boost::shared_ptr<T> &elem); //! Convert a shared ptr of a derived class to an Element - inline Element &shared_to_element(void); + Element &shared_to_element(void); //! for internal use only - boost::weak_ptr<Element> weak_self; + boost::shared_ptr<WeakElement> weak_self; }; -- cgit From c85fe5cb75d32544eb89a573e8df61757a940766 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 3 Apr 2013 23:31:34 -0700 Subject: gras: code cleanup and comments from last commit --- include/gras/element.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include/gras/element.hpp') diff --git a/include/gras/element.hpp b/include/gras/element.hpp index f9a223d..cfaa5e4 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -19,13 +19,22 @@ struct ElementImpl; typedef boost::shared_ptr<ElementImpl> ElementBase; +struct Block; + +/*! + * Weak Element interface class: + * Allows internals to get a reference to the container holding an element. + * This container could be a shared_ptr or perhaps a Python object. + */ struct WeakElement { + //! Lock creates a shared pointer holding a container reference virtual boost::shared_ptr<void> lock(void) = 0; }; -struct Block; - +/*! + * Element is a base class for all topological elements. + */ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> { //! Create an empty element -- cgit