From b617f75ff95d48ab3089976eb767e4f09abaa110 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 15 Mar 2012 23:52:45 +0000 Subject: 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 --- ingen/shared/Builder.hpp | 57 ++++++++++++++++++ ingen/shared/ClashAvoider.hpp | 100 +++++++++++++++++++++++++++++++ ingen/shared/Configuration.hpp | 35 +++++++++++ ingen/shared/LV2Atom.hpp | 45 ++++++++++++++ ingen/shared/LV2Features.hpp | 77 ++++++++++++++++++++++++ ingen/shared/LV2URIMap.hpp | 115 ++++++++++++++++++++++++++++++++++++ ingen/shared/Module.hpp | 46 +++++++++++++++ ingen/shared/ResourceImpl.hpp | 97 ++++++++++++++++++++++++++++++ ingen/shared/Store.hpp | 60 +++++++++++++++++++ ingen/shared/URIs.hpp | 110 ++++++++++++++++++++++++++++++++++ ingen/shared/World.hpp | 130 +++++++++++++++++++++++++++++++++++++++++ ingen/shared/runtime_paths.hpp | 36 ++++++++++++ 12 files changed, 908 insertions(+) create mode 100644 ingen/shared/Builder.hpp create mode 100644 ingen/shared/ClashAvoider.hpp create mode 100644 ingen/shared/Configuration.hpp create mode 100644 ingen/shared/LV2Atom.hpp create mode 100644 ingen/shared/LV2Features.hpp create mode 100644 ingen/shared/LV2URIMap.hpp create mode 100644 ingen/shared/Module.hpp create mode 100644 ingen/shared/ResourceImpl.hpp create mode 100644 ingen/shared/Store.hpp create mode 100644 ingen/shared/URIs.hpp create mode 100644 ingen/shared/World.hpp create mode 100644 ingen/shared/runtime_paths.hpp (limited to 'ingen/shared') 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 + * + * 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 uris, CommonInterface& interface); + virtual ~Builder() {} + + void build(SharedPtr object); + void connect(SharedPtr object); + +private: + void build_object(SharedPtr object); + + SharedPtr _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 + * + * 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 + +#include + +#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 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 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 + * + * 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 + * + * 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 + * + * 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 + +#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 feature(Shared::World* world, + Node* node) = 0; + }; + + class FeatureArray { + 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, + Node* node) const; + +private: + typedef std::vector< SharedPtr > 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 + * + * 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 +#include + +#include + +#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 feature(Shared::World*, Node*) { + return SharedPtr(&_feature, NullDeleter); + } + + 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 uri_map_feature() { return _uri_map_feature; } + SharedPtr urid_map_feature() { return _urid_map_feature; } + SharedPtr 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 event_to_global(uint16_t event_id) const; + std::pair 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 EventToGlobal; + typedef std::map GlobalToEvent; + + SharedPtr _uri_map_feature; + SharedPtr _urid_map_feature; + SharedPtr _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 + * + * 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 + +#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 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 + * + * 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 + * + * 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 + +#undef nil +#include + +#include "raul/PathTable.hpp" + +#include "ingen/GraphObject.hpp" + +namespace Ingen { +namespace Shared { + +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/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 + * + * 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 + +#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 + * + * 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 + +#include +#include + +#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 (*InterfaceFactory)( + World* world, + const std::string& engine_url, + SharedPtr respond_to); + + virtual void add_interface_factory(const std::string& scheme, + InterfaceFactory factory); + + virtual SharedPtr interface( + const std::string& engine_url, + SharedPtr respond_to); + + virtual bool run(const std::string& mime_type, + const std::string& filename); + + virtual void set_local_engine(SharedPtr e); + virtual void set_engine(SharedPtr e); + virtual void set_serialiser(SharedPtr s); + virtual void set_parser(SharedPtr p); + virtual void set_store(SharedPtr s); + + virtual SharedPtr local_engine(); + virtual SharedPtr engine(); + virtual SharedPtr serialiser(); + virtual SharedPtr parser(); + virtual SharedPtr store(); + + virtual Sord::World* rdf_world(); + + virtual SharedPtr uris(); + virtual SharedPtr 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 + * + * 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 + +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