summaryrefslogtreecommitdiffstats
path: root/src/Flowgraph.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-02-22 20:52:20 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-02-22 20:52:20 +0100
commit7cee56f37001640b88f4ac1249624c9c9758e844 (patch)
treec1e4b172f53a51b79f35fc6736a5a4124c19cf5e /src/Flowgraph.cpp
parent7d7cbc19bc5509aa9fb8fb430132fe82855cf8c4 (diff)
downloaddabmod-7cee56f37001640b88f4ac1249624c9c9758e844.tar.gz
dabmod-7cee56f37001640b88f4ac1249624c9c9758e844.tar.bz2
dabmod-7cee56f37001640b88f4ac1249624c9c9758e844.zip
Replace pointers by shared_ptr in all flowgraph
Diffstat (limited to 'src/Flowgraph.cpp')
-rw-r--r--src/Flowgraph.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/Flowgraph.cpp b/src/Flowgraph.cpp
index 373533b..22f604b 100644
--- a/src/Flowgraph.cpp
+++ b/src/Flowgraph.cpp
@@ -1,6 +1,11 @@
/*
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty
the Queen in Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2015
+ Matthias P. Braendli, matthias.braendli@mpb.li
+
+ http://opendigitalradio.org
*/
/*
This file is part of ODR-DabMod.
@@ -38,19 +43,18 @@
#include <sys/time.h>
#endif
-#include <boost/shared_ptr.hpp>
-
using namespace boost;
typedef std::vector<shared_ptr<Node> >::iterator NodeIterator;
typedef std::vector<shared_ptr<Edge> >::iterator EdgeIterator;
-Node::Node(ModPlugin* plugin) :
+Node::Node(shared_ptr<ModPlugin> plugin) :
myPlugin(plugin),
myProcessTime(0)
{
- PDEBUG("Node::Node(plugin(%s): %p) @ %p\n", plugin->name(), plugin, this);
+ PDEBUG("Node::Node(plugin(%s): %p) @ %p\n",
+ plugin->name(), plugin.get(), this);
}
@@ -59,9 +63,6 @@ Node::~Node()
{
PDEBUG("Node::~Node() @ %p\n", this);
- if (myPlugin != NULL) {
- delete myPlugin;
- }
assert(myInputBuffers.size() == 0);
assert(myOutputBuffers.size() == 0);
}
@@ -72,8 +73,8 @@ Edge::Edge(shared_ptr<Node>& srcNode, shared_ptr<Node>& dstNode) :
myDstNode(dstNode)
{
PDEBUG("Edge::Edge(srcNode(%s): %p, dstNode(%s): %p) @ %p\n",
- srcNode->plugin()->name(), srcNode,
- dstNode->plugin()->name(), dstNode,
+ srcNode->plugin()->name(), srcNode.get(),
+ dstNode->plugin()->name(), dstNode.get(),
this);
myBuffer = shared_ptr<Buffer>(new Buffer());
@@ -112,7 +113,7 @@ Edge::~Edge()
int Node::process()
{
PDEBUG("Edge::process()\n");
- PDEBUG(" Plugin name: %s (%p)\n", myPlugin->name(), myPlugin);
+ PDEBUG(" Plugin name: %s (%p)\n", myPlugin->name(), myPlugin.get());
// the plugin process() still wants vector<Buffer*>
// arguments.
@@ -165,11 +166,10 @@ Flowgraph::~Flowgraph()
}
}
-
-void Flowgraph::connect(ModPlugin* input, ModPlugin* output)
+void Flowgraph::connect(shared_ptr<ModPlugin> input, shared_ptr<ModPlugin> output)
{
PDEBUG("Flowgraph::connect(input(%s): %p, output(%s): %p)\n",
- input->name(), input, output->name(), output);
+ input->name(), input.get(), output->name(), output.get());
NodeIterator inputNode;
NodeIterator outputNode;
@@ -237,3 +237,4 @@ bool Flowgraph::run()
}
return true;
}
+