summaryrefslogtreecommitdiffstats
path: root/src/libs/client/NodeModel.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-10 02:43:54 +0000
committerDavid Robillard <d@drobilla.net>2006-06-10 02:43:54 +0000
commit47246db7e9d71ba694b719001033fba1766a58c4 (patch)
tree25614ea4f2c92033a3cd37f6413df742f09a5369 /src/libs/client/NodeModel.h
parent98fe0e7056e6697396249531785d3899f94d79be (diff)
downloadingen-47246db7e9d71ba694b719001033fba1766a58c4.tar.gz
ingen-47246db7e9d71ba694b719001033fba1766a58c4.tar.bz2
ingen-47246db7e9d71ba694b719001033fba1766a58c4.zip
More juggling
git-svn-id: http://svn.drobilla.net/lad/grauph@16 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client/NodeModel.h')
-rw-r--r--src/libs/client/NodeModel.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/libs/client/NodeModel.h b/src/libs/client/NodeModel.h
new file mode 100644
index 00000000..af4171ed
--- /dev/null
+++ b/src/libs/client/NodeModel.h
@@ -0,0 +1,93 @@
+/* This file is part of Om. Copyright (C) 2005 Dave Robillard.
+ *
+ * Om 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.
+ *
+ * Om 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.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef NODEMODEL_H
+#define NODEMODEL_H
+
+#include <cstdlib>
+#include <map>
+#include <iostream>
+#include <string>
+#include "ObjectModel.h"
+#include "PortModel.h"
+#include "util/Path.h"
+
+using std::string; using std::map; using std::find;
+using std::cout; using std::cerr; using std::endl;
+
+namespace LibOmClient {
+
+class PatchModel;
+class PluginModel;
+
+
+/** Node model class, used by the client to store engine's state.
+ *
+ * \ingroup libomclient
+ */
+class NodeModel : public ObjectModel
+{
+public:
+ NodeModel(const Path& node_path);
+ virtual ~NodeModel();
+
+ PortModel* get_port(const string& port_name);
+ void add_port(PortModel* pm);
+ void remove_port(const string& port_path);
+
+ virtual void clear();
+
+ const map<int, map<int, string> >& get_programs() const { return m_banks; }
+ void add_program(int bank, int program, const string& name);
+ void remove_program(int bank, int program);
+
+ const PluginModel* plugin() const { return m_plugin; }
+ void plugin(const PluginModel* const pi) { m_plugin = pi; }
+
+ virtual void set_path(const Path& p);
+
+ int num_ports() const { return m_ports.size(); }
+ const PortModelList& ports() const { return m_ports; }
+ virtual bool polyphonic() const { return m_polyphonic; }
+ void polyphonic(bool b) { m_polyphonic = b; }
+ float x() const { return m_x; }
+ void x(float a) { m_x = a; }
+ float y() const { return m_y; }
+ void y(float a) { m_y = a; }
+
+ PatchModel* parent_patch() const { return (PatchModel*)m_parent; }
+
+protected:
+ bool m_polyphonic;
+ PortModelList m_ports; ///< List of ports (instead of map to preserve order)
+ const PluginModel* m_plugin; ///< The plugin this node is an instance of
+ float m_x; ///< Just metadata, here as an optimization for OmGtk
+ float m_y; ///< Just metadata, here as an optimization for OmGtk
+ map<int, map<int, string> > m_banks; ///< DSSI banks
+
+private:
+ // Prevent copies (undefined)
+ NodeModel(const NodeModel& copy);
+ NodeModel& operator=(const NodeModel& copy);
+};
+
+
+typedef map<string, NodeModel*> NodeModelMap;
+
+
+} // namespace LibOmClient
+
+#endif // NODEMODEL_H