diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/BlockImpl.hpp | 8 | ||||
-rw-r--r-- | src/server/InputPort.cpp | 2 | ||||
-rw-r--r-- | src/server/NodeImpl.cpp | 2 | ||||
-rw-r--r-- | src/server/NodeImpl.hpp | 17 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 2 | ||||
-rw-r--r-- | src/server/PortImpl.hpp | 3 | ||||
-rw-r--r-- | src/server/events/Connect.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 8 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 7 |
9 files changed, 25 insertions, 28 deletions
diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index a1ca11b7..fc789813 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -72,6 +72,14 @@ public: virtual GraphType graph_type() const { return GraphType::BLOCK; } + /** Return true iff this is main (the top level graph). + * + * This is sometimes called "the root graph", but the term "main" is used + * to avoid ambiguity with the root path, since main does not have the path + * "/", but usually "/main" to leave namespace for non-node things. + */ + bool is_main() const { return !_parent; } + /** Activate this Block. * * This function must be called in a non-realtime thread before it is diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index cfc43526..0e68360e 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -139,7 +139,7 @@ InputPort::remove_arc(ArcImpl& arc) uint32_t InputPort::max_tail_poly(RunContext& context) const { - return parent_block()->parent_graph()->internal_poly_process(); + return parent()->parent_graph()->internal_poly_process(); } void diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index 4a027558..8f47fd83 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -24,7 +24,7 @@ namespace Ingen { namespace Server { NodeImpl::NodeImpl(const Ingen::URIs& uris, - NodeImpl* parent, + BlockImpl* parent, const Raul::Symbol& symbol) : Node(uris, parent ? parent->path().child(symbol) : Raul::Path("/")) , _parent(parent) diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 20ed324f..8e3795d3 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -34,6 +34,7 @@ namespace Shared { class URIs; } namespace Server { +class BlockImpl; class BufferFactory; class GraphImpl; class RunContext; @@ -52,8 +53,8 @@ public: virtual ~NodeImpl() {} const Raul::Symbol& symbol() const { return _symbol; } - const NodeImpl* parent() const { return _parent; } - NodeImpl* parent() { return _parent; } + const BlockImpl* parent() const { return _parent; } + BlockImpl* parent() { return _parent; } /** Rename */ virtual void set_path(const Raul::Path& new_path) { @@ -86,20 +87,12 @@ public: */ virtual bool apply_poly(RunContext& context, uint32_t poly) = 0; - /** Return true iff this is main (the top level Node). - * - * This is sometimes called "the root graph", but the term "main" is used - * to avoid ambiguity with the root path, since main does not have the path - * "/", but usually "/main" to leave namespace for non-node things. - */ - bool is_main() const { return !_parent; } - protected: NodeImpl(const Ingen::URIs& uris, - NodeImpl* parent, + BlockImpl* parent, const Raul::Symbol& symbol); - NodeImpl* _parent; + BlockImpl* _parent; Raul::Path _path; Raul::Symbol _symbol; }; diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 9a701d39..434c6ee0 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -392,7 +392,7 @@ void PortImpl::connect_buffers(SampleCount offset) { for (uint32_t v = 0; v < _poly; ++v) { - PortImpl::parent_block()->set_port_buffer(v, _index, buffer(v), offset); + PortImpl::parent()->set_port_buffer(v, _index, buffer(v), offset); } } diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index 5098fcbb..cda6ab68 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -101,9 +101,6 @@ public: virtual GraphType graph_type() const { return GraphType::PORT; } - /** A port's parent is always a block, so static cast should be safe */ - BlockImpl* parent_block() const { return (BlockImpl*)_parent; } - /** Set the the voices (buffers) for this port in the audio thread. */ void set_voices(RunContext& context, MPtr<Voices>&& voices); diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index c75e56a1..76b7ac41 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -68,8 +68,8 @@ Connect::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::BAD_REQUEST, _head_path); } - BlockImpl* const tail_block = tail_output->parent_block(); - BlockImpl* const head_block = _head->parent_block(); + BlockImpl* const tail_block = tail_output->parent(); + BlockImpl* const head_block = _head->parent(); if (!tail_block || !head_block) { return Event::pre_process_done(Status::PARENT_NOT_FOUND, _head_path); } diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 1411e666..e107c81c 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -67,8 +67,8 @@ Disconnect::Impl::Impl(Engine& e, { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - BlockImpl* const tail_block = _tail->parent_block(); - BlockImpl* const head_block = _head->parent_block(); + BlockImpl* const tail_block = _tail->parent(); + BlockImpl* const head_block = _head->parent(); // Remove tail from head's providers std::set<BlockImpl*>::iterator hp = head_block->providers().find(tail_block); @@ -128,8 +128,8 @@ Disconnect::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::PORT_NOT_FOUND, _head_path); } - BlockImpl* const tail_block = tail->parent_block(); - BlockImpl* const head_block = head->parent_block(); + BlockImpl* const tail_block = tail->parent(); + BlockImpl* const head_block = head->parent(); if (tail_block->parent_graph() != head_block->parent_graph()) { // Arc to a graph port from inside the graph diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index dc9652d9..45fec243 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -113,8 +113,8 @@ DisconnectAll::pre_process(PreProcessContext& ctx) for (const auto& a : _parent->arcs()) { ArcImpl* const arc = (ArcImpl*)a.second.get(); if (_block) { - if (arc->tail()->parent_block() == _block - || arc->head()->parent_block() == _block) { + if (arc->tail()->parent() == _block + || arc->head()->parent() == _block) { to_remove.insert(arc); } } else if (_port) { @@ -147,8 +147,7 @@ DisconnectAll::execute(RunContext& context) { if (_status == Status::SUCCESS) { for (auto& i : _impls) { - i->execute(context, - !_deleting || (i->head()->parent_block() != _block)); + i->execute(context, !_deleting || (i->head()->parent() != _block)); } } |