summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosh Blum2013-04-04 22:07:59 -0700
committerJosh Blum2013-04-04 22:07:59 -0700
commit0f493354d46706ed81b81699c4e5197ee2b82d08 (patch)
treed177af0a64fa643a5630091dd797d38492e73912 /lib
parent06b800166e995cf53ec0f87200427512e1518d8f (diff)
downloadsandhi-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')
-rw-r--r--lib/block_actor.cpp2
-rw-r--r--lib/element.cpp25
-rw-r--r--lib/hier_block.cpp3
3 files changed, 6 insertions, 24 deletions
diff --git a/lib/block_actor.cpp b/lib/block_actor.cpp
index 5b1c5db..10c863e 100644
--- a/lib/block_actor.cpp
+++ b/lib/block_actor.cpp
@@ -92,5 +92,5 @@ BlockActor::BlockActor(void):
BlockActor::~BlockActor(void)
{
- this->mark_done();
+ //NOP
}
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;
}
diff --git a/lib/hier_block.cpp b/lib/hier_block.cpp
index ab474c5..d8756a4 100644
--- a/lib/hier_block.cpp
+++ b/lib/hier_block.cpp
@@ -42,7 +42,7 @@ static Apology::Wax get_ref(const Element &elem)
{
if (elem.weak_self)
{
- boost::shared_ptr<void> shared_self = elem.weak_self->lock();
+ boost::shared_ptr<const void> shared_self = elem.weak_self->lock();
if (shared_self) return shared_self;
}
return elem;
@@ -54,7 +54,6 @@ void HierBlock::connect(
const Element &sink,
const size_t sink_index
){
- //TODO, this is the perfect place to validate IO sigs
const Apology::Flow flow(
Apology::Port(src->get_elem(), src_index, get_ref(src)),
Apology::Port(sink->get_elem(), sink_index, get_ref(sink))