aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/machina
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-18 07:53:39 +0000
committerDavid Robillard <d@drobilla.net>2014-12-18 07:53:39 +0000
commit0f5a2bafb9f1c3f64256e1899857b2f5cb3d8982 (patch)
treef826e3cda65db9990aa9d1b805d634f0e3ce23d5 /src/engine/machina
parent452f0c9a8e020831eedb0dcb8b78b8ca9435b502 (diff)
downloadmachina-0f5a2bafb9f1c3f64256e1899857b2f5cb3d8982.tar.gz
machina-0f5a2bafb9f1c3f64256e1899857b2f5cb3d8982.tar.bz2
machina-0f5a2bafb9f1c3f64256e1899857b2f5cb3d8982.zip
Work towards engine/GUI separation.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@5495 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/machina')
-rw-r--r--src/engine/machina/Controller.hpp19
-rw-r--r--src/engine/machina/Model.hpp44
-rw-r--r--src/engine/machina/types.hpp6
3 files changed, 56 insertions, 13 deletions
diff --git a/src/engine/machina/Controller.hpp b/src/engine/machina/Controller.hpp
index e745c9c..833b5b2 100644
--- a/src/engine/machina/Controller.hpp
+++ b/src/engine/machina/Controller.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Machina.
- Copyright 2007-2013 David Robillard <http://drobilla.net>
+ Copyright 2007-2014 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
@@ -24,8 +24,9 @@
#include "raul/RingBuffer.hpp"
#include "raul/Maid.hpp"
-#include "machina/types.hpp"
+#include "machina/Model.hpp"
#include "machina/URIs.hpp"
+#include "machina/types.hpp"
#include "Stateful.hpp"
@@ -37,19 +38,13 @@ namespace machina {
class Engine;
class Machine;
-class Stateful;
-
-namespace client {
-class ClientModel;
-class ClientObject;
-}
class Controller
{
public:
- Controller(SPtr<Engine> engine, client::ClientModel& client_model);
+ Controller(SPtr<Engine> engine, Model& model);
- uint64_t create(const client::ClientObject& obj);
+ uint64_t create(const Properties& properties);
uint64_t connect(uint64_t tail_id, uint64_t head_id);
void set_property(uint64_t object_id, URIInt key, const Atom& value);
@@ -74,8 +69,8 @@ private:
typedef std::set<SPtr<Stateful>, StatefulComparator> Objects;
Objects _objects;
- SPtr<Engine> _engine;
- client::ClientModel& _client_model;
+ SPtr<Engine> _engine;
+ Model& _model;
SPtr<Raul::RingBuffer> _updates;
};
diff --git a/src/engine/machina/Model.hpp b/src/engine/machina/Model.hpp
new file mode 100644
index 0000000..32a332e
--- /dev/null
+++ b/src/engine/machina/Model.hpp
@@ -0,0 +1,44 @@
+/*
+ This file is part of Machina.
+ Copyright 2014 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 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/>.
+*/
+
+#ifndef MACHINA_MODEL_HPP
+#define MACHINA_MODEL_HPP
+
+#include <stdint.h>
+
+#include <map>
+
+#include "machina/Atom.hpp"
+#include "machina/types.hpp"
+
+namespace machina {
+
+class Model
+{
+public:
+ virtual ~Model() {}
+
+ virtual void new_object(uint64_t id, const Properties& properties) = 0;
+
+ virtual void erase_object(uint64_t id) = 0;
+
+ virtual void set(uint64_t id, URIInt key, const Atom& value) = 0;
+ virtual const Atom& get(uint64_t id, URIInt key) const = 0;
+};
+
+} // namespace machina
+
+#endif // MACHINA_MODEL_HPP
diff --git a/src/engine/machina/types.hpp b/src/engine/machina/types.hpp
index fff2601..e9ac7d0 100644
--- a/src/engine/machina/types.hpp
+++ b/src/engine/machina/types.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Machina.
- Copyright 2007-2013 David Robillard <http://drobilla.net>
+ Copyright 2007-2014 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
@@ -17,6 +17,7 @@
#ifndef MACHINA_TYPES_HPP
#define MACHINA_TYPES_HPP
+#include <map>
#include <memory>
#include "raul/RingBuffer.hpp"
@@ -27,6 +28,9 @@ typedef unsigned char byte;
typedef uint32_t URIInt;
+class Atom;
+typedef std::map<URIInt, Atom> Properties;
+
#if __cplusplus >= 201103L
template <class T>
using SPtr = std::shared_ptr<T>;