summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/ConnectionModel.hpp5
-rw-r--r--src/libs/client/NodeModel.hpp1
-rw-r--r--src/libs/client/OSCClientReceiver.cpp2
-rw-r--r--src/libs/client/ObjectModel.cpp9
-rw-r--r--src/libs/client/ObjectModel.hpp12
-rw-r--r--src/libs/client/PatchModel.cpp31
-rw-r--r--src/libs/client/PatchModel.hpp26
-rw-r--r--src/libs/client/PortModel.hpp2
-rw-r--r--src/libs/client/Serializer.cpp27
-rw-r--r--src/libs/client/Serializer.hpp5
-rw-r--r--src/libs/client/Store.cpp25
-rw-r--r--src/libs/client/Store.hpp6
12 files changed, 76 insertions, 75 deletions
diff --git a/src/libs/client/ConnectionModel.hpp b/src/libs/client/ConnectionModel.hpp
index 83ddbd58..5ace402f 100644
--- a/src/libs/client/ConnectionModel.hpp
+++ b/src/libs/client/ConnectionModel.hpp
@@ -62,10 +62,11 @@ private:
assert(_dst_port);
assert(_src_port->parent());
assert(_dst_port->parent());
+ assert(_src_port->path() != _dst_port->path());
}
- SharedPtr<PortModel> _src_port;
- SharedPtr<PortModel> _dst_port;
+ const SharedPtr<PortModel> _src_port;
+ const SharedPtr<PortModel> _dst_port;
};
diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp
index a38c519c..9e26daaa 100644
--- a/src/libs/client/NodeModel.hpp
+++ b/src/libs/client/NodeModel.hpp
@@ -26,6 +26,7 @@
#include <raul/Path.hpp>
#include <raul/SharedPtr.hpp>
#include "interface/Node.hpp"
+#include "interface/Port.hpp"
#include "ObjectModel.hpp"
#include "PortModel.hpp"
#include "PluginModel.hpp"
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index b9f5a70d..0a1fa105 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -35,7 +35,7 @@ OSCClientReceiver::OSCClientReceiver(int listen_port)
_listen_port(listen_port),
_st(NULL)
{
- start(false);
+ start(true);
}
diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp
index ca38b42f..7d144faf 100644
--- a/src/libs/client/ObjectModel.cpp
+++ b/src/libs/client/ObjectModel.cpp
@@ -15,9 +15,10 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "ObjectModel.hpp"
-#include <raul/TableImpl.hpp>
#include <iostream>
+#include <raul/TableImpl.hpp>
+#include "interface/GraphObject.hpp"
+#include "ObjectModel.hpp"
using namespace std;
@@ -57,7 +58,7 @@ ObjectModel::children_end() const
}
-SharedPtr<ObjectModel>
+SharedPtr<Shared::GraphObject>
ObjectModel::find_child(const string& name) const
{
const_iterator me = _store.objects().find(_path);
@@ -65,7 +66,7 @@ ObjectModel::find_child(const string& name) const
const_iterator children_end = _store.objects().find_descendants_end(me);
const_iterator child = _store.objects().find(me, children_end, _path.base() + name);
if (child != _store.objects().end())
- return child->second;
+ return PtrCast<ObjectModel>(child->second);
else
return SharedPtr<ObjectModel>();
}
diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp
index ede796e4..3c13b227 100644
--- a/src/libs/client/ObjectModel.hpp
+++ b/src/libs/client/ObjectModel.hpp
@@ -28,10 +28,11 @@
#include <raul/Atom.hpp>
#include <raul/Path.hpp>
#include <raul/SharedPtr.hpp>
-#include <raul/Table.hpp>
+#include <raul/PathTable.hpp>
#include "interface/GraphObject.hpp"
#include "Store.hpp"
+using Raul::PathTable;
using std::string;
using Raul::Atom;
using Raul::Path;
@@ -68,12 +69,9 @@ public:
SharedPtr<ObjectModel> parent() const { return _parent; }
bool polyphonic() const { return _polyphonic; }
- typedef Store::Objects::iterator iterator;
- typedef Store::Objects::const_iterator const_iterator;
-
- const_iterator children_begin() const;
- const_iterator children_end() const;
- SharedPtr<ObjectModel> find_child(const string& name) const;
+ const_iterator children_begin() const;
+ const_iterator children_end() const;
+ SharedPtr<Shared::GraphObject> find_child(const string& name) const;
// Signals
sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child;
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 3997ac77..a0f0aa4b 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -31,8 +31,6 @@ void
PatchModel::add_child(SharedPtr<ObjectModel> c)
{
assert(c->parent().get() == this);
-
- //ObjectModel::add_child(c);
SharedPtr<PortModel> pm = PtrCast<PortModel>(c);
if (pm) {
@@ -45,13 +43,6 @@ PatchModel::add_child(SharedPtr<ObjectModel> c)
signal_new_node.emit(nm);
}
-/*
-SharedPtr<NodeModel>
-PatchModel::get_node(const string& name) const
-{
- return PtrCast<NodeModel>(get_child(name));
-}
-*/
bool
PatchModel::remove_child(SharedPtr<ObjectModel> o)
@@ -67,10 +58,11 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o)
// since they can't possibly exist anymore
for (Connections::iterator j = _connections.begin(); j != _connections.end() ; ) {
- list<SharedPtr<ConnectionModel> >::iterator next = j;
+ Connections::iterator next = j;
++next;
- SharedPtr<ConnectionModel> cm = (*j);
+ SharedPtr<ConnectionModel> cm = PtrCast<ConnectionModel>(*j);
+ assert(cm);
if (cm->src_port_path().parent() == o->path()
|| cm->src_port_path() == o->path()
@@ -106,9 +98,10 @@ PatchModel::clear()
SharedPtr<ConnectionModel>
PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const
{
- for (list<SharedPtr<ConnectionModel> >::const_iterator i = _connections.begin(); i != _connections.end(); ++i)
+ for (Connections::const_iterator i = _connections.begin(); i != _connections.end(); ++i)
if ((*i)->src_port_path() == src_port_path && (*i)->dst_port_path() == dst_port_path)
- return (*i);
+ return PtrCast<ConnectionModel>(*i);
+
return SharedPtr<ConnectionModel>();
}
@@ -129,18 +122,19 @@ PatchModel::add_connection(SharedPtr<ConnectionModel> cm)
assert(cm->dst_port());
assert(cm->src_port()->parent());
assert(cm->dst_port()->parent());
+ assert(cm->src_port_path() != cm->dst_port_path());
assert(cm->src_port()->parent().get() == this
|| cm->src_port()->parent()->parent().get() == this);
assert(cm->dst_port()->parent().get() == this
|| cm->dst_port()->parent()->parent().get() == this);
SharedPtr<ConnectionModel> existing = get_connection(cm->src_port_path(), cm->dst_port_path());
-
+
if (existing) {
assert(cm->src_port() == existing->src_port());
assert(cm->dst_port() == existing->dst_port());
} else {
- _connections.push_back(cm);
+ _connections.push_back(new Connections::Node(cm));
signal_new_connection.emit(cm);
}
}
@@ -149,11 +143,12 @@ PatchModel::add_connection(SharedPtr<ConnectionModel> cm)
void
PatchModel::remove_connection(const string& src_port_path, const string& dst_port_path)
{
- for (list<SharedPtr<ConnectionModel> >::iterator i = _connections.begin(); i != _connections.end(); ++i) {
- SharedPtr<ConnectionModel> cm = (*i);
+ for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i) {
+ SharedPtr<ConnectionModel> cm = PtrCast<ConnectionModel>(*i);
+ assert(cm);
if (cm->src_port_path() == src_port_path && cm->dst_port_path() == dst_port_path) {
signal_removed_connection.emit(cm);
- _connections.erase(i); // cuts our reference
+ delete _connections.erase(i); // cuts our reference
assert(!get_connection(src_port_path, dst_port_path)); // no duplicates
return;
}
diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp
index 642bf34f..5d375faf 100644
--- a/src/libs/client/PatchModel.hpp
+++ b/src/libs/client/PatchModel.hpp
@@ -22,8 +22,10 @@
#include <list>
#include <string>
#include <sigc++/sigc++.h>
-#include "NodeModel.hpp"
#include <raul/SharedPtr.hpp>
+#include "interface/Patch.hpp"
+#include "NodeModel.hpp"
+
#include "ConnectionModel.hpp"
using std::list; using std::string;
@@ -38,22 +40,21 @@ class Store;
*
* \ingroup IngenClient
*/
-class PatchModel : public NodeModel
+class PatchModel : public NodeModel, public Ingen::Shared::Patch
{
public:
- typedef std::list<SharedPtr<ConnectionModel> > Connections;
-
const Connections& connections() const { return _connections; }
- SharedPtr<ConnectionModel> get_connection(const string& src_port_path, const string& dst_port_path) const;
- //SharedPtr<NodeModel> get_node(const string& node_name) const;
+ SharedPtr<ConnectionModel> get_connection(const string& src_port_path,
+ const string& dst_port_path) const;
void set_filename(const string& filename) { _filename = filename; }
- size_t poly() const { return _poly; }
- const string& filename() const { return _filename; }
- bool enabled() const { return _enabled; }
- bool polyphonic() const;
+ size_t poly() const { return _poly; }
+ const string& filename() const { return _filename; }
+ bool enabled() const { return _enabled; }
+ uint32_t internal_polyphony() const { return _poly; }
+ bool polyphonic() const;
/** "editable" = arranging,connecting,adding,deleting,etc
* not editable (control mode) you can just change controllers (performing)
@@ -96,13 +97,10 @@ private:
void add_connection(SharedPtr<ConnectionModel> cm);
void remove_connection(const string& src_port_path, const string& dst_port_path);
- void rename_node(const Path& old_path, const Path& new_path);
- void rename_node_port(const Path& old_path, const Path& new_path);
-
Connections _connections;
string _filename;
bool _enabled;
- size_t _poly;
+ uint32_t _poly;
bool _editable;
};
diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp
index 06f04e78..5455c1f9 100644
--- a/src/libs/client/PortModel.hpp
+++ b/src/libs/client/PortModel.hpp
@@ -38,7 +38,7 @@ namespace Client {
*
* \ingroup IngenClient
*/
-class PortModel : public ObjectModel, public Shared::Port
+class PortModel : public ObjectModel, public Ingen::Shared::Port
{
public:
enum Direction { INPUT, OUTPUT };
diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp
index e37391d7..e15ce4dc 100644
--- a/src/libs/client/Serializer.cpp
+++ b/src/libs/client/Serializer.cpp
@@ -35,11 +35,12 @@
#include <raul/RDFWorld.hpp>
#include <raul/TableImpl.hpp>
#include "interface/EngineInterface.hpp"
+#include "interface/Plugin.hpp"
+#include "interface/Patch.hpp"
+#include "interface/Node.hpp"
#include "interface/Port.hpp"
#include "interface/Connection.hpp"
-#include "PatchModel.hpp"
#include "Serializer.hpp"
-#include "Store.hpp"
using namespace std;
using namespace Raul;
@@ -218,7 +219,7 @@ Serializer::serialize(SharedPtr<GraphObject> object) throw (std::logic_error)
if (!_model)
throw std::logic_error("serialize called without serialization in progress");
- SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object);
+ SharedPtr<Shared::Patch> patch = PtrCast<Shared::Patch>(object);
if (patch) {
serialize_patch(patch);
return;
@@ -230,7 +231,7 @@ Serializer::serialize(SharedPtr<GraphObject> object) throw (std::logic_error)
return;
}
- SharedPtr<Port> port = PtrCast<Port>(object);
+ SharedPtr<Shared::Port> port = PtrCast<Shared::Port>(object);
if (port) {
serialize_port(port.get(), path_to_node_id(port->path()));
return;
@@ -255,7 +256,7 @@ Serializer::patch_path_to_rdf_id(const Path& path)
void
-Serializer::serialize_patch(SharedPtr<PatchModel> patch)
+Serializer::serialize_patch(SharedPtr<Shared::Patch> patch)
{
assert(_model);
@@ -275,7 +276,7 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch)
_model->add_statement(
patch_id,
"ingen:polyphony",
- Atom((int)patch->poly()));
+ Atom((int)patch->internal_polyphony()));
_model->add_statement(
patch_id,
@@ -292,9 +293,9 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch)
}
}
- for (Store::Objects::const_iterator n = patch->children_begin(); n != patch->children_end(); ++n) {
- SharedPtr<PatchModel> patch = PtrCast<PatchModel>(n->second);
- SharedPtr<NodeModel> node = PtrCast<NodeModel>(n->second);
+ for (GraphObject::const_iterator n = patch->children_begin(); n != patch->children_end(); ++n) {
+ SharedPtr<Shared::Patch> patch = PtrCast<Shared::Patch>(n->second);
+ SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(n->second);
if (patch) {
_model->add_statement(patch_id, "ingen:node", patch_path_to_rdf_id(patch->path()));
serialize_patch(patch);
@@ -312,7 +313,8 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch)
serialize_port(p, port_id);
}
- for (PatchModel::Connections::const_iterator c = patch->connections().begin(); c != patch->connections().end(); ++c) {
+ for (Shared::Patch::Connections::const_iterator c = patch->connections().begin();
+ c != patch->connections().end(); ++c) {
serialize_connection(*c);
}
}
@@ -360,11 +362,6 @@ Serializer::serialize_node(SharedPtr<Shared::Node> node, const RDF::Node& node_i
//serialize_plugin(node->plugin());
- /*_model->add_statement(_serializer,
- node_uri_ref.c_str(),
- "ingen:name",
- Atom(node->path().name()));*/
-
for (uint32_t i=0; i < node->num_ports(); ++i) {
Port* p = node->port(i);
assert(p);
diff --git a/src/libs/client/Serializer.hpp b/src/libs/client/Serializer.hpp
index 7a739f94..f8b99750 100644
--- a/src/libs/client/Serializer.hpp
+++ b/src/libs/client/Serializer.hpp
@@ -37,6 +37,7 @@ namespace Ingen {
namespace Shared {
class Plugin;
class GraphObject;
+ class Patch;
class Node;
class Port;
class Connection;
@@ -44,8 +45,6 @@ namespace Shared {
namespace Client {
-class PatchModel;
-
/** Serializes Ingen objects (patches, nodes, etc) to RDF.
*
@@ -73,7 +72,7 @@ private:
void serialize_plugin(SharedPtr<Shared::Plugin> p);
- void serialize_patch(SharedPtr<PatchModel> p);
+ void serialize_patch(SharedPtr<Shared::Patch> p);
void serialize_node(SharedPtr<Shared::Node> n, const Raul::RDF::Node& id);
void serialize_port(const Shared::Port* p, const Raul::RDF::Node& id);
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index e1744ac0..ae07fa08 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -222,7 +222,7 @@ Store::add_object(SharedPtr<ObjectModel> object)
// one (with precedence to the new values).
Objects::iterator existing = _objects.find(object->path());
if (existing != _objects.end()) {
- existing->second->set(object);
+ PtrCast<ObjectModel>(existing->second)->set(object);
} else {
if (object->path() != "/") {
@@ -253,7 +253,11 @@ Store::add_object(SharedPtr<ObjectModel> object)
}
- //cout << "[Store] Added " << object->path() << endl;
+ /*cout << "[Store] Added " << object->path() << " {" << endl;
+ for (Objects::iterator i = _objects.begin(); i != _objects.end(); ++i) {
+ cout << "\t" << i->first << endl;
+ }
+ cout << "}" << endl;*/
}
@@ -264,10 +268,11 @@ Store::remove_object(const Path& path)
if (i != _objects.end()) {
assert((*i).second->path() == path);
- SharedPtr<ObjectModel> result = (*i).second;
+ SharedPtr<ObjectModel> result = PtrCast<ObjectModel>((*i).second);
+ assert(result);
//_objects.erase(i);
Objects::iterator descendants_end = _objects.find_descendants_end(i);
- Table<Path,SharedPtr<ObjectModel> > removed = _objects.yank(i, descendants_end);
+ Table<Path, SharedPtr<Shared::GraphObject> > removed = _objects.yank(i, descendants_end);
/*cout << "[Store] Removing " << i->first << " {" << endl;
for (Objects::iterator i = removed.begin(); i != removed.end(); ++i) {
cout << "\t" << i->first << endl;
@@ -317,8 +322,10 @@ Store::object(const Path& path)
if (i == _objects.end()) {
return SharedPtr<ObjectModel>();
} else {
- assert(i->second->path() == "/" || i->second->parent());
- return i->second;
+ SharedPtr<ObjectModel> model = PtrCast<ObjectModel>(i->second);
+ assert(model);
+ assert(model->path() == "/" || model->parent());
+ return model;
}
}
@@ -358,11 +365,11 @@ Store::rename_event(const Path& old_path, const Path& new_path)
Objects::iterator descendants_end = _objects.find_descendants_end(parent);
- Table<Path,SharedPtr<ObjectModel> > removed = _objects.yank(parent, descendants_end);
+ Table<Path, SharedPtr<Shared::GraphObject> > removed = _objects.yank(parent, descendants_end);
assert(removed.size() > 0);
- for (Table<Path,SharedPtr<ObjectModel> >::iterator i = removed.begin(); i != removed.end(); ++i) {
+ for (Table<Path, SharedPtr<Shared::GraphObject> >::iterator i = removed.begin(); i != removed.end(); ++i) {
const Path& child_old_path = i->first;
assert(Path::descendant_comparator(old_path, child_old_path));
@@ -373,7 +380,7 @@ Store::rename_event(const Path& old_path, const Path& new_path)
child_new_path = new_path.base() + child_old_path.substr(old_path.length()+1);
cerr << "[Store] Renamed " << child_old_path << " -> " << child_new_path << endl;
- i->second->set_path(child_new_path);
+ PtrCast<ObjectModel>(i->second)->set_path(child_new_path);
i->first = child_new_path;
}
diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp
index 26aac803..dad403d0 100644
--- a/src/libs/client/Store.hpp
+++ b/src/libs/client/Store.hpp
@@ -34,6 +34,9 @@ using Raul::Path;
using Raul::Atom;
namespace Ingen {
+
+namespace Shared { class GraphObject; }
+
namespace Client {
class SigClientInterface;
@@ -63,10 +66,11 @@ public:
typedef Raul::Table<string, SharedPtr<PluginModel> > Plugins;
const Plugins& plugins() const { return _plugins; }
- typedef Raul::PathTable<SharedPtr<ObjectModel> > Objects;
+ typedef Raul::PathTable< SharedPtr<Shared::GraphObject> > Objects;
const Objects& objects() const { return _objects; }
sigc::signal<void, SharedPtr<ObjectModel> > signal_new_object;
+
private:
void add_object(SharedPtr<ObjectModel> object);