summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-12-13 17:51:55 -0500
committerDavid Robillard <d@drobilla.net>2016-12-13 19:15:29 -0500
commitad43d2e08cea225635b56c5473a768bc853ecda3 (patch)
tree472a8c6dc605ba63903206a14549e8340efcf137 /src/server/events
parent0752556bde5659a933744658cdf63509000a5080 (diff)
downloadingen-ad43d2e08cea225635b56c5473a768bc853ecda3.tar.gz
ingen-ad43d2e08cea225635b56c5473a768bc853ecda3.tar.bz2
ingen-ad43d2e08cea225635b56c5473a768bc853ecda3.zip
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.
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Connect.cpp5
-rw-r--r--src/server/events/Connect.hpp1
-rw-r--r--src/server/events/CreatePort.cpp3
-rw-r--r--src/server/events/Disconnect.cpp5
-rw-r--r--src/server/events/Disconnect.hpp15
-rw-r--r--src/server/events/DisconnectAll.cpp3
6 files changed, 14 insertions, 18 deletions
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<OutputPort*>(tail);
- _head = dynamic_cast<InputPort*>(head);
+ PortImpl* tail_output = dynamic_cast<PortImpl*>(tail);
+ _head = dynamic_cast<InputPort*>(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<OutputPort*>(tail),
+ dynamic_cast<PortImpl*>(tail),
dynamic_cast<InputPort*>(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<ArcImpl> _arc;
Raul::Array<PortImpl::Voice>* _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<OutputPort*>(a->tail()),
+ dynamic_cast<PortImpl*>(a->tail()),
dynamic_cast<InputPort*>(a->head())));
}