diff options
author | Josh Blum | 2013-04-03 23:58:52 -0700 |
---|---|---|
committer | Josh Blum | 2013-04-03 23:58:52 -0700 |
commit | 06b800166e995cf53ec0f87200427512e1518d8f (patch) | |
tree | cf75d446f986f0bee4976bd4d2d99ea1397cceff /include/gras/element.hpp | |
parent | f7f459df3b1b4349138324b14703fc18bff7e2a6 (diff) | |
parent | c85fe5cb75d32544eb89a573e8df61757a940766 (diff) | |
download | sandhi-06b800166e995cf53ec0f87200427512e1518d8f.tar.gz sandhi-06b800166e995cf53ec0f87200427512e1518d8f.tar.bz2 sandhi-06b800166e995cf53ec0f87200427512e1518d8f.zip |
Merge branch 'ownership_work'
Diffstat (limited to 'include/gras/element.hpp')
-rw-r--r-- | include/gras/element.hpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 40a24cf..cfaa5e4 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -21,6 +21,20 @@ 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; +}; + +/*! + * Element is a base class for all topological elements. + */ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> { //! Create an empty element @@ -87,13 +101,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; }; |