summaryrefslogtreecommitdiffstats
path: root/ingen/shared
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-15 23:52:45 +0000
committerDavid Robillard <d@drobilla.net>2012-03-15 23:52:45 +0000
commitb617f75ff95d48ab3089976eb767e4f09abaa110 (patch)
tree971640580f926580dad54bb0a20e7838e135f5c6 /ingen/shared
parent89e263ff78b51352f226c8b02ee65ecd8cbfefb8 (diff)
downloadingen-b617f75ff95d48ab3089976eb767e4f09abaa110.tar.gz
ingen-b617f75ff95d48ab3089976eb767e4f09abaa110.tar.bz2
ingen-b617f75ff95d48ab3089976eb767e4f09abaa110.zip
Remove weird "include" directory and use standard style ("ingen" directory in top level).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4063 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ingen/shared')
-rw-r--r--ingen/shared/Builder.hpp57
-rw-r--r--ingen/shared/ClashAvoider.hpp100
-rw-r--r--ingen/shared/Configuration.hpp35
-rw-r--r--ingen/shared/LV2Atom.hpp45
-rw-r--r--ingen/shared/LV2Features.hpp77
-rw-r--r--ingen/shared/LV2URIMap.hpp115
-rw-r--r--ingen/shared/Module.hpp46
-rw-r--r--ingen/shared/ResourceImpl.hpp97
-rw-r--r--ingen/shared/Store.hpp60
-rw-r--r--ingen/shared/URIs.hpp110
-rw-r--r--ingen/shared/World.hpp130
-rw-r--r--ingen/shared/runtime_paths.hpp36
12 files changed, 908 insertions, 0 deletions
diff --git a/ingen/shared/Builder.hpp b/ingen/shared/Builder.hpp
new file mode 100644
index 00000000..245b3013
--- /dev/null
+++ b/ingen/shared/Builder.hpp
@@ -0,0 +1,57 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_BUILDER_HPP
+#define INGEN_SHARED_BUILDER_HPP
+
+#include "raul/SharedPtr.hpp"
+
+namespace Ingen {
+
+class CommonInterface;
+class GraphObject;
+
+namespace Shared {
+
+class URIs;
+
+/** Wrapper for CommonInterface to create existing objects/models.
+ *
+ * \ingroup interface
+ */
+class Builder
+{
+public:
+ Builder(SharedPtr<Shared::URIs> uris, CommonInterface& interface);
+ virtual ~Builder() {}
+
+ void build(SharedPtr<const GraphObject> object);
+ void connect(SharedPtr<const GraphObject> object);
+
+private:
+ void build_object(SharedPtr<const GraphObject> object);
+
+ SharedPtr<Shared::URIs> _uris;
+ CommonInterface& _interface;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_BUILDER_HPP
+
+
diff --git a/ingen/shared/ClashAvoider.hpp b/ingen/shared/ClashAvoider.hpp
new file mode 100644
index 00000000..4f5d8ec1
--- /dev/null
+++ b/ingen/shared/ClashAvoider.hpp
@@ -0,0 +1,100 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_CLASHAVOIDER_HPP
+#define INGEN_SHARED_CLASHAVOIDER_HPP
+
+#include <inttypes.h>
+
+#include <map>
+
+#include "ingen/CommonInterface.hpp"
+
+namespace Raul { class Atom; class Path; }
+
+namespace Ingen {
+namespace Shared {
+
+class Store;
+
+/** A wrapper for a CommonInterface that creates objects but possibly maps
+ * symbol names to avoid clashes with the existing objects in a store.
+ */
+class ClashAvoider : public CommonInterface
+{
+public:
+ ClashAvoider(Store& store, CommonInterface& 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; }
+
+ // 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& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ virtual void disconnect(const Raul::URI& src,
+ const Raul::URI& dst);
+
+ 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);
+
+private:
+ const Raul::URI map_uri(const Raul::URI& in);
+ const Raul::Path map_path(const Raul::Path& in);
+
+ Store& _store;
+ CommonInterface& _target;
+
+ Store* _also_avoid;
+ bool exists(const Raul::Path& path) const;
+
+ typedef std::map<Raul::Path, unsigned> Offsets;
+ Offsets _offsets;
+
+ typedef std::map<Raul::Path, Raul::Path> 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
new file mode 100644
index 00000000..21bc5737
--- /dev/null
+++ b/ingen/shared/Configuration.hpp
@@ -0,0 +1,35 @@
+/* This file is part of Ingen.
+ * Copyright 2010-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_SHARED_CONFIGURATION_HPP
+#define INGEN_SHARED_CONFIGURATION_HPP
+
+#include "raul/Configuration.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class Configuration : public Raul::Configuration {
+public:
+ Configuration(Raul::Forge* forge);
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_CONFIGURATION_HPP
+
diff --git a/ingen/shared/LV2Atom.hpp b/ingen/shared/LV2Atom.hpp
new file mode 100644
index 00000000..0aa35889
--- /dev/null
+++ b/ingen/shared/LV2Atom.hpp
@@ -0,0 +1,45 @@
+/* This file is part of Ingen.
+ * Copyright 2009-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_SHARED_LV2ATOM_HPP
+#define INGEN_SHARED_LV2ATOM_HPP
+
+#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
+
+namespace Raul { class Atom; }
+
+namespace Ingen {
+namespace Shared {
+
+class URIs;
+
+namespace LV2Atom {
+
+bool to_atom(const URIs& uris,
+ const LV2_Atom* object,
+ Raul::Atom& atom);
+
+bool from_atom(const URIs& uris,
+ const Raul::Atom& atom,
+ LV2_Atom* object);
+
+} // namespace LV2Atom
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_LV2ATOM_HPP
diff --git a/ingen/shared/LV2Features.hpp b/ingen/shared/LV2Features.hpp
new file mode 100644
index 00000000..f33cc605
--- /dev/null
+++ b/ingen/shared/LV2Features.hpp
@@ -0,0 +1,77 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_LV2FEATURES_HPP
+#define INGEN_SHARED_LV2FEATURES_HPP
+
+#include <vector>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#include "raul/SharedPtr.hpp"
+
+namespace Ingen {
+
+class Node;
+
+namespace Shared {
+
+class World;
+
+/** Stuff that may need to be passed to an LV2 plugin (i.e. LV2 features).
+ */
+class LV2Features {
+public:
+ LV2Features();
+
+ class Feature {
+ public:
+ virtual ~Feature() {}
+
+ virtual SharedPtr<LV2_Feature> feature(Shared::World* world,
+ Node* node) = 0;
+ };
+
+ class FeatureArray {
+ public:
+ typedef std::vector< SharedPtr<LV2_Feature> > FeatureVector;
+
+ explicit FeatureArray(FeatureVector& features);
+
+ ~FeatureArray();
+
+ LV2_Feature** array() { return _array; }
+
+ private:
+ FeatureVector _features;
+ LV2_Feature** _array;
+ };
+
+ void add_feature(SharedPtr<Feature> feature);
+
+ SharedPtr<FeatureArray> lv2_features(Shared::World* world,
+ Node* node) const;
+
+private:
+ typedef std::vector< SharedPtr<Feature> > Features;
+ Features _features;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_LV2FEATURES_HPP
diff --git a/ingen/shared/LV2URIMap.hpp b/ingen/shared/LV2URIMap.hpp
new file mode 100644
index 00000000..70c47a12
--- /dev/null
+++ b/ingen/shared/LV2URIMap.hpp
@@ -0,0 +1,115 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_LV2URIMAP_HPP
+#define INGEN_SHARED_LV2URIMAP_HPP
+
+#include <map>
+#include <utility>
+
+#include <boost/utility.hpp>
+
+#include "ingen/shared/LV2Features.hpp"
+#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
+#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
+#include "raul/URI.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+/** URI to Integer Map */
+class LV2URIMap : public boost::noncopyable {
+public:
+ LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap);
+ virtual ~LV2URIMap() {}
+
+ uint32_t map_uri(const char* uri);
+ const char* unmap_uri(uint32_t urid);
+
+ class Feature : public LV2Features::Feature {
+ public:
+ Feature(const char* URI, void* data) {
+ _feature.URI = URI;
+ _feature.data = data;
+ }
+
+ SharedPtr<LV2_Feature> feature(Shared::World*, Node*) {
+ return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>);
+ }
+
+ private:
+ LV2_Feature _feature;
+ };
+
+ class URIMapFeature : public Feature {
+ public:
+ URIMapFeature(LV2URIMap* map);
+
+ private:
+ LV2_URI_Map_Feature _feature_data;
+ };
+
+ class URIDMapFeature : public Feature {
+ public:
+ URIDMapFeature(LV2URIMap* map, LV2_URID_Map* urid_map);
+ LV2_URID map(const char* uri);
+ private:
+ static LV2_URID default_map(LV2_URID_Map_Handle h, const char* uri);
+ LV2_URID_Map _feature_data;
+ };
+
+ class URIDUnmapFeature : public Feature {
+ public:
+ URIDUnmapFeature(LV2URIMap* map, LV2_URID_Unmap* urid_unmap);
+ const char* unmap(const LV2_URID urid);
+ private:
+ static const char* default_unmap(LV2_URID_Map_Handle h, LV2_URID uri);
+ LV2_URID_Unmap _feature_data;
+ };
+
+ SharedPtr<URIMapFeature> uri_map_feature() { return _uri_map_feature; }
+ SharedPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; }
+ SharedPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; }
+
+ virtual uint32_t uri_to_id(const char* map, const char* uri);
+ virtual const char* id_to_uri(const char* map, uint32_t id);
+
+ std::pair<bool, uint32_t> event_to_global(uint16_t event_id) const;
+ std::pair<bool, uint16_t> global_to_event(uint32_t global_id) const;
+
+private:
+ static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data,
+ const char* map,
+ const char* uri);
+
+ static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char* uri);
+ static const char* urid_unmap(LV2_URID_Unmap_Handle handle, LV2_URID urid);
+
+ typedef std::map<uint16_t, uint32_t> EventToGlobal;
+ typedef std::map<uint32_t, uint16_t> GlobalToEvent;
+
+ SharedPtr<URIMapFeature> _uri_map_feature;
+ SharedPtr<URIDMapFeature> _urid_map_feature;
+ SharedPtr<URIDUnmapFeature> _urid_unmap_feature;
+ EventToGlobal _event_to_global;
+ GlobalToEvent _global_to_event;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_LV2URIMAP_HPP
diff --git a/ingen/shared/Module.hpp b/ingen/shared/Module.hpp
new file mode 100644
index 00000000..f972a999
--- /dev/null
+++ b/ingen/shared/Module.hpp
@@ -0,0 +1,46 @@
+/* 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_SHARED_MODULE_HPP
+#define INGEN_SHARED_MODULE_HPP
+
+#include <glibmm/module.h>
+
+#include "raul/SharedPtr.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class World;
+
+/** A dynamically loaded Ingen module.
+ *
+ * All components of Ingen reside in one of these.
+ */
+struct Module {
+ virtual ~Module();
+
+ virtual void load(Ingen::Shared::World* world) = 0;
+ virtual void run(Ingen::Shared::World* world) {}
+
+ SharedPtr<Glib::Module> library;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_MODULE_HPP
diff --git a/ingen/shared/ResourceImpl.hpp b/ingen/shared/ResourceImpl.hpp
new file mode 100644
index 00000000..8069c480
--- /dev/null
+++ b/ingen/shared/ResourceImpl.hpp
@@ -0,0 +1,97 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_RESOURCEIMPL_HPP
+#define INGEN_SHARED_RESOURCEIMPL_HPP
+
+#include "ingen/Resource.hpp"
+#include "ingen/shared/URIs.hpp"
+#include "raul/SharedPtr.hpp"
+#include "raul/URI.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class URIs;
+
+class ResourceImpl : virtual public Resource
+{
+public:
+ ResourceImpl(URIs& uris, const Raul::URI& uri)
+ : _uris(uris)
+ , _uri(uri)
+ {}
+
+ URIs& uris() const { return _uris; }
+
+ virtual void set_uri(const Raul::URI& uri) { _uri = uri; }
+ virtual const Raul::URI& uri() const { return _uri; }
+
+ const Properties& properties() const { return _properties; }
+ Properties& properties() { return _properties; }
+
+ Properties properties(Resource::Graph ctx) const;
+
+ const Raul::Atom& get_property(const Raul::URI& uri) const;
+
+ const Raul::Atom& set_property(const Raul::URI& uri,
+ const Raul::Atom& value,
+ Resource::Graph ctx=Resource::DEFAULT);
+
+ /** Hook called whenever a property is added.
+ * This can be used by derived classes to implement special behaviour for
+ * particular properties (e.g. ingen:value for ports).
+ */
+ virtual void on_property(const Raul::URI& uri, const Raul::Atom& value) {}
+
+ void remove_property(const Raul::URI& uri, const Raul::Atom& value);
+ bool has_property(const Raul::URI& uri, const Raul::Atom& value) const;
+ void add_property(const Raul::URI& uri,
+ const Raul::Atom& value,
+ Graph ctx = DEFAULT);
+ void set_properties(const Properties& p);
+ void add_properties(const Properties& p);
+ void remove_properties(const Properties& p);
+
+ void dump(std::ostream& os) const;
+
+ /** Get the ingen type from a set of Properties.
+ * 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 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;
+
+ URIs& _uris;
+
+private:
+ Raul::URI _uri;
+ mutable Properties _properties;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_RESOURCEIMPL_HPP
+
diff --git a/ingen/shared/Store.hpp b/ingen/shared/Store.hpp
new file mode 100644
index 00000000..3347cdde
--- /dev/null
+++ b/ingen/shared/Store.hpp
@@ -0,0 +1,60 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_STORE_HPP
+#define INGEN_SHARED_STORE_HPP
+
+#include <string>
+
+#undef nil
+#include <glibmm/thread.h>
+
+#include "raul/PathTable.hpp"
+
+#include "ingen/GraphObject.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class Store : public Raul::PathTable< SharedPtr<GraphObject> > {
+public:
+ virtual ~Store() {}
+
+ virtual void add(GraphObject* o);
+
+ typedef Raul::Table< Raul::Path, SharedPtr<GraphObject> > Objects;
+
+ const_iterator children_begin(SharedPtr<const GraphObject> o) const;
+ const_iterator children_end(SharedPtr<const GraphObject> o) const;
+
+ SharedPtr<GraphObject> find_child(SharedPtr<const GraphObject> 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/URIs.hpp b/ingen/shared/URIs.hpp
new file mode 100644
index 00000000..b3d8d301
--- /dev/null
+++ b/ingen/shared/URIs.hpp
@@ -0,0 +1,110 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_URIS_HPP
+#define INGEN_SHARED_URIS_HPP
+
+#include <boost/utility.hpp>
+
+#include "ingen/shared/LV2URIMap.hpp"
+#include "raul/URI.hpp"
+
+namespace Raul {
+ class Forge;
+}
+
+namespace Ingen {
+namespace Shared {
+
+class URIs : public boost::noncopyable {
+public:
+ URIs(Raul::Forge& forge, LV2URIMap* map);
+
+ struct Quark : public Raul::URI {
+ Quark(LV2URIMap* map, const char* str);
+ uint32_t id;
+ };
+
+ Raul::Forge& forge;
+
+ const Quark atom_Bool;
+ const Quark atom_Float;
+ const Quark atom_Int32;
+ const Quark atom_MessagePort;
+ const Quark atom_String;
+ const Quark atom_ValuePort;
+ const Quark atom_Vector;
+ const Quark atom_eventTransfer;
+ const Quark atom_supports;
+ const Quark ctx_audioContext;
+ const Quark ctx_context;
+ const Quark ctx_messageContext;
+ const Quark cv_CVPort;
+ const Quark doap_name;
+ const Quark ev_EventPort;
+ const Quark ingen_Internal;
+ const Quark ingen_Node;
+ const Quark ingen_Patch;
+ const Quark ingen_Port;
+ const Quark ingen_broadcast;
+ const Quark ingen_controlBinding;
+ const Quark ingen_document;
+ const Quark ingen_enabled;
+ const Quark ingen_engine;
+ const Quark ingen_nil;
+ const Quark ingen_node;
+ const Quark ingen_polyphonic;
+ const Quark ingen_polyphony;
+ const Quark ingen_sampleRate;
+ const Quark ingen_selected;
+ const Quark ingen_value;
+ const Quark ingen_canvasX;
+ const Quark ingen_canvasY;
+ const Quark lv2_AudioPort;
+ 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_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 rdf_instanceOf;
+ const Quark rdf_type;
+ const Quark rdfs_seeAlso;
+ const Quark ui_Events;
+ const Quark wildcard;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_SHARED_LV2URIMAP_HPP
diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp
new file mode 100644
index 00000000..e062dea6
--- /dev/null
+++ b/ingen/shared/World.hpp
@@ -0,0 +1,130 @@
+/* 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_MODULE_WORLD_HPP
+#define INGEN_MODULE_WORLD_HPP
+
+#include <string>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+
+#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
+
+#include "raul/Configuration.hpp"
+#include "raul/SharedPtr.hpp"
+
+typedef struct LilvWorldImpl LilvWorld;
+
+namespace Sord { class World; }
+
+namespace Ingen {
+
+class EngineBase;
+class ClientInterface;
+class ServerInterface;
+
+namespace Serialisation { class Serialiser; class Parser; }
+
+namespace Shared {
+
+class LV2Features;
+class URIs;
+class LV2URIMap;
+class Store;
+
+/** The "world" all Ingen modules may share.
+ *
+ * All loaded components of Ingen, as well as things requiring shared access
+ * and/or locking (e.g. Sord, Lilv).
+ *
+ * Ingen modules are shared libraries which modify the World when loaded
+ * using World::load, e.g. loading the "ingen_serialisation" module will
+ * set World::serialiser and World::parser to valid objects.
+ */
+class World : public boost::noncopyable {
+public:
+ World(Raul::Configuration* conf,
+ int& argc,
+ char**& argv,
+ LV2_URID_Map* map,
+ LV2_URID_Unmap* unmap);
+
+ virtual ~World();
+
+ virtual bool load_module(const char* name);
+ virtual bool run_module(const char* name);
+
+ virtual void unload_modules();
+
+ typedef SharedPtr<ServerInterface> (*InterfaceFactory)(
+ World* world,
+ const std::string& engine_url,
+ SharedPtr<ClientInterface> 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 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_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<Serialisation::Serialiser> serialiser();
+ virtual SharedPtr<Serialisation::Parser> parser();
+ virtual SharedPtr<Store> store();
+
+ virtual Sord::World* rdf_world();
+
+ virtual SharedPtr<URIs> uris();
+ virtual SharedPtr<LV2URIMap> lv2_uri_map();
+
+ virtual int& argc();
+ virtual char**& argv();
+
+ virtual Raul::Configuration* conf();
+ virtual void set_conf(Raul::Configuration* c);
+
+ virtual Raul::Forge& forge();
+
+ virtual LV2Features* lv2_features();
+
+ virtual LilvWorld* lilv_world();
+
+ virtual void set_jack_uuid(const std::string& uuid);
+ virtual std::string jack_uuid();
+
+private:
+ class Pimpl;
+
+ Pimpl* _impl;
+};
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_MODULE_WORLD_HPP
diff --git a/ingen/shared/runtime_paths.hpp b/ingen/shared/runtime_paths.hpp
new file mode 100644
index 00000000..3ed48f00
--- /dev/null
+++ b/ingen/shared/runtime_paths.hpp
@@ -0,0 +1,36 @@
+/* This file is part of Ingen.
+ * Copyright 2008-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_SHARED_RUNTIME_PATHS_HPP
+#define INGEN_SHARED_RUNTIME_PATHS_HPP
+
+#include <string>
+
+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