diff options
author | David Robillard <d@drobilla.net> | 2012-03-16 04:13:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-16 04:13:23 +0000 |
commit | 9da093217352daa1fb61a6f2daf5195640e286a7 (patch) | |
tree | fb3489c04451dc14a61170ba2418123727414340 /ingen | |
parent | 119468f621a59d86da10bedf75c4427b70f9d370 (diff) | |
download | ingen-9da093217352daa1fb61a6f2daf5195640e286a7.tar.gz ingen-9da093217352daa1fb61a6f2daf5195640e286a7.tar.bz2 ingen-9da093217352daa1fb61a6f2daf5195640e286a7.zip |
Merge ClientInterface and ServerInterface.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4067 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ingen')
-rw-r--r-- | ingen/ClientInterface.hpp | 51 | ||||
-rw-r--r-- | ingen/EngineBase.hpp | 4 | ||||
-rw-r--r-- | ingen/Interface.hpp (renamed from ingen/CommonInterface.hpp) | 28 | ||||
-rw-r--r-- | ingen/ServerInterface.hpp | 52 | ||||
-rw-r--r-- | ingen/client/ClientStore.hpp | 20 | ||||
-rw-r--r-- | ingen/client/PluginModel.hpp | 2 | ||||
-rw-r--r-- | ingen/client/PluginUI.hpp | 2 | ||||
-rw-r--r-- | ingen/client/SigClientInterface.hpp | 8 | ||||
-rw-r--r-- | ingen/client/ThreadedSigClientInterface.hpp | 4 | ||||
-rw-r--r-- | ingen/serialisation/Parser.hpp | 6 | ||||
-rw-r--r-- | ingen/shared/Builder.hpp | 8 | ||||
-rw-r--r-- | ingen/shared/ClashAvoider.hpp | 20 | ||||
-rw-r--r-- | ingen/shared/World.hpp | 21 |
13 files changed, 77 insertions, 149 deletions
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 <http://drobilla.net> - * - * 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 <stdint.h> - -#include <string> - -#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/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/CommonInterface.hpp b/ingen/Interface.hpp index 398fbd3b..cdc37949 100644 --- a/ingen/CommonInterface.hpp +++ b/ingen/Interface.hpp @@ -1,5 +1,5 @@ /* This file is part of Ingen. - * Copyright 2008-2011 David Robillard <http://drobilla.net> + * Copyright 2008-2012 David Robillard <http://drobilla.net> * * 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 @@ -15,10 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INGEN_INTERFACE_COMMONINTERFACE_HPP -#define INGEN_INTERFACE_COMMONINTERFACE_HPP +#ifndef INGEN_INTERFACE_HPP +#define INGEN_INTERFACE_HPP #include "ingen/Resource.hpp" +#include "ingen/Status.hpp" namespace Raul { class Atom; class Path; class URI; } @@ -29,10 +30,10 @@ namespace Ingen { * * \ingroup interface */ -class CommonInterface +class Interface { public: - virtual ~CommonInterface() {} + virtual ~Interface() {} virtual Raul::URI uri() const = 0; @@ -67,9 +68,24 @@ public: 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_COMMONINTERFACE_HPP +#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 <http://drobilla.net> - * - * 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 <stdint.h> - -#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<Shared::URIs> uris, - SharedPtr<ServerInterface> engine=SharedPtr<ServerInterface>(), - SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); + SharedPtr<Interface> engine = SharedPtr<Interface>(), + SharedPtr<SigClientInterface> emitter = SharedPtr<SigClientInterface>()); Raul::URI uri() const { return "ingen:ClientStore"; } @@ -103,8 +103,14 @@ public: void del(const Raul::URI& uri); - INGEN_SIGNAL(new_object, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(new_plugin, void, SharedPtr<PluginModel>); + 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<ObjectModel>); + INGEN_SIGNAL(new_plugin, void, SharedPtr<PluginModel>); private: void add(GraphObject* o) { throw; } @@ -129,7 +135,7 @@ private: const Raul::Path& dst_port_path); SharedPtr<Shared::URIs> _uris; - SharedPtr<ServerInterface> _engine; + SharedPtr<Interface> _engine; SharedPtr<SigClientInterface> _emitter; SharedPtr<Plugins> _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<void> 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<Raul::Path> parent = boost::optional<Raul::Path>(), boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(), @@ -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<Raul::Path> parent = boost::optional<Raul::Path>(), 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<Shared::URIs> uris, CommonInterface& interface); + Builder(SharedPtr<Shared::URIs> uris, Interface& interface); virtual ~Builder() {} void build(SharedPtr<const GraphObject> object); @@ -46,7 +46,7 @@ private: void build_object(SharedPtr<const GraphObject> object); SharedPtr<Shared::URIs> _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 <map> -#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<ServerInterface> (*InterfaceFactory)( - World* world, - const std::string& engine_url, - SharedPtr<ClientInterface> respond_to); + typedef SharedPtr<Interface> (*InterfaceFactory)( + World* world, + const std::string& engine_url, + SharedPtr<Interface> respond_to); virtual void add_interface_factory(const std::string& scheme, InterfaceFactory factory); - virtual SharedPtr<ServerInterface> interface( - const std::string& engine_url, - SharedPtr<ClientInterface> respond_to); + virtual SharedPtr<Interface> interface( + const std::string& engine_url, + SharedPtr<Interface> respond_to); virtual bool run(const std::string& mime_type, const std::string& filename); virtual void set_local_engine(SharedPtr<EngineBase> e); - virtual void set_engine(SharedPtr<ServerInterface> e); + virtual void set_engine(SharedPtr<Interface> e); virtual void set_serialiser(SharedPtr<Serialisation::Serialiser> s); virtual void set_parser(SharedPtr<Serialisation::Parser> p); virtual void set_store(SharedPtr<Store> s); virtual SharedPtr<EngineBase> local_engine(); - virtual SharedPtr<ServerInterface> engine(); + virtual SharedPtr<Interface> engine(); virtual SharedPtr<Serialisation::Serialiser> serialiser(); virtual SharedPtr<Serialisation::Parser> parser(); virtual SharedPtr<Store> store(); |