summaryrefslogtreecommitdiffstats
path: root/include/ingen
diff options
context:
space:
mode:
Diffstat (limited to 'include/ingen')
-rw-r--r--include/ingen/Port.hpp7
-rw-r--r--include/ingen/PortType.hpp96
-rw-r--r--include/ingen/client/ObjectModel.hpp2
-rw-r--r--include/ingen/client/PortModel.hpp15
4 files changed, 7 insertions, 113 deletions
diff --git a/include/ingen/Port.hpp b/include/ingen/Port.hpp
index 5d04d0f1..6780f635 100644
--- a/include/ingen/Port.hpp
+++ b/include/ingen/Port.hpp
@@ -23,7 +23,6 @@
#include <set>
#include "ingen/GraphObject.hpp"
-#include "ingen/PortType.hpp"
namespace Raul { class Atom; }
@@ -38,12 +37,6 @@ namespace Ingen {
class Port : public virtual GraphObject
{
public:
- typedef std::set<PortType> PortTypes;
-
- virtual const PortTypes& types() const = 0;
-
- inline bool is_a(PortType type) const { return types().find(type) != types().end(); }
-
virtual bool supports(const Raul::URI& value_type) const = 0;
virtual uint32_t index() const = 0;
diff --git a/include/ingen/PortType.hpp b/include/ingen/PortType.hpp
deleted file mode 100644
index 1fc9f995..00000000
--- a/include/ingen/PortType.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* This file is part of Ingen.
- * Copyright 2007-2011 David Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef INGEN_INTERFACE_PORTTYPE_HPP
-#define INGEN_INTERFACE_PORTTYPE_HPP
-
-#include "raul/URI.hpp"
-
-namespace Ingen {
-
-/** The type of a port.
- *
- * This type refers to the type of the port itself (not necessarily the type
- * of its contents). Ports with different types can contain the same type of
- * data, but may e.g. have different access semantics.
- */
-class PortType {
-public:
- enum Symbol {
- UNKNOWN = 0,
- AUDIO = 1,
- CONTROL = 2,
- EVENTS = 3,
- VALUE = 4,
- MESSAGE = 5,
- };
-
- PortType(const Raul::URI& uri)
- : _symbol(UNKNOWN)
- {
- if (uri == type_uri(AUDIO)) {
- _symbol = AUDIO;
- } else if (uri == type_uri(CONTROL)) {
- _symbol = CONTROL;
- } else if (uri == type_uri(EVENTS)) {
- _symbol = EVENTS;
- } else if (uri == type_uri(VALUE)) {
- _symbol = VALUE;
- } else if (uri == type_uri(MESSAGE)) {
- _symbol = MESSAGE;
- }
- }
-
- PortType(Symbol symbol)
- : _symbol(symbol)
- {}
-
- inline const Raul::URI& uri() const { return type_uri(_symbol); }
- inline Symbol symbol() const { return _symbol; }
-
- inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); }
- inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); }
- inline bool operator==(const PortType& type) const { return (_symbol == type._symbol); }
- inline bool operator!=(const PortType& type) const { return (_symbol != type._symbol); }
- inline bool operator<(const PortType& type) const { return (_symbol < type._symbol); }
-
- inline bool is_audio() { return _symbol == AUDIO; }
- inline bool is_control() { return _symbol == CONTROL; }
- inline bool is_events() { return _symbol == EVENTS; }
- inline bool is_value() { return _symbol == VALUE; }
- inline bool is_message() { return _symbol == MESSAGE; }
-
-private:
- static inline const Raul::URI& type_uri(unsigned symbol_num) {
- assert(symbol_num <= MESSAGE);
- static const Raul::URI uris[] = {
- "http://drobilla.net/ns/ingen#nil",
- "http://lv2plug.in/ns/lv2core#AudioPort",
- "http://lv2plug.in/ns/lv2core#ControlPort",
- "http://lv2plug.in/ns/ext/event#EventPort",
- "http://lv2plug.in/ns/ext/atom#ValuePort",
- "http://lv2plug.in/ns/ext/atom#MessagePort"
- };
- return uris[symbol_num];
- }
-
- Symbol _symbol;
-};
-
-} // namespace Ingen
-
-#endif // INGEN_INTERFACE_PORTTYPE_HPP
diff --git a/include/ingen/client/ObjectModel.hpp b/include/ingen/client/ObjectModel.hpp
index 50ba2805..6d4fbae5 100644
--- a/include/ingen/client/ObjectModel.hpp
+++ b/include/ingen/client/ObjectModel.hpp
@@ -55,6 +55,8 @@ class ObjectModel : virtual public GraphObject
public:
virtual ~ObjectModel();
+ bool is_a(const Raul::URI& type) const;
+
const Raul::Atom& get_property(const Raul::URI& key) const;
const Raul::Atom& set_property(const Raul::URI& key,
diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp
index 7fd4d746..900d576e 100644
--- a/include/ingen/client/PortModel.hpp
+++ b/include/ingen/client/PortModel.hpp
@@ -41,8 +41,6 @@ class PortModel : public ObjectModel, public Ingen::Port
public:
enum Direction { INPUT, OUTPUT };
- const PortTypes& types() const { return _types; }
-
bool supports(const Raul::URI& value_type) const;
inline uint32_t index() const { return _index; }
@@ -53,7 +51,7 @@ public:
bool port_property(const Raul::URI& uri) const;
- bool is_numeric() const { return is_a(PortType::CONTROL); }
+ bool is_numeric() const { return ObjectModel::is_a("http://lv2plug.in/ns/lv2core#ControlPort"); }
bool is_logarithmic() const { return port_property("http://drobilla.net/ns/ingen#logarithmic"); }
bool is_integer() const { return port_property("http://lv2plug.in/ns/lv2core#integer"); }
bool is_toggle() const { return port_property("http://lv2plug.in/ns/lv2core#toggled"); }
@@ -90,17 +88,15 @@ private:
friend class ClientStore;
PortModel(Shared::LV2URIMap& uris,
- const Raul::Path& path, uint32_t index, PortType type, Direction dir)
+ const Raul::Path& path,
+ uint32_t index,
+ Direction dir)
: ObjectModel(uris, path)
, _index(index)
, _direction(dir)
, _current_val(0.0f)
, _connections(0)
- {
- _types.insert(type);
- if (type == PortType::UNKNOWN)
- Raul::warn << "[PortModel] Unknown port type" << std::endl;
- }
+ {}
void add_child(SharedPtr<ObjectModel> c) { throw; }
bool remove_child(SharedPtr<ObjectModel> c) { throw; }
@@ -111,7 +107,6 @@ private:
void set(SharedPtr<ObjectModel> model);
uint32_t _index;
- std::set<PortType> _types;
Direction _direction;
Raul::Atom _current_val;
size_t _connections;