aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/ClientModel.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-10 23:50:45 +0000
committerDavid Robillard <d@drobilla.net>2011-01-10 23:50:45 +0000
commit21365044f63e70deb2e8bd0685349aad6ea14e85 (patch)
tree4263e3401340b97c6197f308e0aca03a25aa6566 /src/client/ClientModel.cpp
parente2babea8aa8b87ca930cc53fd5ee7cce4eff3206 (diff)
downloadmachina-21365044f63e70deb2e8bd0685349aad6ea14e85.tar.gz
machina-21365044f63e70deb2e8bd0685349aad6ea14e85.tar.bz2
machina-21365044f63e70deb2e8bd0685349aad6ea14e85.zip
Add missing files.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@2824 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client/ClientModel.cpp')
-rw-r--r--src/client/ClientModel.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/client/ClientModel.cpp b/src/client/ClientModel.cpp
new file mode 100644
index 0000000..f26d853
--- /dev/null
+++ b/src/client/ClientModel.cpp
@@ -0,0 +1,63 @@
+/* This file is part of Machina.
+ * Copyright (C) 2010 David Robillard <http://drobilla.net>
+ *
+ * Machina 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Machina 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 more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Machina. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ClientModel.hpp"
+
+namespace Machina {
+namespace Client {
+
+SharedPtr<ClientObject>
+ClientModel::find(uint64_t id)
+{
+ SharedPtr<ClientObject> key(new ClientObjectKey(id));
+ Objects::iterator i = _objects.find(key);
+ if (i != _objects.end())
+ return *i;
+ else
+ return SharedPtr<ClientObject>();
+}
+
+void
+ClientModel::new_object(SharedPtr<ClientObject> object)
+{
+ _objects.insert(object);
+ signal_new_object.emit(object);
+}
+
+void
+ClientModel::erase_object(uint64_t id)
+{
+ SharedPtr<ClientObject> key(new ClientObjectKey(id));
+ Objects::iterator i = _objects.find(key);
+ if (i == _objects.end())
+ return;
+
+ signal_erase_object.emit(*i);
+ (*i)->set_view(SharedPtr<ClientObject::View>());
+ _objects.erase(i);
+}
+
+void
+ClientModel::property(uint64_t id, URIInt key, const Raul::Atom& value)
+{
+ SharedPtr<ClientObject> object = find(id);
+ if (object)
+ object->set(key, value);
+}
+
+}
+}