diff options
author | Josh Blum | 2013-04-04 22:07:59 -0700 |
---|---|---|
committer | Josh Blum | 2013-04-04 22:07:59 -0700 |
commit | 0f493354d46706ed81b81699c4e5197ee2b82d08 (patch) | |
tree | d177af0a64fa643a5630091dd797d38492e73912 /lib/element.cpp | |
parent | 06b800166e995cf53ec0f87200427512e1518d8f (diff) | |
download | sandhi-0f493354d46706ed81b81699c4e5197ee2b82d08.tar.gz sandhi-0f493354d46706ed81b81699c4e5197ee2b82d08.tar.bz2 sandhi-0f493354d46706ed81b81699c4e5197ee2b82d08.zip |
gras: revisit container storage after yesterdays learning
The mechanisms of connect are now resonsible for grabbing the container ref.
When the object is a shared ptr, the element contructor overload sets weakself.
When the object is in python, the python reference is held,
even if its shared ptr underneath that.
* removed the need for shared_from_this
* removed the ref stuff in python Block
Diffstat (limited to 'lib/element.cpp')
-rw-r--r-- | lib/element.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/lib/element.cpp b/lib/element.cpp index 340bd85..989c184 100644 --- a/lib/element.cpp +++ b/lib/element.cpp @@ -31,30 +31,13 @@ Element::~Element(void) //NOP } -//! Weak element overload for the case of shared_ptr container -struct WeakElementSharedPtr : WeakElement +const Element &Element::to_element(void) const { - WeakElementSharedPtr(boost::weak_ptr<Element> weak_self) - { - _weak_self = weak_self; - } - boost::shared_ptr<void> lock(void) - { - return _weak_self.lock(); - } - boost::weak_ptr<Element> _weak_self; -}; + return *this; +} -Element &Element::shared_to_element(void) +Element &Element::to_element(void) { - try - { - if (not this->weak_self) - { - this->weak_self.reset(new WeakElementSharedPtr(this->shared_from_this())); - } - } - catch(...){} return *this; } |