From ad43d2e08cea225635b56c5473a768bc853ecda3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 13 Dec 2016 17:51:55 -0500 Subject: Remove virtual inheritance from Port hierarchy This was confusing stoat, and is questionable design anyway. The OutputPort functionality has been moved to PortImpl, which is a basic port with buffers suitable for use as an output, and is overridden by InputPort and DuplexPort where necessary. --- src/server/events/Connect.cpp | 5 ++--- src/server/events/Connect.hpp | 1 - src/server/events/CreatePort.cpp | 3 ++- src/server/events/Disconnect.cpp | 5 ++--- src/server/events/Disconnect.hpp | 15 +++++++-------- src/server/events/DisconnectAll.cpp | 3 +-- 6 files changed, 14 insertions(+), 18 deletions(-) (limited to 'src/server/events') diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 34dc569e..c24fc2bb 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -24,7 +24,6 @@ #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" -#include "OutputPort.hpp" #include "PortImpl.hpp" #include "PreProcessContext.hpp" #include "internals/BlockDelay.hpp" @@ -64,8 +63,8 @@ Connect::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::NOT_FOUND, _head_path); } - OutputPort* tail_output = dynamic_cast(tail); - _head = dynamic_cast(head); + PortImpl* tail_output = dynamic_cast(tail); + _head = dynamic_cast(head); if (!tail_output || !_head) { return Event::pre_process_done(Status::BAD_REQUEST, _head_path); } diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 9b98b167..359c9f3b 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -34,7 +34,6 @@ class ArcImpl; class CompiledGraph; class GraphImpl; class InputPort; -class OutputPort; namespace Events { diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 60e57a71..bb8bb4d4 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -141,7 +141,8 @@ CreatePort::pre_process(PreProcessContext& ctx) polyphonic, _port_type, _buf_type, buf_size, value, _flow == Flow::OUTPUT); - + assert((_flow == Flow::OUTPUT && _graph_port->is_output()) || + (_flow == Flow::INPUT && _graph_port->is_input())); _graph_port->properties().insert(_properties.begin(), _properties.end()); _engine.store()->add(_graph_port); diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 40b85c22..8875eb0c 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -27,7 +27,6 @@ #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" -#include "OutputPort.hpp" #include "PortImpl.hpp" #include "PreProcessContext.hpp" #include "RunContext.hpp" @@ -61,7 +60,7 @@ Disconnect::~Disconnect() Disconnect::Impl::Impl(Engine& e, GraphImpl* graph, - OutputPort* t, + PortImpl* t, InputPort* h) : _engine(e) , _tail(t) @@ -165,7 +164,7 @@ Disconnect::pre_process(PreProcessContext& ctx) _impl = new Impl(_engine, _graph, - dynamic_cast(tail), + dynamic_cast(tail), dynamic_cast(head)); if (ctx.must_compile(_graph)) { diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index 19ffcf3b..fa16f01f 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -33,7 +33,6 @@ namespace Server { class CompiledGraph; class InputPort; -class OutputPort; class PortImpl; namespace Events { @@ -61,19 +60,19 @@ public: class Impl { public: - Impl(Engine& e, - GraphImpl* graph, - OutputPort* t, - InputPort* h); + Impl(Engine& e, + GraphImpl* graph, + PortImpl* t, + InputPort* h); bool execute(RunContext& context, bool set_head_buffers); - inline OutputPort* tail() { return _tail; } - inline InputPort* head() { return _head; } + inline PortImpl* tail() { return _tail; } + inline InputPort* head() { return _head; } private: Engine& _engine; - OutputPort* _tail; + PortImpl* _tail; InputPort* _head; SPtr _arc; Raul::Array* _voices; diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 8ce14e74..597f8e9b 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -29,7 +29,6 @@ #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" -#include "OutputPort.hpp" #include "PortImpl.hpp" #include "PreProcessContext.hpp" #include "events/Disconnect.hpp" @@ -135,7 +134,7 @@ DisconnectAll::pre_process(PreProcessContext& ctx) for (const auto& a : to_remove) { _impls.push_back(new Disconnect::Impl( _engine, _parent, - dynamic_cast(a->tail()), + dynamic_cast(a->tail()), dynamic_cast(a->head()))); } -- cgit v1.2.1