diff options
author | David Robillard <d@drobilla.net> | 2007-10-08 00:50:13 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-10-08 00:50:13 +0000 |
commit | a421a44310ee472fbee15f150d32b826a8371dbf (patch) | |
tree | d160bb1704a26524dee8746e3f7dd69494460cd6 /src/libs/client/PortModel.hpp | |
parent | 19a9eb15d1c918b10fe169db1b8f4fd0c6ffe8fa (diff) | |
download | ingen-a421a44310ee472fbee15f150d32b826a8371dbf.tar.gz ingen-a421a44310ee472fbee15f150d32b826a8371dbf.tar.bz2 ingen-a421a44310ee472fbee15f150d32b826a8371dbf.zip |
Fix serialization/connection bugs resulting from refactoring.
git-svn-id: http://svn.drobilla.net/lad/ingen@842 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client/PortModel.hpp')
-rw-r--r-- | src/libs/client/PortModel.hpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp index d6a766d8..8624c031 100644 --- a/src/libs/client/PortModel.hpp +++ b/src/libs/client/PortModel.hpp @@ -23,10 +23,12 @@ #include <string> #include <vector> #include <sigc++/sigc++.h> -#include "ObjectModel.hpp" #include <raul/SharedPtr.hpp> #include <raul/Path.hpp> -using std::string; using std::vector; using std::cerr; using std::endl; +#include "interface/Port.hpp" +#include "ObjectModel.hpp" + +using std::string; using std::vector; namespace Ingen { namespace Client { @@ -36,20 +38,16 @@ namespace Client { * * \ingroup IngenClient */ -class PortModel : public ObjectModel +class PortModel : public ObjectModel, public Shared::Port { public: enum Direction { INPUT, OUTPUT }; - inline string type() const { return _type; } - inline float value() const { return _current_val; } - inline bool connected() const { return (_connections > 0); } - inline bool is_input() const { return (_direction == INPUT); } - inline bool is_output() const { return (_direction == OUTPUT); } - inline bool is_audio() const { return (_type == "ingen:AudioPort"); } - inline bool is_control() const { return (_type == "ingen:ControlPort"); } - inline bool is_midi() const { return (_type == "ingen:MidiPort"); } - inline bool is_osc() const { return (_type == "ingen:OSCPort"); } + inline DataType type() const { return _type; } + inline Atom value() const { return Atom(_current_val); } + inline bool connected() const { return (_connections > 0); } + inline bool is_input() const { return (_direction == INPUT); } + inline bool is_output() const { return (_direction == OUTPUT); } bool is_logarithmic() const; bool is_integer() const; @@ -76,15 +74,15 @@ public: private: friend class Store; - PortModel(const Path& path, const string& type, Direction dir) + PortModel(const Path& path, DataType type, Direction dir) : ObjectModel(path, true), _type(type), _direction(dir), _current_val(0.0f), _connections(0) { - if (!is_audio() && !is_control() && !is_input()) - cerr << "[PortModel] Warning: Unknown port type" << endl; + if (_type == DataType::UNKNOWN) + std::cerr << "[PortModel] Warning: Unknown port type" << std::endl; } void add_child(SharedPtr<ObjectModel> c) { throw; } @@ -93,7 +91,7 @@ private: void connected_to(SharedPtr<PortModel> p) { ++_connections; signal_connection.emit(p); } void disconnected_from(SharedPtr<PortModel> p) { --_connections; signal_disconnection.emit(p); } - string _type; + DataType _type; Direction _direction; float _current_val; size_t _connections; |