diff options
author | David Robillard <d@drobilla.net> | 2011-01-10 23:50:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-01-10 23:50:45 +0000 |
commit | 21365044f63e70deb2e8bd0685349aad6ea14e85 (patch) | |
tree | 4263e3401340b97c6197f308e0aca03a25aa6566 /src/engine/machina/Controller.hpp | |
parent | e2babea8aa8b87ca930cc53fd5ee7cce4eff3206 (diff) | |
download | machina-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/engine/machina/Controller.hpp')
-rw-r--r-- | src/engine/machina/Controller.hpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/engine/machina/Controller.hpp b/src/engine/machina/Controller.hpp new file mode 100644 index 0000000..000fcad --- /dev/null +++ b/src/engine/machina/Controller.hpp @@ -0,0 +1,78 @@ +/* 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/>. + */ + +#ifndef MACHINA_CONTROLLER_HPP +#define MACHINA_CONTROLLER_HPP + +#include <stdint.h> + +#include <set> + +#include "raul/SharedPtr.hpp" +#include "raul/RingBuffer.hpp" + +#include "machina/types.hpp" +#include "machina/URIs.hpp" + +#include "Stateful.hpp" + +namespace Raul { class Atom; class Maid; } + +namespace Machina { + +class Engine; +class Machine; +class Stateful; + +namespace Client { class ClientModel; class ClientObject; } + +class Controller { +public: + Controller(SharedPtr<Engine> engine, Client::ClientModel& client_model); + + uint64_t create(const Client::ClientObject& obj); + uint64_t connect(uint64_t tail_id, uint64_t head_id); + void set_property(uint64_t object_id, URIInt key, const Raul::Atom& value); + void learn(SharedPtr<Raul::Maid> maid, uint64_t node_id); + void disconnect(uint64_t tail_id, uint64_t head_id); + void erase(uint64_t id); + + void announce(SharedPtr<Machine> machine); + + void process_updates(); + +private: + SharedPtr<Stateful> find(uint64_t id); + + struct StatefulComparator { + inline bool operator()(SharedPtr<Stateful> lhs, SharedPtr<Stateful> rhs) const { + return lhs->id() < rhs->id(); + } + }; + + typedef std::set<SharedPtr<Stateful>, StatefulComparator> Objects; + Objects _objects; + + SharedPtr<Engine> _engine; + Client::ClientModel& _client_model; + + SharedPtr<UpdateBuffer> _updates; +}; + +} + +#endif // MACHINA_CONTROLLER_HPP |