/*
This file is part of Ingen.
Copyright 2007-2016 David Robillard
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or any later version.
Ingen 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 Affero General Public License for details.
You should have received a copy of the GNU Affero General Public License
along with Ingen. If not, see .
*/
#ifndef INGEN_CLIENT_CLIENTSTORE_HPP
#define INGEN_CLIENT_CLIENTSTORE_HPP
#include
#include
#include
#include "ingen/Interface.hpp"
#include "ingen/Store.hpp"
#include "ingen/client/signal.hpp"
#include "ingen/ingen.h"
#include "ingen/types.hpp"
#include "raul/Path.hpp"
namespace Raul { class Atom; }
namespace Ingen {
class Log;
class Node;
class URIs;
namespace Client {
class BlockModel;
class GraphModel;
class ObjectModel;
class PluginModel;
class PortModel;
class SigClientInterface;
/** Automatically manages models of objects in the engine.
*
* @ingroup IngenClient
*/
class INGEN_API ClientStore : public Store
, public Interface
, public INGEN_TRACKABLE {
public:
ClientStore(
URIs& uris,
Log& log,
SPtr emitter = SPtr());
Raul::URI uri() const override { return Raul::URI("ingen:/clients/store"); }
SPtr object(const Raul::Path& path) const;
SPtr plugin(const Raul::URI& uri) const;
SPtr resource(const Raul::URI& uri) const;
void clear();
typedef std::map< const Raul::URI, SPtr > Plugins;
SPtr plugins() const { return _plugins; }
SPtr plugins() { return _plugins; }
void set_plugins(SPtr p) { _plugins = p; }
URIs& uris() { return _uris; }
void message(const Message& msg) override;
void operator()(const BundleBegin&) {}
void operator()(const BundleEnd&) {}
void operator()(const Connect&);
void operator()(const Copy&);
void operator()(const Del&);
void operator()(const Delta&);
void operator()(const Disconnect&);
void operator()(const DisconnectAll&);
void operator()(const Error&) {}
void operator()(const Get&) {}
void operator()(const Move&);
void operator()(const Put&);
void operator()(const Redo&) {}
void operator()(const Response&) {}
void operator()(const SetProperty&);
void operator()(const Undo&) {}
INGEN_SIGNAL(new_object, void, SPtr);
INGEN_SIGNAL(new_plugin, void, SPtr);
INGEN_SIGNAL(plugin_deleted, void, Raul::URI);
private:
SPtr _object(const Raul::Path& path);
SPtr _plugin(const Raul::URI& uri);
SPtr _plugin(const Atom& uri);
SPtr _resource(const Raul::URI& uri);
void add_object(SPtr object);
SPtr remove_object(const Raul::Path& path);
void add_plugin(SPtr pm);
SPtr connection_graph(const Raul::Path& tail_path,
const Raul::Path& head_path);
// Slots for SigClientInterface signals
bool attempt_connection(const Raul::Path& tail_path,
const Raul::Path& head_path);
URIs& _uris;
Log& _log;
SPtr _emitter;
SPtr _plugins; ///< Map, keyed by plugin URI
};
} // namespace Client
} // namespace Ingen
#endif // INGEN_CLIENT_CLIENTSTORE_HPP