From a7d83f19b08eb4c6f79a82fe60c2b86db13f4420 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 24 Nov 2018 13:44:03 +0100 Subject: Squashed 'waflib/' changes from 6e726eb1..5ea8f99f 5ea8f99f Improve test output spacing 0e23b29f Raise exception when test suite fails to ensure non-zero exit status d6de073b Show run time of unit tests 5b655541 Add short configure option for ultra-strict flags 4687ba6d Use gtest-like test output 258903d9 Fix failure count in test group summaries da07e738 Fix verbose tests with Python 3 git-subtree-dir: waflib git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d --- src/client/GraphModel.cpp | 176 ---------------------------------------------- 1 file changed, 176 deletions(-) delete mode 100644 src/client/GraphModel.cpp (limited to 'src/client/GraphModel.cpp') diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp deleted file mode 100644 index 0723e59b..00000000 --- a/src/client/GraphModel.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2015 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include "ingen/URIs.hpp" -#include "ingen/client/ArcModel.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" - -namespace Ingen { -namespace Client { - -void -GraphModel::add_child(SPtr c) -{ - assert(c->parent().get() == this); - - SPtr pm = dynamic_ptr_cast(c); - if (pm) { - add_port(pm); - return; - } - - SPtr bm = dynamic_ptr_cast(c); - if (bm) { - _signal_new_block.emit(bm); - } -} - -bool -GraphModel::remove_child(SPtr o) -{ - assert(o->path().is_child_of(path())); - assert(o->parent().get() == this); - - SPtr pm = dynamic_ptr_cast(o); - if (pm) { - remove_arcs_on(pm); - remove_port(pm); - } - - SPtr bm = dynamic_ptr_cast(o); - if (bm) { - _signal_removed_block.emit(bm); - } - - return true; -} - -void -GraphModel::remove_arcs_on(SPtr p) -{ - // Remove any connections which referred to this object, - // since they can't possibly exist anymore - for (auto j = _arcs.begin(); j != _arcs.end();) { - auto next = j; - ++next; - - SPtr arc = dynamic_ptr_cast(j->second); - if (arc->tail_path().parent() == p->path() - || arc->tail_path() == p->path() - || arc->head_path().parent() == p->path() - || arc->head_path() == p->path()) { - _signal_removed_arc.emit(arc); - _arcs.erase(j); // Cuts our reference - } - j = next; - } -} - -void -GraphModel::clear() -{ - _arcs.clear(); - - BlockModel::clear(); - - assert(_arcs.empty()); - assert(_ports.empty()); -} - -SPtr -GraphModel::get_arc(const Node* tail, const Node* head) -{ - auto i = _arcs.find(std::make_pair(tail, head)); - if (i != _arcs.end()) { - return dynamic_ptr_cast(i->second); - } else { - return SPtr(); - } -} - -/** Add a connection to this graph. - * - * A reference to `arc` is taken, released on deletion or removal. - * If `arc` only contains paths (not pointers to the actual ports), the ports - * will be found and set. The ports referred to not existing as children of - * this graph is a fatal error. - */ -void -GraphModel::add_arc(SPtr arc) -{ - // Store should have 'resolved' the connection already - assert(arc); - assert(arc->tail()); - assert(arc->head()); - assert(arc->tail()->parent()); - assert(arc->head()->parent()); - assert(arc->tail_path() != arc->head_path()); - assert(arc->tail()->parent().get() == this - || arc->tail()->parent()->parent().get() == this); - assert(arc->head()->parent().get() == this - || arc->head()->parent()->parent().get() == this); - - SPtr existing = get_arc( - arc->tail().get(), arc->head().get()); - - if (existing) { - assert(arc->tail() == existing->tail()); - assert(arc->head() == existing->head()); - } else { - _arcs.emplace(std::make_pair(arc->tail().get(), arc->head().get()), - arc); - _signal_new_arc.emit(arc); - } -} - -void -GraphModel::remove_arc(const Node* tail, const Node* head) -{ - auto i = _arcs.find(std::make_pair(tail, head)); - if (i != _arcs.end()) { - SPtr arc = dynamic_ptr_cast(i->second); - _signal_removed_arc.emit(arc); - _arcs.erase(i); - } -} - -bool -GraphModel::enabled() const -{ - const Atom& enabled = get_property(_uris.ingen_enabled); - return (enabled.is_valid() && enabled.get()); -} - -uint32_t -GraphModel::internal_poly() const -{ - const Atom& poly = get_property(_uris.ingen_polyphony); - return poly.is_valid() ? poly.get() : 1; -} - -bool -GraphModel::polyphonic() const -{ - const Atom& poly = get_property(_uris.ingen_polyphonic); - return poly.is_valid() && poly.get(); -} - -} // namespace Client -} // namespace Ingen -- cgit v1.2.1