From 602e31074b30167baace71ccfff1f58a6b3f0626 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Aug 2008 18:58:24 +0000 Subject: More serialization work. Preliminary copy/paste (nodes only) git-svn-id: http://svn.drobilla.net/lad/ingen@1418 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/shared/Store.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/libs/shared/Store.cpp') diff --git a/src/libs/shared/Store.cpp b/src/libs/shared/Store.cpp index 88fb9cb8..f77be312 100644 --- a/src/libs/shared/Store.cpp +++ b/src/libs/shared/Store.cpp @@ -17,6 +17,8 @@ #include #include +#include "common/interface/Node.hpp" +#include "common/interface/Port.hpp" #include "Store.hpp" using namespace std; @@ -26,6 +28,25 @@ namespace Ingen { namespace Shared { +void +Store::add(GraphObject* o) +{ + if (find(o->path()) != end()) { + cerr << "[Store] ERROR: Attempt to add duplicate object " << o->path() << endl; + return; + } + + insert(make_pair(o->path(), o)); + + Node* node = dynamic_cast(o); + if (node) { + for (uint32_t i=0; i < node->num_ports(); ++i) { + add(node->port(i)); + } + } +} + + Store::const_iterator Store::children_begin(SharedPtr o) const { -- cgit v1.2.1