summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-03 02:18:42 +0000
committerDavid Robillard <d@drobilla.net>2011-10-03 02:18:42 +0000
commit8768c927968c2541bcac763d9a4f237081eaca4b (patch)
tree214b29607be379f4cab4d254562a9949677c5848 /src/server/events
parentaf70d4f1e0927ea3e89b78fdf0de4247a32a39b4 (diff)
downloadingen-8768c927968c2541bcac763d9a4f237081eaca4b.tar.gz
ingen-8768c927968c2541bcac763d9a4f237081eaca4b.tar.bz2
ingen-8768c927968c2541bcac763d9a4f237081eaca4b.zip
Remove static PortType enumeration from public/client side interface.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3523 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/CreatePort.cpp35
-rw-r--r--src/server/events/CreatePort.hpp9
-rw-r--r--src/server/events/SetMetadata.cpp12
3 files changed, 40 insertions, 16 deletions
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 5c3ecbd2..c6d7c296 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -46,21 +46,46 @@ CreatePort::CreatePort(
SharedPtr<Request> request,
SampleCount timestamp,
const Raul::Path& path,
- const Raul::URI& type,
bool is_output,
const Resource::Properties& properties)
: QueuedEvent(engine, request, timestamp)
, _path(path)
- , _type(type)
- , _is_output(is_output)
- , _data_type(type)
+ , _data_type(PortType::UNKNOWN)
, _patch(NULL)
, _patch_port(NULL)
+ , _ports_array(NULL)
, _driver_port(NULL)
, _properties(properties)
+ , _is_output(is_output)
{
- if (_data_type == PortType::UNKNOWN)
+ const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get();
+
+ typedef Resource::Properties::const_iterator Iterator;
+ typedef std::pair<Iterator, Iterator> Range;
+ const Range types = properties.equal_range(uris.rdf_type);
+ for (Iterator i = types.first; i != types.second; ++i) {
+ const Raul::Atom& type = i->second;
+ if (type.type() != Atom::URI) {
+ warn << "Non-URI port type " << type << endl;
+ continue;
+ }
+
+ if (type == uris.lv2_AudioPort) {
+ _data_type = PortType::AUDIO;
+ } else if (type == uris.lv2_ControlPort) {
+ _data_type = PortType::CONTROL;
+ } else if (type == uris.ev_EventPort) {
+ _data_type = PortType::EVENTS;
+ } else if (type == uris.atom_ValuePort) {
+ _data_type = PortType::VALUE;
+ } else if (type == uris.atom_MessagePort) {
+ _data_type = PortType::MESSAGE;
+ }
+ }
+
+ if (_data_type == PortType::UNKNOWN) {
_error = UNKNOWN_TYPE;
+ }
}
void
diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp
index 56c0f0a0..4b1b03fa 100644
--- a/src/server/events/CreatePort.hpp
+++ b/src/server/events/CreatePort.hpp
@@ -21,9 +21,9 @@
#include "raul/Array.hpp"
#include "raul/Path.hpp"
-#include "ingen/PortType.hpp"
#include "ingen/Resource.hpp"
+#include "PortType.hpp"
#include "QueuedEvent.hpp"
namespace Ingen {
@@ -47,7 +47,6 @@ public:
SharedPtr<Request> request,
SampleCount timestamp,
const Raul::Path& path,
- const Raul::URI& type,
bool is_output,
const Resource::Properties& properties);
@@ -65,15 +64,13 @@ private:
Raul::Path _path;
Raul::URI _type;
- bool _is_output;
PortType _data_type;
PatchImpl* _patch;
PortImpl* _patch_port;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports array for Patch
DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port
- bool _succeeded;
-
- Resource::Properties _properties;
+ Resource::Properties _properties;
+ bool _is_output;
};
} // namespace Server
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index bef968fc..4e40baeb 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -16,11 +16,12 @@
*/
#include <string>
+
#include <boost/format.hpp>
+
#include "raul/log.hpp"
#include "raul/Maid.hpp"
-#include "ingen/PortType.hpp"
-#include "shared/LV2URIMap.hpp"
+
#include "ClientBroadcaster.hpp"
#include "ControlBindings.hpp"
#include "CreateNode.hpp"
@@ -33,9 +34,11 @@
#include "PatchImpl.hpp"
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
+#include "PortType.hpp"
#include "Request.hpp"
#include "SetMetadata.hpp"
#include "SetPortValue.hpp"
+#include "shared/LV2URIMap.hpp"
#define LOG(s) s << "[SetMetadata] "
@@ -120,8 +123,7 @@ SetMetadata::pre_process()
if (is_graph_object && !_object) {
Path path(_subject.str());
bool is_patch = false, is_node = false, is_port = false, is_output = false;
- PortType data_type(PortType::UNKNOWN);
- Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output, data_type);
+ Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output);
// Create a separate request without a source so EventSource isn't unblocked twice
SharedPtr<Request> sub_request(new Request(NULL, _request->client(), _request->id()));
@@ -139,7 +141,7 @@ SetMetadata::pre_process()
path, p->second.get_uri(), _properties);
} else if (is_port) {
_create_event = new CreatePort(_engine, sub_request, _time,
- path, data_type.uri(), is_output, _properties);
+ path, is_output, _properties);
}
if (_create_event) {
_create_event->pre_process();