From 9da093217352daa1fb61a6f2daf5195640e286a7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Mar 2012 04:13:23 +0000 Subject: Merge ClientInterface and ServerInterface. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4067 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/ClientInterface.hpp | 51 ---------------- ingen/CommonInterface.hpp | 75 ------------------------ ingen/EngineBase.hpp | 4 +- ingen/Interface.hpp | 91 +++++++++++++++++++++++++++++ ingen/ServerInterface.hpp | 52 ----------------- ingen/client/ClientStore.hpp | 20 ++++--- ingen/client/PluginModel.hpp | 2 +- ingen/client/PluginUI.hpp | 2 +- ingen/client/SigClientInterface.hpp | 8 ++- ingen/client/ThreadedSigClientInterface.hpp | 4 +- ingen/serialisation/Parser.hpp | 6 +- ingen/shared/Builder.hpp | 8 +-- ingen/shared/ClashAvoider.hpp | 20 ++++--- ingen/shared/World.hpp | 21 ++++--- 14 files changed, 146 insertions(+), 218 deletions(-) delete mode 100644 ingen/ClientInterface.hpp delete mode 100644 ingen/CommonInterface.hpp create mode 100644 ingen/Interface.hpp delete mode 100644 ingen/ServerInterface.hpp (limited to 'ingen') diff --git a/ingen/ClientInterface.hpp b/ingen/ClientInterface.hpp deleted file mode 100644 index d59e25b5..00000000 --- a/ingen/ClientInterface.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard - * - * Ingen 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 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_INTERFACE_CLIENTINTERFACE_HPP -#define INGEN_INTERFACE_CLIENTINTERFACE_HPP - -#include - -#include - -#include "raul/URI.hpp" - -#include "ingen/CommonInterface.hpp" -#include "ingen/Status.hpp" - -namespace Raul { class Path; } - -namespace Ingen { - -/** The (only) interface the engine uses to communicate with clients. - * Purely virtual (except for the destructor). - * - * \ingroup interface - */ -class ClientInterface : public CommonInterface -{ -public: - virtual ~ClientInterface() {} - - virtual void response(int32_t id, Status status) = 0; - - virtual void error(const std::string& msg) = 0; -}; - -} // namespace Ingen - -#endif diff --git a/ingen/CommonInterface.hpp b/ingen/CommonInterface.hpp deleted file mode 100644 index 398fbd3b..00000000 --- a/ingen/CommonInterface.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2008-2011 David Robillard - * - * Ingen 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 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_INTERFACE_COMMONINTERFACE_HPP -#define INGEN_INTERFACE_COMMONINTERFACE_HPP - -#include "ingen/Resource.hpp" - -namespace Raul { class Atom; class Path; class URI; } - -namespace Ingen { - -/** Abstract interface common to both engine and clients. - * Purely virtual (except for the destructor). - * - * \ingroup interface - */ -class CommonInterface -{ -public: - virtual ~CommonInterface() {} - - virtual Raul::URI uri() const = 0; - - /** Begin an atomic bundle */ - virtual void bundle_begin() = 0; - - /** End (and send) an atomic bundle */ - virtual void bundle_end() = 0; - - virtual void put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT) = 0; - - virtual void delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add) = 0; - - virtual void move(const Raul::Path& old_path, - const Raul::Path& new_path) = 0; - - virtual void del(const Raul::URI& uri) = 0; - - virtual void connect(const Raul::Path& src_port_path, - const Raul::Path& dst_port_path) = 0; - - virtual void disconnect(const Raul::URI& src, - const Raul::URI& dst) = 0; - - virtual void disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path) = 0; - - virtual void set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Raul::Atom& value) = 0; -}; - -} // namespace Ingen - -#endif // INGEN_INTERFACE_COMMONINTERFACE_HPP - diff --git a/ingen/EngineBase.hpp b/ingen/EngineBase.hpp index a0fba00f..87a637ae 100644 --- a/ingen/EngineBase.hpp +++ b/ingen/EngineBase.hpp @@ -22,7 +22,7 @@ namespace Ingen { -class ClientInterface; +class Interface; /** The engine which executes the process graph. @@ -69,7 +69,7 @@ public: Register a client to receive updates about engine changes. */ virtual void register_client(const Raul::URI& uri, - ClientInterface* client) = 0; + Interface* client) = 0; /** Unregister a client. diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp new file mode 100644 index 00000000..cdc37949 --- /dev/null +++ b/ingen/Interface.hpp @@ -0,0 +1,91 @@ +/* This file is part of Ingen. + * Copyright 2008-2012 David Robillard + * + * Ingen 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 2 of the License, or (at your option) 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 General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INGEN_INTERFACE_HPP +#define INGEN_INTERFACE_HPP + +#include "ingen/Resource.hpp" +#include "ingen/Status.hpp" + +namespace Raul { class Atom; class Path; class URI; } + +namespace Ingen { + +/** Abstract interface common to both engine and clients. + * Purely virtual (except for the destructor). + * + * \ingroup interface + */ +class Interface +{ +public: + virtual ~Interface() {} + + virtual Raul::URI uri() const = 0; + + /** Begin an atomic bundle */ + virtual void bundle_begin() = 0; + + /** End (and send) an atomic bundle */ + virtual void bundle_end() = 0; + + virtual void put(const Raul::URI& uri, + const Resource::Properties& properties, + Resource::Graph ctx=Resource::DEFAULT) = 0; + + virtual void delta(const Raul::URI& uri, + const Resource::Properties& remove, + const Resource::Properties& add) = 0; + + virtual void move(const Raul::Path& old_path, + const Raul::Path& new_path) = 0; + + virtual void del(const Raul::URI& uri) = 0; + + virtual void connect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path) = 0; + + virtual void disconnect(const Raul::URI& src, + const Raul::URI& dst) = 0; + + virtual void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path) = 0; + + virtual void set_property(const Raul::URI& subject, + const Raul::URI& predicate, + const Raul::Atom& value) = 0; + + /** Set the ID to use to respond to the next message. + * Setting the ID to -1 will disable responses. + */ + virtual void set_response_id(int32_t id) = 0; + + // Requests + virtual void ping() = 0; + virtual void get(const Raul::URI& uri) = 0; + + // Response + virtual void response(int32_t id, Status status) = 0; + + // Non-response error + virtual void error(const std::string& msg) = 0; +}; + +} // namespace Ingen + +#endif // INGEN_INTERFACE_HPP + diff --git a/ingen/ServerInterface.hpp b/ingen/ServerInterface.hpp deleted file mode 100644 index dade9658..00000000 --- a/ingen/ServerInterface.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard - * - * Ingen 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 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_INTERFACE_SERVERINTERFACE_HPP -#define INGEN_INTERFACE_SERVERINTERFACE_HPP - -#include - -#include "ingen/CommonInterface.hpp" - -namespace Ingen { - -class ClientInterface; - -/** The (only) interface clients use to communicate with the engine. - * Purely virtual (except for the destructor). - * - * \ingroup interface - */ -class ServerInterface : public CommonInterface -{ -public: - virtual ~ServerInterface() {} - - /** Set the ID to use to respond to the next message. - * Setting the ID to -1 will disable responses. - */ - virtual void set_response_id(int32_t id) = 0; - - // Requests - virtual void ping() = 0; - virtual void get(const Raul::URI& uri) = 0; -}; - -} // namespace Ingen - -#endif // INGEN_INTERFACE_SERVERINTERFACE_HPP - diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index e29723ae..dbba8e90 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -27,7 +27,7 @@ #include "raul/SharedPtr.hpp" #include "raul/TableImpl.hpp" -#include "ingen/ServerInterface.hpp" +#include "ingen/Interface.hpp" #include "ingen/client/signal.hpp" #include "ingen/shared/LV2URIMap.hpp" #include "ingen/shared/Store.hpp" @@ -54,13 +54,13 @@ class SigClientInterface; * \ingroup IngenClient */ class ClientStore : public Shared::Store - , public CommonInterface + , public Interface , public INGEN_TRACKABLE { public: ClientStore( SharedPtr uris, - SharedPtr engine=SharedPtr(), - SharedPtr emitter=SharedPtr()); + SharedPtr engine = SharedPtr(), + SharedPtr emitter = SharedPtr()); Raul::URI uri() const { return "ingen:ClientStore"; } @@ -103,8 +103,14 @@ public: void del(const Raul::URI& uri); - INGEN_SIGNAL(new_object, void, SharedPtr); - INGEN_SIGNAL(new_plugin, void, SharedPtr); + void set_response_id(int32_t id) {} + void ping() {} + void get(const Raul::URI& uri) {} + void response(int32_t id, Status status) {} + void error(const std::string& msg) {} + + INGEN_SIGNAL(new_object, void, SharedPtr); + INGEN_SIGNAL(new_plugin, void, SharedPtr); private: void add(GraphObject* o) { throw; } @@ -129,7 +135,7 @@ private: const Raul::Path& dst_port_path); SharedPtr _uris; - SharedPtr _engine; + SharedPtr _engine; SharedPtr _emitter; SharedPtr _plugins; ///< Map, keyed by plugin URI diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index a0887454..62c5b92f 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -24,7 +24,7 @@ #include "sord/sordmm.hpp" #include "ingen/Plugin.hpp" -#include "ingen/ServerInterface.hpp" +#include "ingen/Interface.hpp" #include "ingen/client/signal.hpp" #include "ingen/shared/ResourceImpl.hpp" #include "ingen/shared/World.hpp" diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 501db260..c99c5fb8 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -28,7 +28,7 @@ namespace Ingen { -class ServerInterface; +class Interface; namespace Shared { class World; } diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp index db59be9d..afc4d66b 100644 --- a/ingen/client/SigClientInterface.hpp +++ b/ingen/client/SigClientInterface.hpp @@ -22,7 +22,7 @@ #include "raul/Path.hpp" -#include "ingen/ClientInterface.hpp" +#include "ingen/Interface.hpp" #include "ingen/client/signal.hpp" namespace Ingen { @@ -36,7 +36,7 @@ namespace Client { * The signals here match the calls to ClientInterface exactly. See the * documentation for ClientInterface for meanings of signal parameters. */ -class SigClientInterface : public Ingen::ClientInterface, +class SigClientInterface : public Ingen::Interface, public INGEN_TRACKABLE { public: @@ -109,6 +109,10 @@ protected: void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value) { EMIT(property_change, subject, key, value); } + + void set_response_id(int32_t id) {} + void ping() {} + void get(const Raul::URI& uri) {} }; } // namespace Client diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp index 2a33eae8..30185c4c 100644 --- a/ingen/client/ThreadedSigClientInterface.hpp +++ b/ingen/client/ThreadedSigClientInterface.hpp @@ -29,7 +29,7 @@ #include "raul/Atom.hpp" #include "raul/SRSWQueue.hpp" -#include "ingen/ClientInterface.hpp" +#include "ingen/Interface.hpp" #include "ingen/client/SigClientInterface.hpp" /** Returns nothing and takes no parameters (because they have all been bound) */ @@ -37,7 +37,7 @@ typedef sigc::slot Closure; namespace Ingen { -class ServerInterface; +class Interface; namespace Client { diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index 492af2ad..f242108b 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -30,7 +30,7 @@ namespace Ingen { -class CommonInterface; +class Interface; namespace Shared { class World; } @@ -50,7 +50,7 @@ public: virtual bool parse_file( Shared::World* world, - CommonInterface* target, + Interface* target, Glib::ustring path, boost::optional parent = boost::optional(), boost::optional symbol = boost::optional(), @@ -58,7 +58,7 @@ public: virtual bool parse_string( Shared::World* world, - CommonInterface* target, + Interface* target, const Glib::ustring& str, const Glib::ustring& base_uri, boost::optional parent = boost::optional(), diff --git a/ingen/shared/Builder.hpp b/ingen/shared/Builder.hpp index 245b3013..5db41b44 100644 --- a/ingen/shared/Builder.hpp +++ b/ingen/shared/Builder.hpp @@ -22,21 +22,21 @@ namespace Ingen { -class CommonInterface; +class Interface; class GraphObject; namespace Shared { class URIs; -/** Wrapper for CommonInterface to create existing objects/models. +/** Wrapper for Interface to create existing objects/models. * * \ingroup interface */ class Builder { public: - Builder(SharedPtr uris, CommonInterface& interface); + Builder(SharedPtr uris, Interface& interface); virtual ~Builder() {} void build(SharedPtr object); @@ -46,7 +46,7 @@ private: void build_object(SharedPtr object); SharedPtr _uris; - CommonInterface& _interface; + Interface& _interface; }; } // namespace Shared diff --git a/ingen/shared/ClashAvoider.hpp b/ingen/shared/ClashAvoider.hpp index 4f5d8ec1..5c33d412 100644 --- a/ingen/shared/ClashAvoider.hpp +++ b/ingen/shared/ClashAvoider.hpp @@ -22,7 +22,7 @@ #include -#include "ingen/CommonInterface.hpp" +#include "ingen/Interface.hpp" namespace Raul { class Atom; class Path; } @@ -31,18 +31,18 @@ namespace Shared { class Store; -/** A wrapper for a CommonInterface that creates objects but possibly maps +/** A wrapper for an Interface that creates objects but possibly maps * symbol names to avoid clashes with the existing objects in a store. */ -class ClashAvoider : public CommonInterface +class ClashAvoider : public Interface { public: - ClashAvoider(Store& store, CommonInterface& target, Store* also_avoid=NULL) + ClashAvoider(Store& store, Interface& target, Store* also_avoid=NULL) : _store(store), _target(target), _also_avoid(also_avoid) {} Raul::URI uri() const { return "ingen:ClientStore"; } - void set_target(CommonInterface& target) { _target = target; } + void set_target(Interface& target) { _target = target; } // Bundles void bundle_begin() { _target.bundle_begin(); } @@ -76,12 +76,18 @@ public: virtual void del(const Raul::URI& uri); + virtual void set_response_id(int32_t id) {} + virtual void ping() {} + virtual void get(const Raul::URI& uri) {} + virtual void response(int32_t id, Status status) {} + virtual void error(const std::string& msg) {} + private: const Raul::URI map_uri(const Raul::URI& in); const Raul::Path map_path(const Raul::Path& in); - Store& _store; - CommonInterface& _target; + Store& _store; + Interface& _target; Store* _also_avoid; bool exists(const Raul::Path& path) const; diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp index e062dea6..aa308efd 100644 --- a/ingen/shared/World.hpp +++ b/ingen/shared/World.hpp @@ -35,8 +35,7 @@ namespace Sord { class World; } namespace Ingen { class EngineBase; -class ClientInterface; -class ServerInterface; +class Interface; namespace Serialisation { class Serialiser; class Parser; } @@ -71,29 +70,29 @@ public: virtual void unload_modules(); - typedef SharedPtr (*InterfaceFactory)( - World* world, - const std::string& engine_url, - SharedPtr respond_to); + typedef SharedPtr (*InterfaceFactory)( + World* world, + const std::string& engine_url, + SharedPtr respond_to); virtual void add_interface_factory(const std::string& scheme, InterfaceFactory factory); - virtual SharedPtr interface( - const std::string& engine_url, - SharedPtr respond_to); + virtual SharedPtr interface( + const std::string& engine_url, + SharedPtr respond_to); virtual bool run(const std::string& mime_type, const std::string& filename); virtual void set_local_engine(SharedPtr e); - virtual void set_engine(SharedPtr e); + virtual void set_engine(SharedPtr e); virtual void set_serialiser(SharedPtr s); virtual void set_parser(SharedPtr p); virtual void set_store(SharedPtr s); virtual SharedPtr local_engine(); - virtual SharedPtr engine(); + virtual SharedPtr engine(); virtual SharedPtr serialiser(); virtual SharedPtr parser(); virtual SharedPtr store(); -- cgit v1.2.1