From 77a9beca75debd2d87d735fc4fe847694eee6f13 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 25 Feb 2010 20:40:13 +0000 Subject: Work on contexts and polymorphic ports. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2492 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PortModel.hpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/client/PortModel.hpp') diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp index 6021ed19..02305e1a 100644 --- a/src/client/PortModel.hpp +++ b/src/client/PortModel.hpp @@ -41,8 +41,11 @@ class PortModel : public ObjectModel, public Ingen::Shared::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; } - inline Shared::PortType type() const { return _type; } inline const Raul::Atom& value() const { return _current_val; } inline bool connected() const { return (_connections > 0); } inline bool is_input() const { return (_direction == INPUT); } @@ -50,6 +53,7 @@ public: bool port_property(const std::string& uri) const; + bool is_numeric() const { return is_a(Shared::PortType::CONTROL); } 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"); } @@ -83,12 +87,12 @@ private: PortModel(const Raul::Path& path, uint32_t index, Shared::PortType type, Direction dir) : ObjectModel(path) , _index(index) - , _type(type) , _direction(dir) , _current_val(0.0f) , _connections(0) { - if (_type == Shared::PortType::UNKNOWN) + _types.insert(type); + if (type == Shared::PortType::UNKNOWN) Raul::warn << "[PortModel] Unknown port type" << std::endl; } @@ -100,11 +104,11 @@ private: void set(SharedPtr model); - uint32_t _index; - Shared::PortType _type; - Direction _direction; - Raul::Atom _current_val; - size_t _connections; + uint32_t _index; + std::set _types; + Direction _direction; + Raul::Atom _current_val; + size_t _connections; }; -- cgit v1.2.1