From 629fb50716083c71146340de97eb8651679ca9fb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jul 2012 00:14:50 +0000 Subject: Merge Ingen::Shared namespace into Ingen namespace and core libingen library. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4579 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/AtomReader.hpp | 60 +++++++++++++++ ingen/AtomSink.hpp | 40 ++++++++++ ingen/AtomWriter.hpp | 98 +++++++++++++++++++++++ ingen/Builder.hpp | 49 ++++++++++++ ingen/ClashAvoider.hpp | 108 ++++++++++++++++++++++++++ ingen/Configuration.hpp | 35 +++++++++ ingen/Forge.hpp | 40 ++++++++++ ingen/GraphObject.hpp | 7 +- ingen/LV2Features.hpp | 74 ++++++++++++++++++ ingen/Module.hpp | 53 +++++++++++++ ingen/Plugin.hpp | 2 +- ingen/Resource.hpp | 21 +++-- ingen/Store.hpp | 60 +++++++++++++++ ingen/URIMap.hpp | 80 +++++++++++++++++++ ingen/URIs.hpp | 143 ++++++++++++++++++++++++++++++++++ ingen/World.hpp | 151 ++++++++++++++++++++++++++++++++++++ ingen/client/ClientStore.hpp | 12 +-- ingen/client/NodeModel.hpp | 10 +-- ingen/client/ObjectModel.hpp | 4 +- ingen/client/PatchModel.hpp | 2 +- ingen/client/PluginModel.hpp | 19 +++-- ingen/client/PluginUI.hpp | 17 ++-- ingen/client/PortModel.hpp | 2 +- ingen/runtime_paths.hpp | 33 ++++++++ ingen/serialisation/Parser.hpp | 7 +- ingen/serialisation/Serialiser.hpp | 10 +-- ingen/shared/AtomReader.hpp | 62 --------------- ingen/shared/AtomSink.hpp | 42 ---------- ingen/shared/AtomWriter.hpp | 100 ------------------------ ingen/shared/Builder.hpp | 51 ------------ ingen/shared/ClashAvoider.hpp | 110 -------------------------- ingen/shared/Configuration.hpp | 37 --------- ingen/shared/Forge.hpp | 42 ---------- ingen/shared/LV2Features.hpp | 78 ------------------- ingen/shared/Module.hpp | 55 ------------- ingen/shared/Store.hpp | 62 --------------- ingen/shared/URIMap.hpp | 82 -------------------- ingen/shared/URIs.hpp | 145 ---------------------------------- ingen/shared/World.hpp | 154 ------------------------------------- ingen/shared/runtime_paths.hpp | 35 --------- 40 files changed, 1075 insertions(+), 1117 deletions(-) create mode 100644 ingen/AtomReader.hpp create mode 100644 ingen/AtomSink.hpp create mode 100644 ingen/AtomWriter.hpp create mode 100644 ingen/Builder.hpp create mode 100644 ingen/ClashAvoider.hpp create mode 100644 ingen/Configuration.hpp create mode 100644 ingen/Forge.hpp create mode 100644 ingen/LV2Features.hpp create mode 100644 ingen/Module.hpp create mode 100644 ingen/Store.hpp create mode 100644 ingen/URIMap.hpp create mode 100644 ingen/URIs.hpp create mode 100644 ingen/World.hpp create mode 100644 ingen/runtime_paths.hpp delete mode 100644 ingen/shared/AtomReader.hpp delete mode 100644 ingen/shared/AtomSink.hpp delete mode 100644 ingen/shared/AtomWriter.hpp delete mode 100644 ingen/shared/Builder.hpp delete mode 100644 ingen/shared/ClashAvoider.hpp delete mode 100644 ingen/shared/Configuration.hpp delete mode 100644 ingen/shared/Forge.hpp delete mode 100644 ingen/shared/LV2Features.hpp delete mode 100644 ingen/shared/Module.hpp delete mode 100644 ingen/shared/Store.hpp delete mode 100644 ingen/shared/URIMap.hpp delete mode 100644 ingen/shared/URIs.hpp delete mode 100644 ingen/shared/World.hpp delete mode 100644 ingen/shared/runtime_paths.hpp (limited to 'ingen') diff --git a/ingen/AtomReader.hpp b/ingen/AtomReader.hpp new file mode 100644 index 00000000..f14ebefd --- /dev/null +++ b/ingen/AtomReader.hpp @@ -0,0 +1,60 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_ATOMREADER_HPP +#define INGEN_ATOMREADER_HPP + +#include "ingen/Interface.hpp" +#include "ingen/AtomSink.hpp" +#include "ingen/URIs.hpp" +#include "serd/serd.h" + +namespace Ingen { + +class AtomSink; +class Forge; +class URIMap; + +/** An AtomSink that calls methods on an Interface. + * @ingroup IngenShared + */ +class AtomReader : public AtomSink +{ +public: + AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface); + ~AtomReader() {} + + static bool is_message(URIs& uris, const LV2_Atom* msg); + + bool write(const LV2_Atom* msg); + +private: + void get_atom(const LV2_Atom* in, Raul::Atom& out); + const char* atom_to_uri(const LV2_Atom* atom); + + void get_props(const LV2_Atom_Object* obj, + Ingen::Resource::Properties& props); + + URIMap& _map; + URIs& _uris; + Forge& _forge; + Interface& _iface; +}; + +} // namespace Ingen + +#endif // INGEN_ATOMREADER_HPP + diff --git a/ingen/AtomSink.hpp b/ingen/AtomSink.hpp new file mode 100644 index 00000000..ae8fd07a --- /dev/null +++ b/ingen/AtomSink.hpp @@ -0,0 +1,40 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_ATOMSINK_HPP +#define INGEN_ATOMSINK_HPP + +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" + +namespace Ingen { + +/** A sink for LV2 Atoms. + * @ingroup IngenShared + */ +class AtomSink { +public: + virtual ~AtomSink() {} + + /** Write an Atom to the sink. + * @return True on success. + */ + virtual bool write(const LV2_Atom* msg) = 0; +}; + +} // namespace Ingen + +#endif // INGEN_ATOMSINK_HPP + diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp new file mode 100644 index 00000000..31a3c099 --- /dev/null +++ b/ingen/AtomWriter.hpp @@ -0,0 +1,98 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_ATOMWRITER_HPP +#define INGEN_ATOMWRITER_HPP + +#include + +#include "ingen/Interface.hpp" +#include "ingen/URIs.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/forge.h" +#include "serd/serd.h" + +namespace Ingen { + +class AtomSink; +class URIMap; + +/** An Interface that writes LV2 atoms to an AtomSink. */ +class AtomWriter : public Interface +{ +public: + AtomWriter(URIMap& map, URIs& uris, AtomSink& sink); + ~AtomWriter() {} + + Raul::URI uri() const { return "http://drobilla.net/ns/ingen#AtomWriter"; } + + void bundle_begin(); + + void bundle_end(); + + void put(const Raul::URI& uri, + const Resource::Properties& properties, + Resource::Graph ctx = Resource::DEFAULT); + + void delta(const Raul::URI& uri, + const Resource::Properties& remove, + const Resource::Properties& add); + + void move(const Raul::Path& old_path, + const Raul::Path& new_path); + + void del(const Raul::URI& uri); + + void connect(const Raul::Path& tail, + const Raul::Path& head); + + void disconnect(const Raul::Path& tail, + const Raul::Path& head); + + void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + void set_property(const Raul::URI& subject, + const Raul::URI& predicate, + const Raul::Atom& value); + + void set_response_id(int32_t id); + + void get(const Raul::URI& uri); + + void response(int32_t id, Status status, const std::string& subject); + + void error(const std::string& msg); + +private: + void forge_uri(const Raul::URI& uri); + void forge_properties(const Resource::Properties& properties); + void forge_edge(const Raul::URI& tail, const Raul::URI& head); + + void finish_msg(); + int32_t next_id(); + + URIMap& _map; + URIs& _uris; + AtomSink& _sink; + SerdChunk _out; + LV2_Atom_Forge _forge; + int32_t _id; +}; + +} // namespace Ingen + +#endif // INGEN_ATOMWRITER_HPP + diff --git a/ingen/Builder.hpp b/ingen/Builder.hpp new file mode 100644 index 00000000..168ab841 --- /dev/null +++ b/ingen/Builder.hpp @@ -0,0 +1,49 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_BUILDER_HPP +#define INGEN_BUILDER_HPP + +#include "raul/SharedPtr.hpp" + +namespace Ingen { + +class GraphObject; +class Interface; +class URIs; + +/** Wrapper for Interface to create existing objects/models. + * + * @ingroup IngenShared + */ +class Builder +{ +public: + Builder(URIs& uris, Interface& interface); + virtual ~Builder() {} + + void build(SharedPtr object); + void connect(SharedPtr object); + +private: + URIs& _uris; + Interface& _interface; +}; + +} // namespace Ingen + +#endif // INGEN_BUILDER_HPP + diff --git a/ingen/ClashAvoider.hpp b/ingen/ClashAvoider.hpp new file mode 100644 index 00000000..66b860c2 --- /dev/null +++ b/ingen/ClashAvoider.hpp @@ -0,0 +1,108 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_CLASHAVOIDER_HPP +#define INGEN_CLASHAVOIDER_HPP + +#include + +#include +#include + +#include "ingen/Interface.hpp" + +namespace Raul { +class Atom; +class Path; +} + +namespace Ingen { + +class Store; + +/** A wrapper for an Interface that creates objects but possibly maps + * symbol names to avoid clashes with the existing objects in a store. + * + * @ingroup IngenShared + */ +class ClashAvoider : public Interface +{ +public: + 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(Interface& target) { _target = target; } + + // Bundles + void bundle_begin() { _target.bundle_begin(); } + void bundle_end() { _target.bundle_end(); } + + // Object commands + + virtual void put(const Raul::URI& path, + const Resource::Properties& properties, + Resource::Graph ctx=Resource::DEFAULT); + + virtual void delta(const Raul::URI& path, + const Resource::Properties& remove, + const Resource::Properties& add); + + virtual void move(const Raul::Path& old_path, + const Raul::Path& new_path); + + virtual void connect(const Raul::Path& tail, + const Raul::Path& head); + + virtual void disconnect(const Raul::Path& tail, + const Raul::Path& head); + + virtual void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + virtual void set_property(const Raul::URI& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); + + virtual void del(const Raul::URI& uri); + + virtual void set_response_id(int32_t id) {} + virtual void get(const Raul::URI& uri) {} + virtual void response(int32_t id, Status status, const std::string& subject) {} + 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; + Interface& _target; + + Store* _also_avoid; + bool exists(const Raul::Path& path) const; + + typedef std::map Offsets; + Offsets _offsets; + + typedef std::map SymbolMap; + SymbolMap _symbol_map; +}; + +} // namespace Ingen + +#endif // INGEN_CLASHAVOIDER_HPP + diff --git a/ingen/Configuration.hpp b/ingen/Configuration.hpp new file mode 100644 index 00000000..f45f3869 --- /dev/null +++ b/ingen/Configuration.hpp @@ -0,0 +1,35 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_CONFIGURATION_HPP +#define INGEN_CONFIGURATION_HPP + +#include "raul/Configuration.hpp" + +namespace Ingen { + +/** Ingen configuration (command line options). + * @ingroup IngenShared + */ +class Configuration : public Raul::Configuration { +public: + Configuration(); +}; + +} // namespace Ingen + +#endif // INGEN_CONFIGURATION_HPP + diff --git a/ingen/Forge.hpp b/ingen/Forge.hpp new file mode 100644 index 00000000..8e7df926 --- /dev/null +++ b/ingen/Forge.hpp @@ -0,0 +1,40 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_FORGE_HPP +#define INGEN_FORGE_HPP + +#include + +#include "raul/Atom.hpp" + +namespace Ingen { + +class URIMap; + +/** Forge for Raul Atoms. + * @ingroup IngenShared + */ +class Forge : public Raul::Forge { +public: + explicit Forge(URIMap& map); + + std::string str(const Raul::Atom& atom); +}; + +} // namespace Ingen + +#endif // INGEN_FORGE_HPP diff --git a/ingen/GraphObject.hpp b/ingen/GraphObject.hpp index a8bee0b0..80da116e 100644 --- a/ingen/GraphObject.hpp +++ b/ingen/GraphObject.hpp @@ -17,10 +17,9 @@ #ifndef INGEN_GRAPHOBJECT_HPP #define INGEN_GRAPHOBJECT_HPP -#include "ingen/Resource.hpp" -#include "raul/Deletable.hpp" #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" +#include "ingen/Resource.hpp" namespace Raul { class Atom; @@ -40,8 +39,6 @@ class Plugin; class GraphObject : public Resource { public: - virtual void set_path(const Raul::Path& path) = 0; - enum GraphType { PATCH, NODE, @@ -67,7 +64,7 @@ public: virtual GraphObject* graph_parent() const = 0; protected: - GraphObject(Shared::URIs& uris, const Raul::Path& path) + GraphObject(URIs& uris, const Raul::Path& path) : Resource(uris, path) {} diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp new file mode 100644 index 00000000..b7b1395c --- /dev/null +++ b/ingen/LV2Features.hpp @@ -0,0 +1,74 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_LV2FEATURES_HPP +#define INGEN_LV2FEATURES_HPP + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#include "raul/SharedPtr.hpp" +#include "raul/Noncopyable.hpp" + +namespace Ingen { + +class GraphObject; +class World; + +/** Features for use by LV2 plugins. + * @ingroup IngenShared + */ +class LV2Features { +public: + LV2Features(); + + class Feature { + public: + virtual ~Feature() {} + + virtual SharedPtr feature(World* world, + GraphObject* node) = 0; + }; + + class FeatureArray : public Raul::Noncopyable { + public: + typedef std::vector< SharedPtr > FeatureVector; + + explicit FeatureArray(FeatureVector& features); + + ~FeatureArray(); + + LV2_Feature** array() { return _array; } + + private: + FeatureVector _features; + LV2_Feature** _array; + }; + + void add_feature(SharedPtr feature); + + SharedPtr lv2_features(World* world, + GraphObject* node) const; + +private: + typedef std::vector< SharedPtr > Features; + Features _features; +}; + +} // namespace Ingen + +#endif // INGEN_LV2FEATURES_HPP diff --git a/ingen/Module.hpp b/ingen/Module.hpp new file mode 100644 index 00000000..3decc185 --- /dev/null +++ b/ingen/Module.hpp @@ -0,0 +1,53 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_MODULE_HPP +#define INGEN_MODULE_HPP + +#include + +namespace Ingen { + +class World; + +/** A dynamically loaded Ingen module. + * + * All components of Ingen reside in one of these. + * @ingroup IngenShared + */ +struct Module { + Module() : library(NULL) {} + virtual ~Module() {} + + virtual void load(Ingen::World* world) = 0; + virtual void run(Ingen::World* world) {} + + /** Library implementing this module. + * + * This is managed by the World and not this class, since closing the library + * in this destructor could possibly reference code from the library + * afterwards and cause a segfault on exit. + */ + Glib::Module* library; + +private: + Module(const Module& noncopyable); + Module& operator=(const Module& noncopyable); +}; + +} // namespace Ingen + +#endif // INGEN_MODULE_HPP diff --git a/ingen/Plugin.hpp b/ingen/Plugin.hpp index 30c70963..544a2aad 100644 --- a/ingen/Plugin.hpp +++ b/ingen/Plugin.hpp @@ -31,7 +31,7 @@ namespace Ingen { class Plugin : public Resource { public: - Plugin(Shared::URIs& uris, const Raul::URI& uri) + Plugin(URIs& uris, const Raul::URI& uri) : Resource(uris, uri) {} diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp index 4aed2f6d..1e94e1e8 100644 --- a/ingen/Resource.hpp +++ b/ingen/Resource.hpp @@ -20,13 +20,12 @@ #include #include +#include "ingen/URIs.hpp" #include "raul/Atom.hpp" #include "raul/Deletable.hpp" #include "raul/URI.hpp" #include "raul/log.hpp" -#include "ingen/shared/URIs.hpp" - #define NS_INGEN "http://drobilla.net/ns/ingen#" namespace Ingen { @@ -37,7 +36,7 @@ namespace Ingen { class Resource : public Raul::Deletable { public: - Resource(Shared::URIs& uris, const Raul::URI& uri) + Resource(URIs& uris, const Raul::URI& uri) : _uris(uris) , _uri(uri) {} @@ -94,7 +93,7 @@ public: virtual ~Resource() {} - Shared::URIs& uris() const { return _uris; } + URIs& uris() const { return _uris; } virtual void set_uri(const Raul::URI& uri) { _uri = uri; } virtual const Raul::URI& uri() const { return _uri; } @@ -137,17 +136,17 @@ public: * If some coherent ingen type is found, true is returned and the appropriate * output parameter set to true. Otherwise false is returned. */ - static bool type(const Shared::URIs& uris, - const Properties& properties, - bool& patch, - bool& node, - bool& port, - bool& is_output); + static bool type(const URIs& uris, + const Properties& properties, + bool& patch, + bool& node, + bool& port, + bool& is_output); protected: const Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const; - Shared::URIs& _uris; + URIs& _uris; private: Raul::URI _uri; diff --git a/ingen/Store.hpp b/ingen/Store.hpp new file mode 100644 index 00000000..2f5afa1e --- /dev/null +++ b/ingen/Store.hpp @@ -0,0 +1,60 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_STORE_HPP +#define INGEN_STORE_HPP + +#include + +#undef nil +#include + +#include "raul/PathTable.hpp" + +#include "ingen/GraphObject.hpp" + +namespace Ingen { + +/** Store of objects in the patch hierarchy. + * @ingroup IngenShared + */ +class Store : public Raul::PathTable< SharedPtr > { +public: + virtual ~Store() {} + + virtual void add(GraphObject* o); + + typedef Raul::Table< Raul::Path, SharedPtr > Objects; + + const_iterator children_begin(SharedPtr o) const; + const_iterator children_end(SharedPtr o) const; + + SharedPtr find_child(SharedPtr parent, + const std::string& child_name) const; + + unsigned child_name_offset(const Raul::Path& parent, + const Raul::Symbol& symbol, + bool allow_zero=true); + + Glib::RWLock& lock() { return _lock; } + +private: + Glib::RWLock _lock; +}; + +} // namespace Ingen + +#endif // INGEN_STORE_HPP diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp new file mode 100644 index 00000000..c46f4197 --- /dev/null +++ b/ingen/URIMap.hpp @@ -0,0 +1,80 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_URIMAP_HPP +#define INGEN_URIMAP_HPP + +#include +#include + +#include "ingen/LV2Features.hpp" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "raul/URI.hpp" +#include "raul/Noncopyable.hpp" + +namespace Ingen { + +/** URI to integer map and implementation of LV2 URID extension. + * @ingroup IngenShared + */ +class URIMap : public Raul::Noncopyable { +public: + URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap); + virtual ~URIMap() {} + + uint32_t map_uri(const char* uri); + const char* unmap_uri(uint32_t urid) const; + + class Feature : public LV2Features::Feature { + public: + Feature(const char* URI, void* data) { + _feature.URI = URI; + _feature.data = data; + } + + SharedPtr feature(World*, GraphObject*) { + return SharedPtr(&_feature, NullDeleter); + } + + private: + LV2_Feature _feature; + }; + + struct URIDMapFeature : public Feature { + URIDMapFeature(URIMap* map, LV2_URID_Map* urid_map); + LV2_URID map(const char* uri); + static LV2_URID default_map(LV2_URID_Map_Handle h, const char* uri); + LV2_URID_Map urid_map; + }; + + struct URIDUnmapFeature : public Feature { + URIDUnmapFeature(URIMap* map, LV2_URID_Unmap* urid_unmap); + const char* unmap(const LV2_URID urid); + static const char* default_unmap(LV2_URID_Map_Handle h, LV2_URID uri); + LV2_URID_Unmap urid_unmap; + }; + + SharedPtr urid_map_feature() { return _urid_map_feature; } + SharedPtr urid_unmap_feature() { return _urid_unmap_feature; } + +private: + SharedPtr _urid_map_feature; + SharedPtr _urid_unmap_feature; +}; + +} // namespace Ingen + +#endif // INGEN_URIMAP_HPP diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp new file mode 100644 index 00000000..ace1652b --- /dev/null +++ b/ingen/URIs.hpp @@ -0,0 +1,143 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_URIS_HPP +#define INGEN_URIS_HPP + +#include "ingen/Forge.hpp" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "raul/Atom.hpp" +#include "raul/Noncopyable.hpp" +#include "raul/URI.hpp" + +namespace Raul { + class Forge; +} + +namespace Ingen { + +class URIMap; + +/** Frequently used interned URIs. + * + * This class initially maps all the special URIs used throughout the code + * using the URIMap so they can be used quickly with the performance of + * integers, but still be dynamic. + * + * @ingroup ingen + */ +class URIs : public Raul::Noncopyable { +public: + URIs(Ingen::Forge& forge, URIMap* map); + + struct Quark : public Raul::URI { + Quark(Ingen::Forge& forge, URIMap* map, const char* str); + operator LV2_URID() const { return id; } + operator Raul::Atom() const { return atom; } + uint32_t id; + Raul::Atom atom; + }; + + Ingen::Forge& forge; + + const Quark atom_AtomPort; + const Quark atom_Blank; + const Quark atom_Bool; + const Quark atom_Chunk; + const Quark atom_Float; + const Quark atom_Int; + const Quark atom_Resource; + const Quark atom_Sequence; + const Quark atom_Sound; + const Quark atom_String; + const Quark atom_URI; + const Quark atom_URID; + const Quark atom_Vector; + const Quark atom_bufferType; + const Quark atom_eventTransfer; + const Quark atom_supports; + const Quark doap_name; + const Quark ingen_Edge; + const Quark ingen_Internal; + const Quark ingen_Node; + const Quark ingen_Patch; + const Quark ingen_activity; + const Quark ingen_broadcast; + const Quark ingen_canvasX; + const Quark ingen_canvasY; + const Quark ingen_controlBinding; + const Quark ingen_document; + const Quark ingen_enabled; + const Quark ingen_engine; + const Quark ingen_head; + const Quark ingen_incidentTo; + const Quark ingen_nil; + const Quark ingen_node; + const Quark ingen_polyphonic; + const Quark ingen_polyphony; + const Quark ingen_prototype; + const Quark ingen_sampleRate; + const Quark ingen_status; + const Quark ingen_tail; + const Quark ingen_uiEmbedded; + const Quark ingen_value; + const Quark lv2_AudioPort; + const Quark lv2_CVPort; + const Quark lv2_ControlPort; + const Quark lv2_InputPort; + const Quark lv2_OutputPort; + const Quark lv2_Plugin; + const Quark lv2_connectionOptional; + const Quark lv2_default; + const Quark lv2_index; + const Quark lv2_integer; + const Quark lv2_maximum; + const Quark lv2_minimum; + const Quark lv2_name; + const Quark lv2_portProperty; + const Quark lv2_sampleRate; + const Quark lv2_scalePoint; + const Quark lv2_symbol; + const Quark lv2_toggled; + const Quark midi_Bender; + const Quark midi_ChannelPressure; + const Quark midi_Controller; + const Quark midi_MidiEvent; + const Quark midi_NoteOn; + const Quark midi_controllerNumber; + const Quark midi_noteNumber; + const Quark patch_Delete; + const Quark patch_Get; + const Quark patch_Move; + const Quark patch_Patch; + const Quark patch_Put; + const Quark patch_Response; + const Quark patch_Set; + const Quark patch_add; + const Quark patch_body; + const Quark patch_destination; + const Quark patch_remove; + const Quark patch_request; + const Quark patch_subject; + const Quark pprops_logarithmic; + const Quark rdf_type; + const Quark rdfs_seeAlso; + const Quark wildcard; +}; + +} // namespace Ingen + +#endif // INGEN_LV2URIMAP_HPP diff --git a/ingen/World.hpp b/ingen/World.hpp new file mode 100644 index 00000000..5d2bddda --- /dev/null +++ b/ingen/World.hpp @@ -0,0 +1,151 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_WORLD_HPP +#define INGEN_WORLD_HPP + +#include + +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "raul/Noncopyable.hpp" +#include "raul/SharedPtr.hpp" + +typedef struct LilvWorldImpl LilvWorld; + +namespace Sord { class World; } + +namespace Ingen { + +class EngineBase; +class Interface; + +namespace Serialisation { +class Parser; +class Serialiser; +} + +class Configuration; +class Forge; +class LV2Features; +class Store; +class URIMap; +class URIs; + +/** The "world" all Ingen modules share. + * + * This is the root to which all components of Ingen are connected. It + * contains all necessary shared data (including the world for libraries like + * Sord and Lilv) and holds references to components. + * + * Most functionality in Ingen is implemented in dynamically loaded modules, + * which are loaded using this interface. When loaded, those modules add + * facilities to the World which can then be used throughout the code. For + * example loading the "ingen_serialisation" module will set World::serialiser + * and World::parser to valid objects. + * + * The world is used in any process which uses the Ingen as a library, both + * client and server (e.g. the world may not actually contain an Engine, since + * it maybe running in another process or even on a different machine). + * + * @ingroup IngenShared + */ +class World : public Raul::Noncopyable { +public: + /** Construct a new Ingen world. + * @param argc Argument count (as in C main()) + * @param argv Argument vector (as in C main()) + * @param map LV2 URID map implementation, or NULL to use internal. + * @param unmap LV2 URID unmap implementation, or NULL to use internal. + */ + World(int& argc, + char**& argv, + LV2_URID_Map* map, + LV2_URID_Unmap* unmap); + + virtual ~World(); + + /** Load an Ingen module by name (e.g. "server", "gui", etc.) + * @return True on success. + */ + virtual bool load_module(const char* name); + + /** Run a loaded module (modules that "run" only, e.g. gui). + * @return True on success. + */ + virtual bool run_module(const char* name); + + /** Unload all loaded Ingen modules. */ + virtual void unload_modules(); + + /** A function to create a new remote Interface. */ + typedef SharedPtr (*InterfaceFactory)( + World* world, + const std::string& engine_url, + SharedPtr respondee); + + /** Register an InterfaceFactory (for module implementations). */ + virtual void add_interface_factory(const std::string& scheme, + InterfaceFactory factory); + + /** Return a new Interface to control a server. + * @param engine_url The URL of the possibly remote server to control. + * @param respondee The Interface that will receive responses to commands + * and broadcasts, if applicable. + */ + virtual SharedPtr new_interface( + const std::string& engine_url, + SharedPtr respondee); + + /** Run a script. */ + virtual bool run(const std::string& mime_type, + const std::string& filename); + + virtual void set_engine(SharedPtr e); + virtual void set_interface(SharedPtr e); + virtual void set_parser(SharedPtr p); + virtual void set_serialiser(SharedPtr s); + virtual void set_store(SharedPtr s); + + virtual SharedPtr engine(); + virtual SharedPtr interface(); + virtual SharedPtr parser(); + virtual SharedPtr serialiser(); + virtual SharedPtr store(); + + virtual int& argc(); + virtual char**& argv(); + virtual Configuration& conf(); + + virtual Sord::World* rdf_world(); + virtual LilvWorld* lilv_world(); + + virtual LV2Features& lv2_features(); + virtual Ingen::Forge& forge(); + virtual URIMap& uri_map(); + virtual URIs& uris(); + + virtual void set_jack_uuid(const std::string& uuid); + virtual std::string jack_uuid(); + +private: + class Impl; + + Impl* _impl; +}; + +} // namespace Ingen + +#endif // INGEN_WORLD_HPP diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index b5a51a83..720164d0 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -23,7 +23,7 @@ #include "ingen/Interface.hpp" #include "ingen/client/signal.hpp" -#include "ingen/shared/Store.hpp" +#include "ingen/Store.hpp" #include "raul/Path.hpp" #include "raul/PathTable.hpp" #include "raul/SharedPtr.hpp" @@ -33,7 +33,7 @@ namespace Raul { class Atom; } namespace Ingen { -namespace Shared { class URIs; } +class URIs; class GraphObject; @@ -50,12 +50,12 @@ class SigClientInterface; * * @ingroup IngenClient */ -class ClientStore : public Shared::Store +class ClientStore : public Store , public Interface , public INGEN_TRACKABLE { public: ClientStore( - Shared::URIs& uris, + URIs& uris, SharedPtr engine = SharedPtr(), SharedPtr emitter = SharedPtr()); @@ -72,7 +72,7 @@ public: SharedPtr plugins() { return _plugins; } void set_plugins(SharedPtr p) { _plugins = p; } - Shared::URIs& uris() { return _uris; } + URIs& uris() { return _uris; } void put(const Raul::URI& uri, const Resource::Properties& properties, @@ -130,7 +130,7 @@ private: bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - Shared::URIs& _uris; + URIs& _uris; SharedPtr _engine; SharedPtr _emitter; diff --git a/ingen/client/NodeModel.hpp b/ingen/client/NodeModel.hpp index 07810eed..93a512f0 100644 --- a/ingen/client/NodeModel.hpp +++ b/ingen/client/NodeModel.hpp @@ -31,7 +31,7 @@ namespace Raul { class Path; } namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Client { @@ -79,10 +79,10 @@ public: protected: friend class ClientStore; - NodeModel(Shared::URIs& uris, - const Raul::URI& plugin_uri, - const Raul::Path& path); - NodeModel(Shared::URIs& uris, + NodeModel(URIs& uris, + const Raul::URI& plugin_uri, + const Raul::Path& path); + NodeModel(URIs& uris, SharedPtr plugin, const Raul::Path& path); explicit NodeModel(const Raul::Path& path); diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp index 2ff8f898..69ad3e22 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -35,7 +35,7 @@ namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Client { @@ -80,7 +80,7 @@ public: protected: friend class ClientStore; - ObjectModel(Shared::URIs& uris, const Raul::Path& path); + ObjectModel(URIs& uris, const Raul::Path& path); ObjectModel(const ObjectModel& copy); virtual void set_path(const Raul::Path& p); diff --git a/ingen/client/PatchModel.hpp b/ingen/client/PatchModel.hpp index 1ad55c78..64ef3d18 100644 --- a/ingen/client/PatchModel.hpp +++ b/ingen/client/PatchModel.hpp @@ -53,7 +53,7 @@ public: private: friend class ClientStore; - PatchModel(Shared::URIs& uris, const Raul::Path& patch_path) + PatchModel(URIs& uris, const Raul::Path& patch_path) : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path) { } diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index 0449cb51..13375c95 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -21,20 +21,19 @@ #include #include +#include "ingen/Plugin.hpp" +#include "ingen/Resource.hpp" +#include "ingen/Resource.hpp" +#include "ingen/World.hpp" +#include "ingen/client/signal.hpp" #include "lilv/lilv.h" #include "raul/SharedPtr.hpp" #include "raul/Symbol.hpp" #include "sord/sordmm.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Plugin.hpp" -#include "ingen/Resource.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/shared/World.hpp" - namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Client { @@ -49,7 +48,7 @@ class PluginUI; class PluginModel : public Ingen::Plugin { public: - PluginModel(Shared::URIs& uris, + PluginModel(URIs& uris, const Raul::URI& uri, const Raul::URI& type_uri, const Ingen::Resource::Properties& properties); @@ -75,8 +74,8 @@ public: bool has_ui() const; - SharedPtr ui(Ingen::Shared::World* world, - SharedPtr node) const; + SharedPtr ui(Ingen::World* world, + SharedPtr node) const; const std::string& icon_path() const; static std::string get_lv2_icon_path(const LilvPlugin* plugin); diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 25422fe8..1c45bd56 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -23,13 +23,12 @@ #include "suil/suil.h" -#include "ingen/shared/LV2Features.hpp" +#include "ingen/LV2Features.hpp" namespace Ingen { class Interface; - -namespace Shared { class World; } +class World; namespace Client { @@ -43,7 +42,7 @@ class PluginUI { public: ~PluginUI(); - static SharedPtr create(Ingen::Shared::World* world, + static SharedPtr create(Ingen::World* world, SharedPtr node, const LilvPlugin* plugin); @@ -56,22 +55,22 @@ public: bool is_resizable() const; - Ingen::Shared::World* world() const { return _world; } - SharedPtr node() const { return _node; } + Ingen::World* world() const { return _world; } + SharedPtr node() const { return _node; } private: - PluginUI(Ingen::Shared::World* world, + PluginUI(Ingen::World* world, SharedPtr node, const LilvNode* ui_node); - Ingen::Shared::World* _world; + Ingen::World* _world; SharedPtr _node; SuilInstance* _instance; LilvNode* _ui_node; static SuilHost* ui_host; - SharedPtr _features; + SharedPtr _features; }; } // namespace Client diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 99cd85be..1a5a31be 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -89,7 +89,7 @@ public: private: friend class ClientStore; - PortModel(Shared::URIs& uris, + PortModel(URIs& uris, const Raul::Path& path, uint32_t index, Direction dir) diff --git a/ingen/runtime_paths.hpp b/ingen/runtime_paths.hpp new file mode 100644 index 00000000..3d36e55e --- /dev/null +++ b/ingen/runtime_paths.hpp @@ -0,0 +1,33 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 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_RUNTIME_PATHS_HPP +#define INGEN_RUNTIME_PATHS_HPP + +#include + +namespace Ingen { + +void set_bundle_path(const char* path); +void set_bundle_path_from_code(void* function); + +std::string bundle_file_path(const std::string& name); +std::string data_file_path(const std::string& name); +std::string module_path(const std::string& name, std::string dir=""); + +} // namespace Ingen + +#endif // INGEN_RUNTIME_PATHS_HPP diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index 0240dc9d..666d9acb 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -33,8 +33,7 @@ namespace Ingen { class Interface; - -namespace Shared { class World; } +class World; namespace Serialisation { @@ -52,7 +51,7 @@ public: typedef GraphObject::Properties Properties; virtual bool parse_file( - Shared::World* world, + World* world, Interface* target, Glib::ustring path, boost::optional parent = boost::optional(), @@ -60,7 +59,7 @@ public: boost::optional data = boost::optional()); virtual bool parse_string( - Shared::World* world, + World* world, Interface* target, const Glib::ustring& str, const Glib::ustring& base_uri, diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index 2dbc99b7..b4c0dfd3 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -29,14 +29,10 @@ namespace Ingen { -class Plugin; -class GraphObject; class Edge; - -namespace Shared { -class World; +class GraphObject; class Store; -} +class World; namespace Serialisation { @@ -48,7 +44,7 @@ namespace Serialisation { class Serialiser { public: - explicit Serialiser(Shared::World& world); + explicit Serialiser(World& world); virtual ~Serialiser(); typedef GraphObject::Properties Properties; diff --git a/ingen/shared/AtomReader.hpp b/ingen/shared/AtomReader.hpp deleted file mode 100644 index 38c89a2b..00000000 --- a/ingen/shared/AtomReader.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_ATOMREADER_HPP -#define INGEN_SHARED_ATOMREADER_HPP - -#include "ingen/Interface.hpp" -#include "ingen/shared/AtomSink.hpp" -#include "ingen/shared/URIs.hpp" -#include "serd/serd.h" - -namespace Ingen { -namespace Shared { - -class AtomSink; -class Forge; -class URIMap; - -/** An AtomSink that calls methods on an Interface. - * @ingroup IngenShared - */ -class AtomReader : public AtomSink -{ -public: - AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface); - ~AtomReader() {} - - static bool is_message(URIs& uris, const LV2_Atom* msg); - - bool write(const LV2_Atom* msg); - -private: - void get_atom(const LV2_Atom* in, Raul::Atom& out); - const char* atom_to_uri(const LV2_Atom* atom); - - void get_props(const LV2_Atom_Object* obj, - Ingen::Resource::Properties& props); - - URIMap& _map; - URIs& _uris; - Forge& _forge; - Interface& _iface; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_ATOMREADER_HPP - diff --git a/ingen/shared/AtomSink.hpp b/ingen/shared/AtomSink.hpp deleted file mode 100644 index f25e6548..00000000 --- a/ingen/shared/AtomSink.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_ATOMSINK_HPP -#define INGEN_SHARED_ATOMSINK_HPP - -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" - -namespace Ingen { -namespace Shared { - -/** A sink for LV2 Atoms. - * @ingroup IngenShared - */ -class AtomSink { -public: - virtual ~AtomSink() {} - - /** Write an Atom to the sink. - * @return True on success. - */ - virtual bool write(const LV2_Atom* msg) = 0; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_ATOMSINK_HPP - diff --git a/ingen/shared/AtomWriter.hpp b/ingen/shared/AtomWriter.hpp deleted file mode 100644 index 7087bfd6..00000000 --- a/ingen/shared/AtomWriter.hpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_ATOMWRITER_HPP -#define INGEN_SHARED_ATOMWRITER_HPP - -#include - -#include "ingen/Interface.hpp" -#include "ingen/shared/URIs.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/forge.h" -#include "serd/serd.h" - -namespace Ingen { -namespace Shared { - -class AtomSink; -class URIMap; - -/** An Interface that writes LV2 atoms to an AtomSink. */ -class AtomWriter : public Interface -{ -public: - AtomWriter(URIMap& map, URIs& uris, AtomSink& sink); - ~AtomWriter() {} - - Raul::URI uri() const { return "http://drobilla.net/ns/ingen#AtomWriter"; } - - void bundle_begin(); - - void bundle_end(); - - void put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx = Resource::DEFAULT); - - void delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add); - - void move(const Raul::Path& old_path, - const Raul::Path& new_path); - - void del(const Raul::URI& uri); - - void connect(const Raul::Path& tail, - const Raul::Path& head); - - void disconnect(const Raul::Path& tail, - const Raul::Path& head); - - void disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path); - - void set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Raul::Atom& value); - - void set_response_id(int32_t id); - - void get(const Raul::URI& uri); - - void response(int32_t id, Status status, const std::string& subject); - - void error(const std::string& msg); - -private: - void forge_uri(const Raul::URI& uri); - void forge_properties(const Resource::Properties& properties); - void forge_edge(const Raul::URI& tail, const Raul::URI& head); - - void finish_msg(); - int32_t next_id(); - - URIMap& _map; - URIs& _uris; - AtomSink& _sink; - SerdChunk _out; - LV2_Atom_Forge _forge; - int32_t _id; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_ATOMWRITER_HPP - diff --git a/ingen/shared/Builder.hpp b/ingen/shared/Builder.hpp deleted file mode 100644 index 1c57c871..00000000 --- a/ingen/shared/Builder.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_BUILDER_HPP -#define INGEN_SHARED_BUILDER_HPP - -namespace Ingen { - -class Interface; -class GraphObject; - -namespace Shared { - -class URIs; - -/** Wrapper for Interface to create existing objects/models. - * - * @ingroup IngenShared - */ -class Builder -{ -public: - Builder(Shared::URIs& uris, Interface& interface); - virtual ~Builder() {} - - void build(SharedPtr object); - void connect(SharedPtr object); - -private: - Shared::URIs& _uris; - Interface& _interface; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_BUILDER_HPP - diff --git a/ingen/shared/ClashAvoider.hpp b/ingen/shared/ClashAvoider.hpp deleted file mode 100644 index e3f4faaf..00000000 --- a/ingen/shared/ClashAvoider.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_CLASHAVOIDER_HPP -#define INGEN_SHARED_CLASHAVOIDER_HPP - -#include - -#include -#include - -#include "ingen/Interface.hpp" - -namespace Raul { -class Atom; -class Path; -} - -namespace Ingen { -namespace Shared { - -class Store; - -/** A wrapper for an Interface that creates objects but possibly maps - * symbol names to avoid clashes with the existing objects in a store. - * - * @ingroup IngenShared - */ -class ClashAvoider : public Interface -{ -public: - 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(Interface& target) { _target = target; } - - // Bundles - void bundle_begin() { _target.bundle_begin(); } - void bundle_end() { _target.bundle_end(); } - - // Object commands - - virtual void put(const Raul::URI& path, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT); - - virtual void delta(const Raul::URI& path, - const Resource::Properties& remove, - const Resource::Properties& add); - - virtual void move(const Raul::Path& old_path, - const Raul::Path& new_path); - - virtual void connect(const Raul::Path& tail, - const Raul::Path& head); - - virtual void disconnect(const Raul::Path& tail, - const Raul::Path& head); - - virtual void disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path); - - virtual void set_property(const Raul::URI& subject_path, - const Raul::URI& predicate, - const Raul::Atom& value); - - virtual void del(const Raul::URI& uri); - - virtual void set_response_id(int32_t id) {} - virtual void get(const Raul::URI& uri) {} - virtual void response(int32_t id, Status status, const std::string& subject) {} - 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; - Interface& _target; - - Store* _also_avoid; - bool exists(const Raul::Path& path) const; - - typedef std::map Offsets; - Offsets _offsets; - - typedef std::map SymbolMap; - SymbolMap _symbol_map; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_CLASHAVOIDER_HPP - diff --git a/ingen/shared/Configuration.hpp b/ingen/shared/Configuration.hpp deleted file mode 100644 index 211184d0..00000000 --- a/ingen/shared/Configuration.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_CONFIGURATION_HPP -#define INGEN_SHARED_CONFIGURATION_HPP - -#include "raul/Configuration.hpp" - -namespace Ingen { -namespace Shared { - -/** Ingen configuration (command line options). - * @ingroup IngenShared - */ -class Configuration : public Raul::Configuration { -public: - Configuration(); -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_CONFIGURATION_HPP - diff --git a/ingen/shared/Forge.hpp b/ingen/shared/Forge.hpp deleted file mode 100644 index 1d820bc0..00000000 --- a/ingen/shared/Forge.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_FORGE_HPP -#define INGEN_SHARED_FORGE_HPP - -#include - -#include "raul/Atom.hpp" - -namespace Ingen { -namespace Shared { - -class URIMap; - -/** Forge for Raul Atoms. - * @ingroup IngenShared - */ -class Forge : public Raul::Forge { -public: - explicit Forge(Shared::URIMap& map); - - std::string str(const Raul::Atom& atom); -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_FORGE_HPP diff --git a/ingen/shared/LV2Features.hpp b/ingen/shared/LV2Features.hpp deleted file mode 100644 index 822df818..00000000 --- a/ingen/shared/LV2Features.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_LV2FEATURES_HPP -#define INGEN_SHARED_LV2FEATURES_HPP - -#include - -#include "lv2/lv2plug.in/ns/lv2core/lv2.h" - -#include "raul/SharedPtr.hpp" -#include "raul/Noncopyable.hpp" - -namespace Ingen { - -class GraphObject; - -namespace Shared { - -class World; - -/** Features for use by LV2 plugins. - * @ingroup IngenShared - */ -class LV2Features { -public: - LV2Features(); - - class Feature { - public: - virtual ~Feature() {} - - virtual SharedPtr feature(Shared::World* world, - GraphObject* node) = 0; - }; - - class FeatureArray : public Raul::Noncopyable { - public: - typedef std::vector< SharedPtr > FeatureVector; - - explicit FeatureArray(FeatureVector& features); - - ~FeatureArray(); - - LV2_Feature** array() { return _array; } - - private: - FeatureVector _features; - LV2_Feature** _array; - }; - - void add_feature(SharedPtr feature); - - SharedPtr lv2_features(Shared::World* world, - GraphObject* node) const; - -private: - typedef std::vector< SharedPtr > Features; - Features _features; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_LV2FEATURES_HPP diff --git a/ingen/shared/Module.hpp b/ingen/shared/Module.hpp deleted file mode 100644 index 81179426..00000000 --- a/ingen/shared/Module.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_MODULE_HPP -#define INGEN_SHARED_MODULE_HPP - -#include - -namespace Ingen { -namespace Shared { - -class World; - -/** A dynamically loaded Ingen module. - * - * All components of Ingen reside in one of these. - * @ingroup IngenShared - */ -struct Module { - Module() : library(NULL) {} - virtual ~Module() {} - - virtual void load(Ingen::Shared::World* world) = 0; - virtual void run(Ingen::Shared::World* world) {} - - /** Library implementing this module. - * - * This is managed by the World and not this class, since closing the library - * in this destructor could possibly reference code from the library - * afterwards and cause a segfault on exit. - */ - Glib::Module* library; - -private: - Module(const Module& noncopyable); - Module& operator=(const Module& noncopyable); -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_MODULE_HPP diff --git a/ingen/shared/Store.hpp b/ingen/shared/Store.hpp deleted file mode 100644 index af281b9a..00000000 --- a/ingen/shared/Store.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_STORE_HPP -#define INGEN_SHARED_STORE_HPP - -#include - -#undef nil -#include - -#include "raul/PathTable.hpp" - -#include "ingen/GraphObject.hpp" - -namespace Ingen { -namespace Shared { - -/** Store of objects in the patch hierarchy. - * @ingroup IngenShared - */ -class Store : public Raul::PathTable< SharedPtr > { -public: - virtual ~Store() {} - - virtual void add(GraphObject* o); - - typedef Raul::Table< Raul::Path, SharedPtr > Objects; - - const_iterator children_begin(SharedPtr o) const; - const_iterator children_end(SharedPtr o) const; - - SharedPtr find_child(SharedPtr parent, - const std::string& child_name) const; - - unsigned child_name_offset(const Raul::Path& parent, - const Raul::Symbol& symbol, - bool allow_zero=true); - - Glib::RWLock& lock() { return _lock; } - -private: - Glib::RWLock _lock; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_STORE_HPP diff --git a/ingen/shared/URIMap.hpp b/ingen/shared/URIMap.hpp deleted file mode 100644 index d30b843d..00000000 --- a/ingen/shared/URIMap.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_URIMAP_HPP -#define INGEN_SHARED_URIMAP_HPP - -#include -#include - -#include "ingen/shared/LV2Features.hpp" -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/URI.hpp" -#include "raul/Noncopyable.hpp" - -namespace Ingen { -namespace Shared { - -/** URI to integer map and implementation of LV2 URID extension. - * @ingroup IngenShared - */ -class URIMap : public Raul::Noncopyable { -public: - URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap); - virtual ~URIMap() {} - - uint32_t map_uri(const char* uri); - const char* unmap_uri(uint32_t urid) const; - - class Feature : public LV2Features::Feature { - public: - Feature(const char* URI, void* data) { - _feature.URI = URI; - _feature.data = data; - } - - SharedPtr feature(Shared::World*, GraphObject*) { - return SharedPtr(&_feature, NullDeleter); - } - - private: - LV2_Feature _feature; - }; - - struct URIDMapFeature : public Feature { - URIDMapFeature(URIMap* map, LV2_URID_Map* urid_map); - LV2_URID map(const char* uri); - static LV2_URID default_map(LV2_URID_Map_Handle h, const char* uri); - LV2_URID_Map urid_map; - }; - - struct URIDUnmapFeature : public Feature { - URIDUnmapFeature(URIMap* map, LV2_URID_Unmap* urid_unmap); - const char* unmap(const LV2_URID urid); - static const char* default_unmap(LV2_URID_Map_Handle h, LV2_URID uri); - LV2_URID_Unmap urid_unmap; - }; - - SharedPtr urid_map_feature() { return _urid_map_feature; } - SharedPtr urid_unmap_feature() { return _urid_unmap_feature; } - -private: - SharedPtr _urid_map_feature; - SharedPtr _urid_unmap_feature; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_URIMAP_HPP diff --git a/ingen/shared/URIs.hpp b/ingen/shared/URIs.hpp deleted file mode 100644 index 9e604841..00000000 --- a/ingen/shared/URIs.hpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_URIS_HPP -#define INGEN_SHARED_URIS_HPP - -#include "ingen/shared/Forge.hpp" -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/Atom.hpp" -#include "raul/Noncopyable.hpp" -#include "raul/URI.hpp" - -namespace Raul { - class Forge; -} - -namespace Ingen { -namespace Shared { - -class URIMap; - -/** Frequently used interned URIs. - * - * This class initially maps all the special URIs used throughout the code - * using the URIMap so they can be used quickly with the performance of - * integers, but still be dynamic. - * - * @ingroup IngenShared - */ -class URIs : public Raul::Noncopyable { -public: - URIs(Ingen::Shared::Forge& forge, URIMap* map); - - struct Quark : public Raul::URI { - Quark(Ingen::Shared::Forge& forge, URIMap* map, const char* str); - operator LV2_URID() const { return id; } - operator Raul::Atom() const { return atom; } - uint32_t id; - Raul::Atom atom; - }; - - Ingen::Shared::Forge& forge; - - const Quark atom_AtomPort; - const Quark atom_Blank; - const Quark atom_Bool; - const Quark atom_Chunk; - const Quark atom_Float; - const Quark atom_Int; - const Quark atom_Resource; - const Quark atom_Sequence; - const Quark atom_Sound; - const Quark atom_String; - const Quark atom_URI; - const Quark atom_URID; - const Quark atom_Vector; - const Quark atom_bufferType; - const Quark atom_eventTransfer; - const Quark atom_supports; - const Quark doap_name; - const Quark ingen_Edge; - const Quark ingen_Internal; - const Quark ingen_Node; - const Quark ingen_Patch; - const Quark ingen_activity; - const Quark ingen_broadcast; - const Quark ingen_canvasX; - const Quark ingen_canvasY; - const Quark ingen_controlBinding; - const Quark ingen_document; - const Quark ingen_enabled; - const Quark ingen_engine; - const Quark ingen_head; - const Quark ingen_incidentTo; - const Quark ingen_nil; - const Quark ingen_node; - const Quark ingen_polyphonic; - const Quark ingen_polyphony; - const Quark ingen_prototype; - const Quark ingen_sampleRate; - const Quark ingen_status; - const Quark ingen_tail; - const Quark ingen_uiEmbedded; - const Quark ingen_value; - const Quark lv2_AudioPort; - const Quark lv2_CVPort; - const Quark lv2_ControlPort; - const Quark lv2_InputPort; - const Quark lv2_OutputPort; - const Quark lv2_Plugin; - const Quark lv2_connectionOptional; - const Quark lv2_default; - const Quark lv2_index; - const Quark lv2_integer; - const Quark lv2_maximum; - const Quark lv2_minimum; - const Quark lv2_name; - const Quark lv2_portProperty; - const Quark lv2_sampleRate; - const Quark lv2_scalePoint; - const Quark lv2_symbol; - const Quark lv2_toggled; - const Quark midi_Bender; - const Quark midi_ChannelPressure; - const Quark midi_Controller; - const Quark midi_MidiEvent; - const Quark midi_NoteOn; - const Quark midi_controllerNumber; - const Quark midi_noteNumber; - const Quark patch_Delete; - const Quark patch_Get; - const Quark patch_Move; - const Quark patch_Patch; - const Quark patch_Put; - const Quark patch_Response; - const Quark patch_Set; - const Quark patch_add; - const Quark patch_body; - const Quark patch_destination; - const Quark patch_remove; - const Quark patch_request; - const Quark patch_subject; - const Quark pprops_logarithmic; - const Quark rdf_type; - const Quark rdfs_seeAlso; - const Quark wildcard; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_LV2URIMAP_HPP diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp deleted file mode 100644 index 9ac0188b..00000000 --- a/ingen/shared/World.hpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_WORLD_HPP -#define INGEN_SHARED_WORLD_HPP - -#include - -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/Noncopyable.hpp" -#include "raul/SharedPtr.hpp" - -typedef struct LilvWorldImpl LilvWorld; - -namespace Sord { class World; } - -namespace Ingen { - -class EngineBase; -class Interface; - -namespace Serialisation { -class Parser; -class Serialiser; -} - -namespace Shared { - -class Configuration; -class Forge; -class LV2Features; -class Store; -class URIMap; -class URIs; - -/** The "world" all Ingen modules share. - * - * This is the root to which all components of Ingen are connected. It - * contains all necessary shared data (including the world for libraries like - * Sord and Lilv) and holds references to components. - * - * Most functionality in Ingen is implemented in dynamically loaded modules, - * which are loaded using this interface. When loaded, those modules add - * facilities to the World which can then be used throughout the code. For - * example loading the "ingen_serialisation" module will set World::serialiser - * and World::parser to valid objects. - * - * The world is used in any process which uses the Ingen as a library, both - * client and server (e.g. the world may not actually contain an Engine, since - * it maybe running in another process or even on a different machine). - * - * @ingroup IngenShared - */ -class World : public Raul::Noncopyable { -public: - /** Construct a new Ingen world. - * @param argc Argument count (as in C main()) - * @param argv Argument vector (as in C main()) - * @param map LV2 URID map implementation, or NULL to use internal. - * @param unmap LV2 URID unmap implementation, or NULL to use internal. - */ - World(int& argc, - char**& argv, - LV2_URID_Map* map, - LV2_URID_Unmap* unmap); - - virtual ~World(); - - /** Load an Ingen module by name (e.g. "server", "gui", etc.) - * @return True on success. - */ - virtual bool load_module(const char* name); - - /** Run a loaded module (modules that "run" only, e.g. gui). - * @return True on success. - */ - virtual bool run_module(const char* name); - - /** Unload all loaded Ingen modules. */ - virtual void unload_modules(); - - /** A function to create a new remote Interface. */ - typedef SharedPtr (*InterfaceFactory)( - World* world, - const std::string& engine_url, - SharedPtr respondee); - - /** Register an InterfaceFactory (for module implementations). */ - virtual void add_interface_factory(const std::string& scheme, - InterfaceFactory factory); - - /** Return a new Interface to control a server. - * @param engine_url The URL of the possibly remote server to control. - * @param respondee The Interface that will receive responses to commands - * and broadcasts, if applicable. - */ - virtual SharedPtr new_interface( - const std::string& engine_url, - SharedPtr respondee); - - /** Run a script. */ - virtual bool run(const std::string& mime_type, - const std::string& filename); - - virtual void set_engine(SharedPtr e); - virtual void set_interface(SharedPtr e); - virtual void set_parser(SharedPtr p); - virtual void set_serialiser(SharedPtr s); - virtual void set_store(SharedPtr s); - - virtual SharedPtr engine(); - virtual SharedPtr interface(); - virtual SharedPtr parser(); - virtual SharedPtr serialiser(); - virtual SharedPtr store(); - - virtual int& argc(); - virtual char**& argv(); - virtual Configuration& conf(); - - virtual Sord::World* rdf_world(); - virtual LilvWorld* lilv_world(); - - virtual LV2Features& lv2_features(); - virtual Ingen::Shared::Forge& forge(); - virtual URIMap& uri_map(); - virtual URIs& uris(); - - virtual void set_jack_uuid(const std::string& uuid); - virtual std::string jack_uuid(); - -private: - class Impl; - - Impl* _impl; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_WORLD_HPP diff --git a/ingen/shared/runtime_paths.hpp b/ingen/shared/runtime_paths.hpp deleted file mode 100644 index 5709370b..00000000 --- a/ingen/shared/runtime_paths.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 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_SHARED_RUNTIME_PATHS_HPP -#define INGEN_SHARED_RUNTIME_PATHS_HPP - -#include - -namespace Ingen { -namespace Shared { - -void set_bundle_path(const char* path); -void set_bundle_path_from_code(void* function); - -std::string bundle_file_path(const std::string& name); -std::string data_file_path(const std::string& name); -std::string module_path(const std::string& name, std::string dir=""); - -} // namespace Ingen -} // namespace Shared - -#endif // INGEN_SHARED_RUNTIME_PATHS_HPP -- cgit v1.2.1