diff options
author | David Robillard <d@drobilla.net> | 2020-08-02 15:23:19 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-08-02 15:23:19 +0200 |
commit | bdbdf42f3fe990c713c5437724db39274c387eee (patch) | |
tree | 7f921a04fd580da6bcb6fc8975fa2aebfcd93e0f /src | |
parent | ec0b87a18623c17c16f6a648fcf277abe14142b7 (diff) | |
download | ingen-bdbdf42f3fe990c713c5437724db39274c387eee.tar.gz ingen-bdbdf42f3fe990c713c5437724db39274c387eee.tar.bz2 ingen-bdbdf42f3fe990c713c5437724db39274c387eee.zip |
Remove std::shared_ptr alias
Diffstat (limited to 'src')
139 files changed, 1125 insertions, 977 deletions
diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index fe4f686e..ded2ba2c 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -68,7 +68,6 @@ #include <cassert> #include <cstdint> -#include <memory> #include <string> #include <utility> diff --git a/src/Forge.cpp b/src/Forge.cpp index db6d8ebf..6b8f7b14 100644 --- a/src/Forge.cpp +++ b/src/Forge.cpp @@ -20,7 +20,6 @@ #include "lv2/atom/forge.h" #include "lv2/urid/urid.h" -#include <memory> #include <sstream> namespace ingen { diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index 3a628116..ebce8780 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -31,7 +31,7 @@ LV2Features::Feature::free_feature(LV2_Feature* feature) } void -LV2Features::add_feature(const SPtr<Feature>& feature) +LV2Features::add_feature(const std::shared_ptr<Feature>& feature) { _features.push_back(feature); } @@ -68,12 +68,12 @@ LV2Features::is_supported(const std::string& uri) const return false; } -SPtr<LV2Features::FeatureArray> +std::shared_ptr<LV2Features::FeatureArray> LV2Features::lv2_features(World& world, Node* node) const { FeatureArray::FeatureVector vec; for (const auto& f : _features) { - SPtr<LV2_Feature> fptr = f->feature(world, node); + std::shared_ptr<LV2_Feature> fptr = f->feature(world, node); if (fptr) { vec.push_back(fptr); } diff --git a/src/Log.cpp b/src/Log.cpp index 06bb1955..55c2193a 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -148,7 +148,7 @@ free_log_feature(LV2_Feature* feature) { free(feature); } -SPtr<LV2_Feature> +std::shared_ptr<LV2_Feature> Log::Feature::feature(World& world, Node* block) { auto* handle = static_cast<Handle*>(calloc(1, sizeof(Handle))); @@ -162,7 +162,7 @@ Log::Feature::feature(World& world, Node* block) f->URI = LV2_LOG__log; f->data = &handle->lv2_log; - return SPtr<LV2_Feature>(f, &free_log_feature); + return std::shared_ptr<LV2_Feature>(f, &free_log_feature); } } // namespace ingen diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index 2ab0f039..3ea8e7e0 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -46,6 +46,7 @@ #include <cstdint> #include <cstring> #include <map> +#include <memory> #include <set> #include <stdexcept> #include <string> @@ -76,12 +77,13 @@ struct Serialiser::Impl { void start_to_file(const Raul::Path& root, const FilePath& filename); - std::set<const Resource*> serialise_graph(const SPtr<const Node>& graph, - const Sord::Node& graph_id); + std::set<const Resource*> + serialise_graph(const std::shared_ptr<const Node>& graph, + const Sord::Node& graph_id); - void serialise_block(const SPtr<const Node>& block, - const Sord::Node& class_id, - const Sord::Node& block_id); + void serialise_block(const std::shared_ptr<const Node>& block, + const Sord::Node& class_id, + const Sord::Node& block_id); void serialise_port(const Node* port, Resource::Graph context, @@ -90,18 +92,18 @@ struct Serialiser::Impl { void serialise_properties(Sord::Node id, const Properties& props); - void write_bundle(const SPtr<const Node>& graph, const URI& uri); + void write_bundle(const std::shared_ptr<const Node>& graph, const URI& uri); Sord::Node path_rdf_node(const Raul::Path& path) const; - void write_manifest(const FilePath& bundle_path, - const SPtr<const Node>& graph); + void write_manifest(const FilePath& bundle_path, + const std::shared_ptr<const Node>& graph); void write_plugins(const FilePath& bundle_path, const std::set<const Resource*>& plugins); - void serialise_arc(const Sord::Node& parent, - const SPtr<const Arc>& arc); + void serialise_arc(const Sord::Node& parent, + const std::shared_ptr<const Arc>& arc); std::string finish(); @@ -122,7 +124,7 @@ Serialiser::~Serialiser() = default; void Serialiser::Impl::write_manifest(const FilePath& bundle_path, - const SPtr<const Node>&) + const std::shared_ptr<const Node>&) { const FilePath manifest_path(bundle_path / "manifest.ttl"); const FilePath binary_path(ingen_module_path("lv2")); @@ -184,13 +186,15 @@ Serialiser::Impl::write_plugins(const FilePath& bundle_path, } void -Serialiser::write_bundle(const SPtr<const Node>& graph, const URI& uri) +Serialiser::write_bundle(const std::shared_ptr<const Node>& graph, + const URI& uri) { me->write_bundle(graph, uri); } void -Serialiser::Impl::write_bundle(const SPtr<const Node>& graph, const URI& uri) +Serialiser::Impl::write_bundle(const std::shared_ptr<const Node>& graph, + const URI& uri) { FilePath path(uri.path()); if (filesystem::exists(path) && !filesystem::is_directory(path)) { @@ -288,7 +292,8 @@ Serialiser::Impl::path_rdf_node(const Raul::Path& path) const } void -Serialiser::serialise(const SPtr<const Node>& object, Resource::Graph context) +Serialiser::serialise(const std::shared_ptr<const Node>& object, + Resource::Graph context) { if (!me->_model) { throw std::logic_error("serialise called without serialisation in progress"); @@ -309,8 +314,8 @@ Serialiser::serialise(const SPtr<const Node>& object, Resource::Graph context) } std::set<const Resource*> -Serialiser::Impl::serialise_graph(const SPtr<const Node>& graph, - const Sord::Node& graph_id) +Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph, + const Sord::Node& graph_id) { Sord::World& world = _model->world(); const URIs& uris = _world.uris(); @@ -350,7 +355,7 @@ Serialiser::Impl::serialise_graph(const SPtr<const Node>& graph, } if (n->second->graph_type() == Node::GraphType::GRAPH) { - SPtr<Node> subgraph = n->second; + std::shared_ptr<Node> subgraph = n->second; SerdURI base_uri; serd_uri_parse(reinterpret_cast<const uint8_t*>(_base_uri.c_str()), @@ -386,7 +391,7 @@ Serialiser::Impl::serialise_graph(const SPtr<const Node>& graph, block_id); serialise_block(subgraph, subgraph_id, block_id); } else if (n->second->graph_type() == Node::GraphType::BLOCK) { - SPtr<const Node> block = n->second; + std::shared_ptr<const Node> block = n->second; const Sord::URI class_id(world, block->plugin()->uri()); const Sord::Node block_id(path_rdf_node(n->second->path())); @@ -424,9 +429,9 @@ Serialiser::Impl::serialise_graph(const SPtr<const Node>& graph, } void -Serialiser::Impl::serialise_block(const SPtr<const Node>& block, - const Sord::Node& class_id, - const Sord::Node& block_id) +Serialiser::Impl::serialise_block(const std::shared_ptr<const Node>& block, + const Sord::Node& class_id, + const Sord::Node& block_id) { const URIs& uris = _world.uris(); @@ -503,15 +508,15 @@ Serialiser::Impl::serialise_port(const Node* port, } void -Serialiser::serialise_arc(const Sord::Node& parent, - const SPtr<const Arc>& arc) +Serialiser::serialise_arc(const Sord::Node& parent, + const std::shared_ptr<const Arc>& arc) { return me->serialise_arc(parent, arc); } void -Serialiser::Impl::serialise_arc(const Sord::Node& parent, - const SPtr<const Arc>& arc) +Serialiser::Impl::serialise_arc(const Sord::Node& parent, + const std::shared_ptr<const Arc>& arc) { if (!_model) { throw std::logic_error( diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp index 7e6b9782..28ad9bbf 100644 --- a/src/SocketReader.cpp +++ b/src/SocketReader.cpp @@ -37,18 +37,18 @@ namespace ingen { -SocketReader::SocketReader(ingen::World& world, - Interface& iface, - SPtr<Raul::Socket> sock) - : _world(world) - , _iface(iface) - , _env() - , _inserter(nullptr) - , _msg_node(nullptr) - , _socket(std::move(sock)) - , _socket_error(0) - , _exit_flag(false) - , _thread(&SocketReader::run, this) +SocketReader::SocketReader(ingen::World& world, + Interface& iface, + std::shared_ptr<Raul::Socket> sock) + : _world(world) + , _iface(iface) + , _env() + , _inserter(nullptr) + , _msg_node(nullptr) + , _socket(std::move(sock)) + , _socket_error(0) + , _exit_flag(false) + , _thread(&SocketReader::run, this) {} SocketReader::~SocketReader() diff --git a/src/SocketWriter.cpp b/src/SocketWriter.cpp index 910f67f3..4e895135 100644 --- a/src/SocketWriter.cpp +++ b/src/SocketWriter.cpp @@ -21,6 +21,7 @@ #include <boost/variant/get.hpp> +#include <memory> #include <sys/socket.h> #include <sys/types.h> #include <utility> @@ -31,10 +32,10 @@ namespace ingen { -SocketWriter::SocketWriter(URIMap& map, - URIs& uris, - const URI& uri, - SPtr<Raul::Socket> sock) +SocketWriter::SocketWriter(URIMap& map, + URIs& uris, + const URI& uri, + std::shared_ptr<Raul::Socket> sock) : TurtleWriter(map, uris, uri) , _socket(std::move(sock)) {} diff --git a/src/Store.cpp b/src/Store.cpp index 2373e871..f176613e 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -22,6 +22,7 @@ #include <cassert> #include <cstdint> +#include <memory> #include <sstream> #include <string> @@ -34,7 +35,7 @@ Store::add(Node* o) return; } - emplace(o->path(), SPtr<Node>(o)); + emplace(o->path(), std::shared_ptr<Node>(o)); for (uint32_t i = 0; i < o->num_ports(); ++i) { add(o->port(i)); @@ -77,7 +78,7 @@ Store::find_descendants_end(const const_iterator parent) const } Store::const_range -Store::children_range(const SPtr<const Node>& o) const +Store::children_range(const std::shared_ptr<const Node>& o) const { const const_iterator parent = find(o->path()); if (parent != end()) { diff --git a/src/World.cpp b/src/World.cpp index 6df3b4b1..de52dfa0 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -33,6 +33,7 @@ #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" #include "ingen/ingen.h" +#include "ingen/memory.hpp" #include "ingen/runtime_paths.hpp" #include "lilv/lilv.h" #include "lv2/log/log.h" @@ -189,11 +190,11 @@ public: URIs uris; Configuration conf; Log log; - SPtr<Interface> interface; - SPtr<EngineBase> engine; - SPtr<Serialiser> serialiser; - SPtr<Parser> parser; - SPtr<Store> store; + std::shared_ptr<Interface> interface; + std::shared_ptr<EngineBase> engine; + std::shared_ptr<Serialiser> serialiser; + std::shared_ptr<Parser> parser; + std::shared_ptr<Store> store; std::mutex rdf_mutex; std::string jack_uuid; }; @@ -228,15 +229,29 @@ World::load_configuration(int& argc, char**& argv) _impl->log.set_trace(_impl->conf.option("trace").get<int32_t>()); } -void World::set_engine(const SPtr<EngineBase>& e) { _impl->engine = e; } -void World::set_interface(const SPtr<Interface>& i) { _impl->interface = i; } -void World::set_store(const SPtr<Store>& s) { _impl->store = s; } +void +World::set_engine(const std::shared_ptr<EngineBase>& e) +{ + _impl->engine = e; +} + +void +World::set_interface(const std::shared_ptr<Interface>& i) +{ + _impl->interface = i; +} + +void +World::set_store(const std::shared_ptr<Store>& s) +{ + _impl->store = s; +} -SPtr<EngineBase> World::engine() { return _impl->engine; } -SPtr<Interface> World::interface() { return _impl->interface; } -SPtr<Parser> World::parser() { return _impl->parser; } -SPtr<Serialiser> World::serialiser() { return _impl->serialiser; } -SPtr<Store> World::store() { return _impl->store; } +std::shared_ptr<EngineBase> World::engine() { return _impl->engine; } +std::shared_ptr<Interface> World::interface() { return _impl->interface; } +std::shared_ptr<Parser> World::parser() { return _impl->parser; } +std::shared_ptr<Serialiser> World::serialiser() { return _impl->serialiser; } +std::shared_ptr<Store> World::store() { return _impl->store; } int& World::argc() { return *_impl->argc; } char**& World::argv() { return *_impl->argv; } @@ -298,8 +313,9 @@ World::run_module(const char* name) /** Get an interface for a remote engine at `engine_uri` */ -SPtr<Interface> -World::new_interface(const URI& engine_uri, const SPtr<Interface>& respondee) +std::shared_ptr<Interface> +World::new_interface(const URI& engine_uri, + const std::shared_ptr<Interface>& respondee) { const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(std::string(engine_uri.scheme())); diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index 636b3a85..898a1799 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -30,15 +30,15 @@ namespace ingen { namespace client { -BlockModel::BlockModel(URIs& uris, - const SPtr<PluginModel>& plugin, - const Raul::Path& path) - : ObjectModel(uris, path) - , _plugin_uri(plugin->uri()) - , _plugin(plugin) - , _num_values(0) - , _min_values(nullptr) - , _max_values(nullptr) +BlockModel::BlockModel(URIs& uris, + const std::shared_ptr<PluginModel>& plugin, + const Raul::Path& path) + : ObjectModel(uris, path) + , _plugin_uri(plugin->uri()) + , _plugin(plugin) + , _num_values(0) + , _min_values(nullptr) + , _max_values(nullptr) { } @@ -68,7 +68,7 @@ BlockModel::~BlockModel() } void -BlockModel::remove_port(const SPtr<PortModel>& port) +BlockModel::remove_port(const std::shared_ptr<PortModel>& port) { for (auto i = _ports.begin(); i != _ports.end(); ++i) { if ((*i) == port) { @@ -102,7 +102,7 @@ BlockModel::clear() } void -BlockModel::add_child(const SPtr<ObjectModel>& c) +BlockModel::add_child(const std::shared_ptr<ObjectModel>& c) { assert(c->parent().get() == this); @@ -114,7 +114,7 @@ BlockModel::add_child(const SPtr<ObjectModel>& c) } bool -BlockModel::remove_child(const SPtr<ObjectModel>& c) +BlockModel::remove_child(const std::shared_ptr<ObjectModel>& c) { assert(c->path().is_child_of(path())); assert(c->parent().get() == this); @@ -130,7 +130,7 @@ BlockModel::remove_child(const SPtr<ObjectModel>& c) } void -BlockModel::add_port(const SPtr<PortModel>& pm) +BlockModel::add_port(const std::shared_ptr<PortModel>& pm) { assert(pm); assert(pm->path().is_child_of(path())); @@ -143,7 +143,7 @@ BlockModel::add_port(const SPtr<PortModel>& pm) _signal_new_port.emit(pm); } -SPtr<const PortModel> +std::shared_ptr<const PortModel> BlockModel::get_port(const Raul::Symbol& symbol) const { for (auto p : _ports) { @@ -151,10 +151,10 @@ BlockModel::get_port(const Raul::Symbol& symbol) const return p; } } - return SPtr<PortModel>(); + return std::shared_ptr<PortModel>(); } -SPtr<const PortModel> +std::shared_ptr<const PortModel> BlockModel::get_port(uint32_t index) const { return _ports[index]; @@ -169,10 +169,11 @@ BlockModel::port(uint32_t index) const } void -BlockModel::default_port_value_range(const SPtr<const PortModel>& port, - float& min, - float& max, - uint32_t srate) const +BlockModel::default_port_value_range( + const std::shared_ptr<const PortModel>& port, + float& min, + float& max, + uint32_t srate) const { // Default control values min = 0.0; @@ -203,10 +204,10 @@ BlockModel::default_port_value_range(const SPtr<const PortModel>& port, } void -BlockModel::port_value_range(const SPtr<const PortModel>& port, - float& min, - float& max, - uint32_t srate) const +BlockModel::port_value_range(const std::shared_ptr<const PortModel>& port, + float& min, + float& max, + uint32_t srate) const { assert(port->parent().get() == this); @@ -246,7 +247,7 @@ BlockModel::label() const } std::string -BlockModel::port_label(const SPtr<const PortModel>& port) const +BlockModel::port_label(const std::shared_ptr<const PortModel>& port) const { const Atom& name = port->get_property(URI(LV2_CORE__name)); if (name.is_valid() && name.type() == _uris.forge.String) { @@ -273,7 +274,7 @@ BlockModel::port_label(const SPtr<const PortModel>& port) const } void -BlockModel::set(const SPtr<ObjectModel>& model) +BlockModel::set(const std::shared_ptr<ObjectModel>& model) { auto block = std::dynamic_pointer_cast<BlockModel>(model); if (block) { diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index a9d8f44b..1a7963f3 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -36,9 +36,9 @@ namespace ingen { namespace client { -ClientStore::ClientStore(URIs& uris, - Log& log, - const SPtr<SigClientInterface>& emitter) +ClientStore::ClientStore(URIs& uris, + Log& log, + const std::shared_ptr<SigClientInterface>& emitter) : _uris(uris) , _log(log) , _emitter(emitter) @@ -58,7 +58,7 @@ ClientStore::clear() } void -ClientStore::add_object(const SPtr<ObjectModel>& object) +ClientStore::add_object(const std::shared_ptr<ObjectModel>& object) { // If we already have "this" object, merge the existing one into the new // one (with precedence to the new values). @@ -67,7 +67,7 @@ ClientStore::add_object(const SPtr<ObjectModel>& object) std::dynamic_pointer_cast<ObjectModel>(existing->second)->set(object); } else { if (!object->path().is_root()) { - SPtr<ObjectModel> parent = _object(object->path().parent()); + std::shared_ptr<ObjectModel> parent = _object(object->path().parent()); if (parent) { assert(object->path().is_child_of(parent->path())); object->set_parent(parent); @@ -90,7 +90,7 @@ ClientStore::add_object(const SPtr<ObjectModel>& object) } } -SPtr<ObjectModel> +std::shared_ptr<ObjectModel> ClientStore::remove_object(const Raul::Path& path) { // Find the object, the "top" of the tree to remove @@ -130,30 +130,30 @@ ClientStore::remove_object(const Raul::Path& path) return object; } -SPtr<PluginModel> +std::shared_ptr<PluginModel> ClientStore::_plugin(const URI& uri) { const Plugins::iterator i = _plugins->find(uri); - return (i == _plugins->end()) ? SPtr<PluginModel>() : (*i).second; + return (i == _plugins->end()) ? std::shared_ptr<PluginModel>() : (*i).second; } -SPtr<PluginModel> +std::shared_ptr<PluginModel> ClientStore::_plugin(const Atom& uri) { /* FIXME: Should probably be stored with URIs rather than strings, to make this a fast case. */ const Plugins::iterator i = _plugins->find(URI(_uris.forge.str(uri, false))); - return (i == _plugins->end()) ? SPtr<PluginModel>() : (*i).second; + return (i == _plugins->end()) ? std::shared_ptr<PluginModel>() : (*i).second; } -SPtr<const PluginModel> +std::shared_ptr<const PluginModel> ClientStore::plugin(const URI& uri) const { return const_cast<ClientStore*>(this)->_plugin(uri); } -SPtr<ObjectModel> +std::shared_ptr<ObjectModel> ClientStore::_object(const Raul::Path& path) { const iterator i = find(path); @@ -167,13 +167,13 @@ ClientStore::_object(const Raul::Path& path) } } -SPtr<const ObjectModel> +std::shared_ptr<const ObjectModel> ClientStore::object(const Raul::Path& path) const { return const_cast<ClientStore*>(this)->_object(path); } -SPtr<Resource> +std::shared_ptr<Resource> ClientStore::_resource(const URI& uri) { if (uri_is_path(uri)) { @@ -183,16 +183,16 @@ ClientStore::_resource(const URI& uri) } } -SPtr<const Resource> +std::shared_ptr<const Resource> ClientStore::resource(const URI& uri) const { return const_cast<ClientStore*>(this)->_resource(uri); } void -ClientStore::add_plugin(const SPtr<PluginModel>& pm) +ClientStore::add_plugin(const std::shared_ptr<PluginModel>& pm) { - SPtr<PluginModel> existing = _plugin(pm->uri()); + std::shared_ptr<PluginModel> existing = _plugin(pm->uri()); if (existing) { existing->set(pm); } else { @@ -258,9 +258,9 @@ ClientStore::operator()(const Put& msg) if (t != properties.end()) { const Atom& type(t->second); if (_uris.pset_Preset == type) { - const Iterator p = properties.find(_uris.lv2_appliesTo); - const Iterator l = properties.find(_uris.rdfs_label); - SPtr<PluginModel> plug; + const Iterator p = properties.find(_uris.lv2_appliesTo); + const Iterator l = properties.find(_uris.rdfs_label); + std::shared_ptr<PluginModel> plug; if (p == properties.end()) { _log.error("Preset <%1%> with no plugin\n", uri.c_str()); } else if (l == properties.end()) { @@ -277,7 +277,7 @@ ClientStore::operator()(const Put& msg) } else if (_uris.ingen_Graph == type) { is_graph = true; } else if (_uris.ingen_Internal == type || _uris.lv2_Plugin == type) { - SPtr<PluginModel> p(new PluginModel(uris(), uri, type, properties)); + std::shared_ptr<PluginModel> p(new PluginModel(uris(), uri, type, properties)); add_plugin(p); return; } @@ -301,7 +301,7 @@ ClientStore::operator()(const Put& msg) } if (is_graph) { - SPtr<GraphModel> model(new GraphModel(uris(), path)); + std::shared_ptr<GraphModel> model(new GraphModel(uris(), path)); model->set_properties(properties); add_object(model); } else if (is_block) { @@ -310,7 +310,7 @@ ClientStore::operator()(const Put& msg) p = properties.find(_uris.ingen_prototype); } - SPtr<PluginModel> plug; + std::shared_ptr<PluginModel> plug; if (p->second.is_valid() && (p->second.type() == _uris.forge.URI || p->second.type() == _uris.forge.URID)) { const URI plugin_uri(_uris.forge.str(p->second, false)); @@ -322,7 +322,7 @@ ClientStore::operator()(const Put& msg) add_plugin(plug); } - SPtr<BlockModel> bm(new BlockModel(uris(), plug, path)); + std::shared_ptr<BlockModel> bm(new BlockModel(uris(), plug, path)); bm->set_properties(properties); add_object(bm); } else { @@ -338,7 +338,7 @@ ClientStore::operator()(const Put& msg) index = i->second.get<int32_t>(); } - SPtr<PortModel> p(new PortModel(uris(), path, index, pdir)); + std::shared_ptr<PortModel> p(new PortModel(uris(), path, index, pdir)); p->set_properties(properties); add_object(p); } else { @@ -362,7 +362,7 @@ ClientStore::operator()(const Delta& msg) const Raul::Path path(uri_to_path(uri)); - SPtr<ObjectModel> obj = _object(path); + std::shared_ptr<ObjectModel> obj = _object(path); if (obj) { obj->remove_properties(msg.remove); obj->add_properties(msg.add); @@ -383,7 +383,7 @@ ClientStore::operator()(const SetProperty& msg) predicate.c_str(), _uris.forge.str(value, false)); return; } - SPtr<Resource> subject = _resource(subject_uri); + std::shared_ptr<Resource> subject = _resource(subject_uri); if (subject) { if (predicate == _uris.ingen_activity) { /* Activity is transient, trigger any live actions (like GUI @@ -393,7 +393,7 @@ ClientStore::operator()(const SetProperty& msg) subject->set_property(predicate, value, msg.ctx); } } else { - SPtr<PluginModel> plugin = _plugin(subject_uri); + std::shared_ptr<PluginModel> plugin = _plugin(subject_uri); if (plugin) { plugin->set_property(predicate, value); } else if (predicate != _uris.ingen_activity) { @@ -403,11 +403,11 @@ ClientStore::operator()(const SetProperty& msg) } } -SPtr<GraphModel> +std::shared_ptr<GraphModel> ClientStore::connection_graph(const Raul::Path& tail_path, const Raul::Path& head_path) { - SPtr<GraphModel> graph; + std::shared_ptr<GraphModel> graph; if (tail_path.parent() == head_path.parent()) { graph = std::dynamic_pointer_cast<GraphModel>(_object(tail_path.parent())); @@ -441,8 +441,8 @@ ClientStore::attempt_connection(const Raul::Path& tail_path, auto head = std::dynamic_pointer_cast<PortModel>(_object(head_path)); if (tail && head) { - SPtr<GraphModel> graph = connection_graph(tail_path, head_path); - SPtr<ArcModel> arc(new ArcModel(tail, head)); + std::shared_ptr<GraphModel> graph = connection_graph(tail_path, head_path); + std::shared_ptr<ArcModel> arc(new ArcModel(tail, head)); graph->add_arc(arc); return true; } else { diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index b965258e..3bc08dfd 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -30,7 +30,7 @@ namespace ingen { namespace client { void -GraphModel::add_child(const SPtr<ObjectModel>& c) +GraphModel::add_child(const std::shared_ptr<ObjectModel>& c) { assert(c->parent().get() == this); @@ -47,7 +47,7 @@ GraphModel::add_child(const SPtr<ObjectModel>& c) } bool -GraphModel::remove_child(const SPtr<ObjectModel>& o) +GraphModel::remove_child(const std::shared_ptr<ObjectModel>& o) { assert(o->path().is_child_of(path())); assert(o->parent().get() == this); @@ -67,7 +67,7 @@ GraphModel::remove_child(const SPtr<ObjectModel>& o) } void -GraphModel::remove_arcs_on(const SPtr<PortModel>& p) +GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p) { // Remove any connections which referred to this object, // since they can't possibly exist anymore @@ -98,7 +98,7 @@ GraphModel::clear() assert(_ports.empty()); } -SPtr<ArcModel> +std::shared_ptr<ArcModel> GraphModel::get_arc(const Node* tail, const Node* head) { auto i = _arcs.find(std::make_pair(tail, head)); @@ -117,7 +117,7 @@ GraphModel::get_arc(const Node* tail, const Node* head) * this graph is a fatal error. */ void -GraphModel::add_arc(const SPtr<ArcModel>& arc) +GraphModel::add_arc(const std::shared_ptr<ArcModel>& arc) { // Store should have 'resolved' the connection already assert(arc); @@ -131,7 +131,7 @@ GraphModel::add_arc(const SPtr<ArcModel>& arc) assert(arc->head()->parent().get() == this || arc->head()->parent()->parent().get() == this); - SPtr<ArcModel> existing = get_arc( + std::shared_ptr<ArcModel> existing = get_arc( arc->tail().get(), arc->head().get()); if (existing) { diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 78337270..00da2c62 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -81,7 +81,7 @@ ObjectModel::polyphonic() const * `o` as correct. The paths of the two models MUST be equal. */ void -ObjectModel::set(const SPtr<ObjectModel>& o) +ObjectModel::set(const std::shared_ptr<ObjectModel>& o) { assert(_path == o->path()); if (o->_parent) { @@ -104,7 +104,7 @@ ObjectModel::set_path(const Raul::Path& p) } void -ObjectModel::set_parent(const SPtr<ObjectModel>& p) +ObjectModel::set_parent(const std::shared_ptr<ObjectModel>& p) { assert(_path.is_child_of(p->path())); _parent = p; diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index b3a9aecd..d2347027 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -27,6 +27,7 @@ #include <cctype> #include <cstring> #include <iosfwd> +#include <memory> #include <string> #include <utility> @@ -153,7 +154,7 @@ PluginModel::get_property(const URI& key) const } void -PluginModel::set(const SPtr<PluginModel>& p) +PluginModel::set(const std::shared_ptr<PluginModel>& p) { _type = p->_type; @@ -241,8 +242,9 @@ PluginModel::has_ui() const return false; } -SPtr<PluginUI> -PluginModel::ui(ingen::World& world, const SPtr<const BlockModel>& block) const +std::shared_ptr<PluginUI> +PluginModel::ui(ingen::World& world, + const std::shared_ptr<const BlockModel>& block) const { if (!_lilv_plugin) { return nullptr; diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index b0f92e41..122c2af6 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -25,6 +25,7 @@ #include "lv2/ui/ui.h" #include <cstring> +#include <memory> #include <string> #include <utility> @@ -33,7 +34,7 @@ namespace client { SuilHost* PluginUI::ui_host = nullptr; -static SPtr<const PortModel> +static std::shared_ptr<const PortModel> get_port(PluginUI* ui, uint32_t port_index) { if (port_index >= ui->block()->ports().size()) { @@ -52,9 +53,9 @@ lv2_ui_write(SuilController controller, uint32_t format, const void* buffer) { - auto* const ui = static_cast<PluginUI*>(controller); - const URIs& uris = ui->world().uris(); - SPtr<const PortModel> port = get_port(ui, port_index); + auto* const ui = static_cast<PluginUI*>(controller); + const URIs& uris = ui->world().uris(); + auto port = get_port(ui, port_index); if (!port) { return; } @@ -116,7 +117,7 @@ lv2_ui_subscribe(SuilController controller, const LV2_Feature* const* features) { auto* const ui = static_cast<PluginUI*>(controller); - SPtr<const PortModel> port = get_port(ui, port_index); + std::shared_ptr<const PortModel> port = get_port(ui, port_index); if (!port) { return 1; } @@ -136,8 +137,8 @@ lv2_ui_unsubscribe(SuilController controller, uint32_t protocol, const LV2_Feature* const* features) { - auto* const ui = static_cast<PluginUI*>(controller); - SPtr<const PortModel> port = get_port(ui, port_index); + auto* const ui = static_cast<PluginUI*>(controller); + auto port = get_port(ui, port_index); if (!port) { return 1; } @@ -151,18 +152,18 @@ lv2_ui_unsubscribe(SuilController controller, return 0; } -PluginUI::PluginUI(ingen::World& world, - SPtr<const BlockModel> block, - LilvUIs* uis, - const LilvUI* ui, - const LilvNode* ui_type) - : _world(world) - , _block(std::move(block)) - , _instance(nullptr) - , _uis(uis) - , _ui(ui) - , _ui_node(lilv_node_duplicate(lilv_ui_get_uri(ui))) - , _ui_type(lilv_node_duplicate(ui_type)) +PluginUI::PluginUI(ingen::World& world, + std::shared_ptr<const BlockModel> block, + LilvUIs* uis, + const LilvUI* ui, + const LilvNode* ui_type) + : _world(world) + , _block(std::move(block)) + , _instance(nullptr) + , _uis(uis) + , _ui(ui) + , _ui_node(lilv_node_duplicate(lilv_ui_get_uri(ui))) + , _ui_type(lilv_node_duplicate(ui_type)) { } @@ -178,10 +179,10 @@ PluginUI::~PluginUI() lilv_world_unload_resource(_world.lilv_world(), lilv_ui_get_uri(_ui)); } -SPtr<PluginUI> -PluginUI::create(ingen::World& world, - const SPtr<const BlockModel>& block, - const LilvPlugin* plugin) +std::shared_ptr<PluginUI> +PluginUI::create(ingen::World& world, + const std::shared_ptr<const BlockModel>& block, + const LilvPlugin* plugin) { if (!PluginUI::ui_host) { PluginUI::ui_host = suil_host_new(lv2_ui_write, @@ -215,7 +216,7 @@ PluginUI::create(ingen::World& world, } // Create the PluginUI, but don't instantiate yet - SPtr<PluginUI> ret(new PluginUI(world, block, uis, ui, ui_type)); + std::shared_ptr<PluginUI> ret(new PluginUI(world, block, uis, ui, ui_type)); ret->_features = world.lv2_features().lv2_features( world, const_cast<BlockModel*>(block.get())); diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index fe9bef2c..d58a2b49 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -66,7 +66,7 @@ PortModel::is_uri() const } void -PortModel::set(const SPtr<ObjectModel>& model) +PortModel::set(const std::shared_ptr<ObjectModel>& model) { ObjectModel::set(model); diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 76048edb..55787d44 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -112,7 +112,7 @@ App::~App() delete _window_factory; } -SPtr<App> +std::shared_ptr<App> App::create(ingen::World& world) { suil_init(&world.argc(), &world.argv(), SUIL_ARG_NONE); @@ -128,7 +128,7 @@ App::create(ingen::World& world) _main = new Gtk::Main(&world.argc(), &world.argv()); } - auto app = SPtr<App>{new App(world)}; + auto app = std::shared_ptr<App>(new App(world)); // Load configuration settings app->style()->load_settings(); @@ -160,7 +160,7 @@ App::run() } void -App::attach(const SPtr<ingen::Interface>& client) +App::attach(const std::shared_ptr<ingen::Interface>& client) { assert(!_client); assert(!_store); @@ -215,7 +215,7 @@ App::request_plugins_if_necessary() } } -SPtr<SigClientInterface> +std::shared_ptr<SigClientInterface> App::sig_client() { auto qi = std::dynamic_pointer_cast<QueuedInterface>(_client); @@ -225,7 +225,7 @@ App::sig_client() return std::dynamic_pointer_cast<SigClientInterface>(_client); } -SPtr<Serialiser> +std::shared_ptr<Serialiser> App::serialiser() { return _world.serialiser(); diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 0b504361..cef884d6 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -23,7 +23,6 @@ #include "ingen/Status.hpp" #include "ingen/World.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "raul/Deletable.hpp" @@ -74,7 +73,7 @@ public: void error_message(const std::string& str); - void attach(const SPtr<ingen::Interface>& client); + void attach(const std::shared_ptr<ingen::Interface>& client); void detach(); @@ -117,17 +116,17 @@ public: Style* style() const { return _style; } WindowFactory* window_factory() const { return _window_factory; } - ingen::Forge& forge() const { return _world.forge(); } - SPtr<ingen::Interface> interface() const { return _world.interface(); } - SPtr<ingen::Interface> client() const { return _client; } - SPtr<client::ClientStore> store() const { return _store; } - SPtr<ThreadedLoader> loader() const { return _loader; } + ingen::Forge& forge() const { return _world.forge(); } + std::shared_ptr<ingen::Interface> interface() const { return _world.interface(); } + std::shared_ptr<ingen::Interface> client() const { return _client; } + std::shared_ptr<client::ClientStore> store() const { return _store; } + std::shared_ptr<ThreadedLoader> loader() const { return _loader; } - SPtr<client::SigClientInterface> sig_client(); + std::shared_ptr<client::SigClientInterface> sig_client(); - SPtr<Serialiser> serialiser(); + std::shared_ptr<Serialiser> serialiser(); - static SPtr<App> create(ingen::World& world); + static std::shared_ptr<App> create(ingen::World& world); void run(); @@ -158,10 +157,10 @@ protected: static Gtk::Main* _main; - SPtr<ingen::Interface> _client; - SPtr<client::ClientStore> _store; - SPtr<ThreadedLoader> _loader; - SPtr<StreamWriter> _dumper; + std::shared_ptr<ingen::Interface> _client; + std::shared_ptr<client::ClientStore> _store; + std::shared_ptr<ThreadedLoader> _loader; + std::shared_ptr<StreamWriter> _dumper; Style* _style; diff --git a/src/gui/Arc.cpp b/src/gui/Arc.cpp index 02136770..60425ab9 100644 --- a/src/gui/Arc.cpp +++ b/src/gui/Arc.cpp @@ -26,14 +26,14 @@ namespace ingen { namespace gui { -Arc::Arc(Ganv::Canvas& canvas, - const SPtr<const client::ArcModel>& model, - Ganv::Node* src, - Ganv::Node* dst) +Arc::Arc(Ganv::Canvas& canvas, + const std::shared_ptr<const client::ArcModel>& model, + Ganv::Node* src, + Ganv::Node* dst) : Ganv::Edge(canvas, src, dst), _arc_model(model) { - SPtr<const client::ObjectModel> tparent = model->tail()->parent(); - SPtr<const client::BlockModel> tparent_block; + std::shared_ptr<const client::ObjectModel> tparent = model->tail()->parent(); + std::shared_ptr<const client::BlockModel> tparent_block; if ((tparent_block = std::dynamic_pointer_cast<const client::BlockModel>(tparent))) { if (tparent_block->plugin_uri() == NS_INTERNALS "BlockDelay") { g_object_set(_gobj, "dash-length", 4.0, nullptr); diff --git a/src/gui/Arc.hpp b/src/gui/Arc.hpp index a20c4e5f..ad40d6bf 100644 --- a/src/gui/Arc.hpp +++ b/src/gui/Arc.hpp @@ -18,9 +18,9 @@ #define INGEN_GUI_ARC_HPP #include "ganv/Edge.hpp" -#include "ingen/memory.hpp" #include <cassert> +#include <memory> namespace ingen { @@ -35,15 +35,15 @@ namespace gui { class Arc : public Ganv::Edge { public: - Arc(Ganv::Canvas& canvas, - const SPtr<const client::ArcModel>& model, - Ganv::Node* src, - Ganv::Node* dst); + Arc(Ganv::Canvas& canvas, + const std::shared_ptr<const client::ArcModel>& model, + Ganv::Node* src, + Ganv::Node* dst); - SPtr<const client::ArcModel> model() const { return _arc_model; } + std::shared_ptr<const client::ArcModel> model() const { return _arc_model; } private: - SPtr<const client::ArcModel> _arc_model; + std::shared_ptr<const client::ArcModel> _arc_model; }; } // namespace gui diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index b75c8670..d265443d 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -40,7 +40,7 @@ BreadCrumbs::BreadCrumbs(App& app) set_can_focus(false); } -SPtr<GraphView> +std::shared_ptr<GraphView> BreadCrumbs::view(const Raul::Path& path) { for (const auto& b : _breadcrumbs) { @@ -58,7 +58,8 @@ BreadCrumbs::view(const Raul::Path& path) * children preserved. */ void -BreadCrumbs::build(const Raul::Path& path, const SPtr<GraphView>& view) +BreadCrumbs::build(const Raul::Path& path, + const std::shared_ptr<GraphView>& view) { bool old_enable_signal = _enable_signal; _enable_signal = false; @@ -156,7 +157,8 @@ BreadCrumbs::build(const Raul::Path& path, const SPtr<GraphView>& view) * match, otherwise ignoring `view`. */ BreadCrumbs::BreadCrumb* -BreadCrumbs::create_crumb(const Raul::Path& path, const SPtr<GraphView>& view) +BreadCrumbs::create_crumb(const Raul::Path& path, + const std::shared_ptr<GraphView>& view) { BreadCrumb* but = manage(new BreadCrumb( path, ((view && path == view->graph()->path()) ? view : nullptr))); diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp index 6f42e573..6fcce24c 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -21,7 +21,6 @@ #include "ingen/Message.hpp" #include "ingen/client/GraphModel.hpp" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <gtkmm/box.h> @@ -30,6 +29,7 @@ #include <cassert> #include <list> +#include <memory> #include <string> namespace ingen { @@ -45,11 +45,12 @@ class BreadCrumbs : public Gtk::HBox public: explicit BreadCrumbs(App& app); - SPtr<GraphView> view(const Raul::Path& path); + std::shared_ptr<GraphView> view(const Raul::Path& path); - void build(const Raul::Path& path, const SPtr<GraphView>& view); + void build(const Raul::Path& path, const std::shared_ptr<GraphView>& view); - sigc::signal<void, const Raul::Path&, SPtr<GraphView> > signal_graph_selected; + sigc::signal<void, const Raul::Path&, std::shared_ptr<GraphView>> + signal_graph_selected; private: /** Breadcrumb button. @@ -64,10 +65,9 @@ private: class BreadCrumb : public Gtk::ToggleButton { public: - BreadCrumb(const Raul::Path& path, - const SPtr<GraphView>& view = nullptr) - : _path(path) - , _view(view) + BreadCrumb(const Raul::Path& path, + const std::shared_ptr<GraphView>& view = nullptr) + : _path(path), _view(view) { assert(!view || view->graph()->path() == path); set_border_width(0); @@ -76,13 +76,13 @@ private: show_all(); } - void set_view(const SPtr<GraphView>& view) { + void set_view(const std::shared_ptr<GraphView>& view) { assert(!view || view->graph()->path() == _path); _view = view; } - const Raul::Path& path() const { return _path; } - SPtr<GraphView> view() const { return _view; } + const Raul::Path& path() const { return _path; } + std::shared_ptr<GraphView> view() const { return _view; } void set_path(const Raul::Path& path) { remove(); @@ -98,12 +98,12 @@ private: } private: - Raul::Path _path; - SPtr<GraphView> _view; + Raul::Path _path; + std::shared_ptr<GraphView> _view; }; - BreadCrumb* create_crumb(const Raul::Path& path, - const SPtr<GraphView>& view = nullptr); + BreadCrumb* create_crumb(const Raul::Path& path, + const std::shared_ptr<GraphView>& view = nullptr); void breadcrumb_clicked(BreadCrumb* crumb); diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 3e5e5d7c..1afc8c6c 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -130,7 +130,7 @@ ConnectWindow::ingen_response(int32_t id, } void -ConnectWindow::set_connected_to(const SPtr<ingen::Interface>& engine) +ConnectWindow::set_connected_to(const std::shared_ptr<ingen::Interface>& engine) { _app->world().set_interface(engine); @@ -196,10 +196,10 @@ ConnectWindow::connect_remote(const URI& uri) { ingen::World& world = _app->world(); - SPtr<SigClientInterface> sci(new SigClientInterface()); - SPtr<QueuedInterface> qi(new QueuedInterface(sci)); + auto sci = std::make_shared<SigClientInterface>(); + auto qi = std::make_shared<QueuedInterface>(sci); - SPtr<ingen::Interface> iface(world.new_interface(uri, qi)); + std::shared_ptr<ingen::Interface> iface(world.new_interface(uri, qi)); if (iface) { world.set_interface(iface); _app->attach(qi); @@ -486,7 +486,7 @@ ConnectWindow::gtk_callback() if (ms_since_last >= 250) { last = now; if (_mode == Mode::INTERNAL) { - SPtr<SigClientInterface> client(new SigClientInterface()); + auto client = std::make_shared<SigClientInterface>(); _app->world().interface()->set_respondee(client); _app->attach(client); _app->register_callbacks(); diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index f350e97d..6d0b6f5a 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -20,7 +20,6 @@ #include "Window.hpp" #include "ingen/Message.hpp" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include <gtkmm/builder.h> @@ -33,6 +32,7 @@ #include <gtkmm/spinbutton.h> #include <cstdint> +#include <memory> #include <string> namespace ingen { @@ -57,7 +57,7 @@ public: ConnectWindow(BaseObjectType* cobject, Glib::RefPtr<Gtk::Builder> xml); - void set_connected_to(const SPtr<ingen::Interface>& engine); + void set_connected_to(const std::shared_ptr<ingen::Interface>& engine); void start(App& app, ingen::World& world); bool attached() const { return _finished_connecting; } diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 2f561959..557c4261 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -190,8 +190,8 @@ GraphBox::~GraphBox() delete _breadcrumbs; } -SPtr<GraphBox> -GraphBox::create(App& app, const SPtr<const GraphModel>& graph) +std::shared_ptr<GraphBox> +GraphBox::create(App& app, const std::shared_ptr<const GraphModel>& graph) { GraphBox* result = nullptr; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win"); @@ -204,7 +204,7 @@ GraphBox::create(App& app, const SPtr<const GraphModel>& graph) result->_menu_quit->set_sensitive(false); } - return SPtr<GraphBox>(result); + return std::shared_ptr<GraphBox>(result); } void @@ -244,8 +244,8 @@ GraphBox::set_status_text(const std::string& text) } void -GraphBox::set_graph_from_path(const Raul::Path& path, - const SPtr<GraphView>& view) +GraphBox::set_graph_from_path(const Raul::Path& path, + const std::shared_ptr<GraphView>& view) { if (view) { assert(view->graph()->path() == path); @@ -264,8 +264,8 @@ GraphBox::set_graph_from_path(const Raul::Path& path, * If `view` is null, a new view will be created. */ void -GraphBox::set_graph(const SPtr<const GraphModel>& graph, - const SPtr<GraphView>& view) +GraphBox::set_graph(const std::shared_ptr<const GraphModel>& graph, + const std::shared_ptr<GraphView>& view) { if (!graph || graph == _graph) { return; @@ -352,7 +352,7 @@ GraphBox::set_graph(const SPtr<const GraphModel>& graph, } void -GraphBox::graph_port_added(const SPtr<const PortModel>& port) +GraphBox::graph_port_added(const std::shared_ptr<const PortModel>& port) { if (port->is_input() && _app->can_control(port.get())) { _menu_view_control_window->property_sensitive() = true; @@ -360,7 +360,7 @@ GraphBox::graph_port_added(const SPtr<const PortModel>& port) } void -GraphBox::graph_port_removed(const SPtr<const PortModel>& port) +GraphBox::graph_port_removed(const std::shared_ptr<const PortModel>& port) { if (!(port->is_input() && _app->can_control(port.get()))) { return; diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index e2a1ce98..2bb04c54 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -17,7 +17,9 @@ #ifndef INGEN_GUI_GRAPH_BOX_HPP #define INGEN_GUI_GRAPH_BOX_HPP -#include <string> +#include "Window.hpp" + +#include "ingen/ingen.h" #include <gtkmm/alignment.h> #include <gtkmm/box.h> @@ -28,10 +30,8 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/statusbar.h> -#include "ingen/ingen.h" -#include "ingen/memory.hpp" - -#include "Window.hpp" +#include <memory> +#include <string> namespace Raul { class Path; @@ -70,36 +70,36 @@ public: ~GraphBox() override; - static SPtr<GraphBox> - create(App& app, const SPtr<const client::GraphModel>& graph); + static std::shared_ptr<GraphBox> + create(App& app, const std::shared_ptr<const client::GraphModel>& graph); void init_box(App& app); void set_status_text(const std::string& text); - void set_graph(const SPtr<const client::GraphModel>& graph, - const SPtr<GraphView>& view); + void set_graph(const std::shared_ptr<const client::GraphModel>& graph, + const std::shared_ptr<GraphView>& view); void set_window(GraphWindow* win) { _window = win; } bool documentation_is_visible() { return _doc_scrolledwindow->is_visible(); } void set_documentation(const std::string& doc, bool html); - SPtr<const client::GraphModel> graph() const { return _graph; } - SPtr<GraphView> view() const { return _view; } + std::shared_ptr<const client::GraphModel> graph() const { return _graph; } + std::shared_ptr<GraphView> view() const { return _view; } void show_port_status(const client::PortModel* port, const Atom& value); - void - set_graph_from_path(const Raul::Path& path, const SPtr<GraphView>& view); + void set_graph_from_path(const Raul::Path& path, + const std::shared_ptr<GraphView>& view); void object_entered(const client::ObjectModel* model); void object_left(const client::ObjectModel* model); private: - void graph_port_added(const SPtr<const client::PortModel>& port); - void graph_port_removed(const SPtr<const client::PortModel>& port); + void graph_port_added(const std::shared_ptr<const client::PortModel>& port); + void graph_port_removed(const std::shared_ptr<const client::PortModel>& port); void property_changed(const URI& predicate, const Atom& value); void show_status(const client::ObjectModel* model); @@ -144,10 +144,10 @@ private: void event_show_engine(); void event_clipboard_changed(GdkEventOwnerChange* ev); - App* _app = nullptr; - SPtr<const client::GraphModel> _graph; - SPtr<GraphView> _view; - GraphWindow* _window = nullptr; + App* _app = nullptr; + std::shared_ptr<const client::GraphModel> _graph; + std::shared_ptr<GraphView> _view; + GraphWindow* _window = nullptr; sigc::connection new_port_connection; sigc::connection removed_port_connection; diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 688e034b..23a3ecf5 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -74,17 +74,17 @@ port_order(const GanvPort* a, const GanvPort* b, void* data) return 0; } -GraphCanvas::GraphCanvas(App& app, - SPtr<const GraphModel> graph, - int width, - int height) - : Canvas(width, height) - , _app(app) - , _graph(std::move(graph)) - , _auto_position_count(0) - , _menu_x(0) - , _menu_y(0) - , _paste_count(0) +GraphCanvas::GraphCanvas(App& app, + std::shared_ptr<const GraphModel> graph, + int width, + int height) + : Canvas(width, height) + , _app(app) + , _graph(std::move(graph)) + , _auto_position_count(0) + , _menu_x(0) + , _menu_y(0) + , _paste_count(0) { Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("canvas_menu"); xml->get_widget("canvas_menu", _menu); @@ -303,7 +303,7 @@ GraphCanvas::show_port_names(bool b) } void -GraphCanvas::add_plugin(const SPtr<PluginModel>& p) +GraphCanvas::add_plugin(const std::shared_ptr<PluginModel>& p) { if (_internal_menu && _app.uris().ingen_Internal == p->type()) { _internal_menu->items().push_back( @@ -323,7 +323,7 @@ GraphCanvas::remove_plugin(const URI& uri) } void -GraphCanvas::add_block(const SPtr<const BlockModel>& bm) +GraphCanvas::add_block(const std::shared_ptr<const BlockModel>& bm) { auto pm = std::dynamic_pointer_cast<const GraphModel>(bm); NodeModule* module = nullptr; @@ -341,7 +341,7 @@ GraphCanvas::add_block(const SPtr<const BlockModel>& bm) } void -GraphCanvas::remove_block(const SPtr<const BlockModel>& bm) +GraphCanvas::remove_block(const std::shared_ptr<const BlockModel>& bm) { auto i = _views.find(bm); @@ -356,7 +356,7 @@ GraphCanvas::remove_block(const SPtr<const BlockModel>& bm) } void -GraphCanvas::add_port(const SPtr<const PortModel>& pm) +GraphCanvas::add_port(const std::shared_ptr<const PortModel>& pm) { GraphPortModule* view = GraphPortModule::create(*this, pm); _views.emplace(pm, view); @@ -364,7 +364,7 @@ GraphCanvas::add_port(const SPtr<const PortModel>& pm) } void -GraphCanvas::remove_port(const SPtr<const PortModel>& pm) +GraphCanvas::remove_port(const std::shared_ptr<const PortModel>& pm) { auto i = _views.find(pm); @@ -382,7 +382,7 @@ GraphCanvas::remove_port(const SPtr<const PortModel>& pm) } Ganv::Port* -GraphCanvas::get_port_view(const SPtr<PortModel>& port) +GraphCanvas::get_port_view(const std::shared_ptr<PortModel>& port) { Ganv::Module* module = _views[port]; @@ -409,7 +409,7 @@ GraphCanvas::get_port_view(const SPtr<PortModel>& port) /** Called when a connection is added to the model. */ void -GraphCanvas::connection(const SPtr<const ArcModel>& arc) +GraphCanvas::connection(const std::shared_ptr<const ArcModel>& arc) { Ganv::Port* const tail = get_port_view(arc->tail()); Ganv::Port* const head = get_port_view(arc->head()); @@ -424,7 +424,7 @@ GraphCanvas::connection(const SPtr<const ArcModel>& arc) /** Called when a connection is removed from the model. */ void -GraphCanvas::disconnection(const SPtr<const ArcModel>& arc) +GraphCanvas::disconnection(const std::shared_ptr<const ArcModel>& arc) { Ganv::Port* const tail = get_port_view(arc->tail()); Ganv::Port* const head = get_port_view(arc->head()); @@ -664,7 +664,7 @@ GraphCanvas::paste() std::lock_guard<std::mutex> lock(_app.world().rdf_mutex()); const Glib::ustring str = Gtk::Clipboard::get()->wait_for_text(); - SPtr<Parser> parser = _app.loader()->parser(); + auto parser = _app.loader()->parser(); const URIs& uris = _app.uris(); const Raul::Path& parent = _graph->path(); if (!parser) { @@ -732,10 +732,11 @@ GraphCanvas::paste() continue; } - const SPtr<Node> node = c.second; + const auto node = c.second; const Raul::Path& old_path = copy_root.child(node->path()); const URI& old_uri = path_to_uri(old_path); - const Raul::Path& new_path = avoider.map_path(parent.child(node->path())); + const Raul::Path& new_path = + avoider.map_path(parent.child(node->path())); // Copy properties, except those that should not be inherited in copies Properties props = node->properties(); @@ -839,7 +840,7 @@ GraphCanvas::menu_add_port(const string& sym_base, void GraphCanvas::load_plugin(const std::weak_ptr<PluginModel>& weak_plugin) { - SPtr<PluginModel> plugin = weak_plugin.lock(); + auto plugin = weak_plugin.lock(); if (!plugin) { return; } diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index f8b4d432..ffeac64d 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -23,11 +23,11 @@ #include "ganv/Module.hpp" #include "ingen/Node.hpp" #include "ingen/client/ArcModel.hpp" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "raul/Path.hpp" #include <map> +#include <memory> #include <set> #include <string> @@ -47,10 +47,10 @@ class PluginMenu; class GraphCanvas : public Ganv::Canvas { public: - GraphCanvas(App& app, - SPtr<const client::GraphModel> graph, - int width, - int height); + GraphCanvas(App& app, + std::shared_ptr<const client::GraphModel> graph, + int width, + int height); ~GraphCanvas() override = default; @@ -61,14 +61,14 @@ public: void show_port_names(bool b); bool show_port_names() const { return _show_port_names; } - void add_plugin(const SPtr<client::PluginModel>& p); + void add_plugin(const std::shared_ptr<client::PluginModel>& p); void remove_plugin(const URI& uri); - void add_block(const SPtr<const client::BlockModel>& bm); - void remove_block(const SPtr<const client::BlockModel>& bm); - void add_port(const SPtr<const client::PortModel>& pm); - void remove_port(const SPtr<const client::PortModel>& pm); - void connection(const SPtr<const client::ArcModel>& arc); - void disconnection(const SPtr<const client::ArcModel>& arc); + void add_block(const std::shared_ptr<const client::BlockModel>& bm); + void remove_block(const std::shared_ptr<const client::BlockModel>& bm); + void add_port(const std::shared_ptr<const client::PortModel>& pm); + void remove_port(const std::shared_ptr<const client::PortModel>& pm); + void connection(const std::shared_ptr<const client::ArcModel>& arc); + void disconnection(const std::shared_ptr<const client::ArcModel>& arc); void get_new_module_location(double& x, double& y); @@ -106,7 +106,7 @@ private: Properties get_initial_data(Resource::Graph ctx=Resource::Graph::DEFAULT); - Ganv::Port* get_port_view(const SPtr<client::PortModel>& port); + Ganv::Port* get_port_view(const std::shared_ptr<client::PortModel>& port); void connect(Ganv::Node* tail, Ganv::Node* head); @@ -114,10 +114,10 @@ private: void disconnect(Ganv::Node* tail, Ganv::Node* head); - App& _app; - SPtr<const client::GraphModel> _graph; + App& _app; + std::shared_ptr<const client::GraphModel> _graph; - using Views = std::map<SPtr<const client::ObjectModel>, Ganv::Module*>; + using Views = std::map<std::shared_ptr<const client::ObjectModel>, Ganv::Module*>; Views _views; int _auto_position_count; diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index a602f2f0..750a9e5a 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -41,11 +41,12 @@ using namespace client; namespace gui { -GraphPortModule::GraphPortModule(GraphCanvas& canvas, - const SPtr<const client::PortModel>& model) - : Ganv::Module(canvas, "", 0, 0, false) // FIXME: coords? - , _model(model) - , _port(nullptr) +GraphPortModule::GraphPortModule( + GraphCanvas& canvas, + const std::shared_ptr<const client::PortModel>& model) + : Ganv::Module(canvas, "", 0, 0, false) // FIXME: coords? + , _model(model) + , _port(nullptr) { assert(model); @@ -64,7 +65,8 @@ GraphPortModule::GraphPortModule(GraphCanvas& canvas, } GraphPortModule* -GraphPortModule::create(GraphCanvas& canvas, const SPtr<const PortModel>& model) +GraphPortModule::create(GraphCanvas& canvas, + const std::shared_ptr<const PortModel>& model) { auto* ret = new GraphPortModule(canvas, model); Port* port = Port::create(canvas.app(), *ret, model, true); diff --git a/src/gui/GraphPortModule.hpp b/src/gui/GraphPortModule.hpp index 2bc5111b..06e40dff 100644 --- a/src/gui/GraphPortModule.hpp +++ b/src/gui/GraphPortModule.hpp @@ -21,6 +21,7 @@ #include "ganv/Module.hpp" +#include <memory> #include <string> namespace ingen { @@ -46,7 +47,8 @@ class GraphPortModule : public Ganv::Module { public: static GraphPortModule* - create(GraphCanvas& canvas, const SPtr<const client::PortModel>& model); + create(GraphCanvas& canvas, + const std::shared_ptr<const client::PortModel>& model); App& app() const; @@ -55,11 +57,11 @@ public: void set_name(const std::string& n); - SPtr<const client::PortModel> port() const { return _model; } + std::shared_ptr<const client::PortModel> port() const { return _model; } protected: - GraphPortModule(GraphCanvas& canvas, - const SPtr<const client::PortModel>& model); + GraphPortModule(GraphCanvas& canvas, + const std::shared_ptr<const client::PortModel>& model); bool show_menu(GdkEventButton* ev); void set_selected(gboolean b) override; @@ -68,8 +70,8 @@ protected: void property_changed(const URI& key, const Atom& value); - SPtr<const client::PortModel> _model; - Port* _port; + std::shared_ptr<const client::PortModel> _model; + Port* _port; }; } // namespace gui diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 4242c69e..0406184a 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -75,7 +75,7 @@ GraphTreeWindow::init(App& app, ClientStore& store) } void -GraphTreeWindow::new_object(const SPtr<ObjectModel>& object) +GraphTreeWindow::new_object(const std::shared_ptr<ObjectModel>& object) { auto graph = std::dynamic_pointer_cast<GraphModel>(object); if (graph) { @@ -84,7 +84,7 @@ GraphTreeWindow::new_object(const SPtr<ObjectModel>& object) } void -GraphTreeWindow::add_graph(const SPtr<GraphModel>& pm) +GraphTreeWindow::add_graph(const std::shared_ptr<GraphModel>& pm) { if (!pm->parent()) { Gtk::TreeModel::iterator iter = _graph_treestore->append(); @@ -125,7 +125,7 @@ GraphTreeWindow::add_graph(const SPtr<GraphModel>& pm) } void -GraphTreeWindow::remove_graph(const SPtr<GraphModel>& pm) +GraphTreeWindow::remove_graph(const std::shared_ptr<GraphModel>& pm) { Gtk::TreeModel::iterator i = find_graph(_graph_treestore->children(), pm); if (i != _graph_treestore->children().end()) { @@ -134,11 +134,11 @@ GraphTreeWindow::remove_graph(const SPtr<GraphModel>& pm) } Gtk::TreeModel::iterator -GraphTreeWindow::find_graph(Gtk::TreeModel::Children root, - const SPtr<client::ObjectModel>& graph) +GraphTreeWindow::find_graph(Gtk::TreeModel::Children root, + const std::shared_ptr<client::ObjectModel>& graph) { for (Gtk::TreeModel::iterator c = root.begin(); c != root.end(); ++c) { - SPtr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col]; + std::shared_ptr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col]; if (graph == pm) { return c; } else if (!(*c)->children().empty()) { @@ -158,8 +158,8 @@ GraphTreeWindow::show_graph_menu(GdkEventButton* ev) { Gtk::TreeModel::iterator active = _graph_tree_selection->get_selected(); if (active) { - Gtk::TreeModel::Row row = *active; - SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; + Gtk::TreeModel::Row row = *active; + std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; if (pm) { _app->log().warn("TODO: graph menu from tree window"); } @@ -170,9 +170,9 @@ void GraphTreeWindow::event_graph_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col) { - Gtk::TreeModel::iterator active = _graph_treestore->get_iter(path); - Gtk::TreeModel::Row row = *active; - SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; + Gtk::TreeModel::iterator active = _graph_treestore->get_iter(path); + Gtk::TreeModel::Row row = *active; + std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; _app->window_factory()->present_graph(pm); } @@ -180,11 +180,11 @@ GraphTreeWindow::event_graph_activated(const Gtk::TreeModel::Path& path, void GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) { - Gtk::TreeModel::Path path(path_str); + Gtk::TreeModel::Path path(path_str); Gtk::TreeModel::iterator active = _graph_treestore->get_iter(path); - Gtk::TreeModel::Row row = *active; + Gtk::TreeModel::Row row = *active; - SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; + std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; assert(pm); if (_enable_signal) { @@ -195,9 +195,10 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) } void -GraphTreeWindow::graph_property_changed(const URI& key, - const Atom& value, - const SPtr<GraphModel>& graph) +GraphTreeWindow::graph_property_changed( + const URI& key, + const Atom& value, + const std::shared_ptr<GraphModel>& graph) { const URIs& uris = _app->uris(); _enable_signal = false; @@ -214,7 +215,7 @@ GraphTreeWindow::graph_property_changed(const URI& key, } void -GraphTreeWindow::graph_moved(const SPtr<GraphModel>& graph) +GraphTreeWindow::graph_moved(const std::shared_ptr<GraphModel>& graph) { _enable_signal = false; diff --git a/src/gui/GraphTreeWindow.hpp b/src/gui/GraphTreeWindow.hpp index 2c988817..9e11b15d 100644 --- a/src/gui/GraphTreeWindow.hpp +++ b/src/gui/GraphTreeWindow.hpp @@ -47,16 +47,17 @@ public: void init(App& app, client::ClientStore& store); - void new_object(const SPtr<client::ObjectModel>& object); + void new_object(const std::shared_ptr<client::ObjectModel>& object); - void graph_property_changed(const URI& key, - const Atom& value, - const SPtr<client::GraphModel>& graph); + void + graph_property_changed(const URI& key, + const Atom& value, + const std::shared_ptr<client::GraphModel>& graph); - void graph_moved(const SPtr<client::GraphModel>& graph); + void graph_moved(const std::shared_ptr<client::GraphModel>& graph); - void add_graph(const SPtr<client::GraphModel>& pm); - void remove_graph(const SPtr<client::GraphModel>& pm); + void add_graph(const std::shared_ptr<client::GraphModel>& pm); + void remove_graph(const std::shared_ptr<client::GraphModel>& pm); void show_graph_menu(GdkEventButton* ev); protected: @@ -65,9 +66,9 @@ protected: void event_graph_enabled_toggled(const Glib::ustring& path_str); - Gtk::TreeModel::iterator find_graph( - Gtk::TreeModel::Children root, - const SPtr<client::ObjectModel>& graph); + Gtk::TreeModel::iterator + find_graph(Gtk::TreeModel::Children root, + const std::shared_ptr<client::ObjectModel>& graph); GraphTreeView* _graphs_treeview; @@ -79,9 +80,9 @@ protected: add(graph_model_col); } - Gtk::TreeModelColumn<Glib::ustring> name_col; - Gtk::TreeModelColumn<bool> enabled_col; - Gtk::TreeModelColumn<SPtr<client::GraphModel> > graph_model_col; + Gtk::TreeModelColumn<Glib::ustring> name_col; + Gtk::TreeModelColumn<bool> enabled_col; + Gtk::TreeModelColumn<std::shared_ptr<client::GraphModel>> graph_model_col; }; GraphTreeModelColumns _graph_tree_columns; diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index c9191a37..88b3d6fe 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -64,7 +64,7 @@ GraphView::init(App& app) } void -GraphView::set_graph(const SPtr<const GraphModel>& graph) +GraphView::set_graph(const std::shared_ptr<const GraphModel>& graph) { assert(!_canvas); // FIXME: remove @@ -98,8 +98,8 @@ GraphView::set_graph(const SPtr<const GraphModel>& graph) _canvas->widget().grab_focus(); } -SPtr<GraphView> -GraphView::create(App& app, const SPtr<const GraphModel>& graph) +std::shared_ptr<GraphView> +GraphView::create(App& app, const std::shared_ptr<const GraphModel>& graph) { GraphView* result = nullptr; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win"); @@ -111,7 +111,7 @@ GraphView::create(App& app, const SPtr<const GraphModel>& graph) result->init(app); result->set_graph(graph); - return SPtr<GraphView>(result); + return std::shared_ptr<GraphView>(result); } void diff --git a/src/gui/GraphView.hpp b/src/gui/GraphView.hpp index 0a4a6d21..29571b67 100644 --- a/src/gui/GraphView.hpp +++ b/src/gui/GraphView.hpp @@ -17,8 +17,6 @@ #ifndef INGEN_GUI_GRAPHVIEW_HPP #define INGEN_GUI_GRAPHVIEW_HPP -#include "ingen/memory.hpp" - #include <gtkmm/box.h> #include <gtkmm/builder.h> #include <gtkmm/scrolledwindow.h> @@ -28,6 +26,8 @@ #include <gtkmm/toolitem.h> #include <gtkmm/toolitem.h> +#include <memory> + namespace ingen { class Atom; @@ -63,15 +63,19 @@ public: void init(App& app); - SPtr<GraphCanvas> canvas() const { return _canvas; } - SPtr<const client::GraphModel> graph() const { return _graph; } - Gtk::ToolItem* breadcrumb_container() const { return _breadcrumb_container; } + std::shared_ptr<GraphCanvas> canvas() const { return _canvas; } + std::shared_ptr<const client::GraphModel> graph() const { return _graph; } + + Gtk::ToolItem* breadcrumb_container() const + { + return _breadcrumb_container; + } - static SPtr<GraphView> - create(App& app, const SPtr<const client::GraphModel>& graph); + static std::shared_ptr<GraphView> + create(App& app, const std::shared_ptr<const client::GraphModel>& graph); private: - void set_graph(const SPtr<const client::GraphModel>& graph); + void set_graph(const std::shared_ptr<const client::GraphModel>& graph); void process_toggled(); void poly_changed(); @@ -81,8 +85,8 @@ private: App* _app = nullptr; - SPtr<const client::GraphModel> _graph; - SPtr<GraphCanvas> _canvas; + std::shared_ptr<const client::GraphModel> _graph; + std::shared_ptr<GraphCanvas> _canvas; Gtk::ScrolledWindow* _canvas_scrolledwindow = nullptr; Gtk::Toolbar* _toolbar = nullptr; diff --git a/src/gui/GraphWindow.hpp b/src/gui/GraphWindow.hpp index 795f0925..96775d82 100644 --- a/src/gui/GraphWindow.hpp +++ b/src/gui/GraphWindow.hpp @@ -20,10 +20,9 @@ #include "GraphBox.hpp" #include "Window.hpp" -#include "ingen/memory.hpp" - #include <gtkmm/builder.h> +#include <memory> #include <string> namespace ingen { @@ -48,8 +47,12 @@ public: void init_window(App& app) override; - SPtr<const client::GraphModel> graph() const { return _box->graph(); } - GraphBox* box() const { return _box; } + std::shared_ptr<const client::GraphModel> graph() const + { + return _box->graph(); + } + + GraphBox* box() const { return _box; } bool documentation_is_visible() { return _box->documentation_is_visible(); } diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index d1b2cfd9..5b8bf84f 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -32,6 +32,7 @@ #include <glibmm/miscutils.h> #include <list> +#include <memory> #include <ostream> #include <string> #include <utility> @@ -95,9 +96,9 @@ LoadGraphWindow::LoadGraphWindow(BaseObjectType* cobject, } void -LoadGraphWindow::present(const SPtr<const GraphModel>& graph, - bool import, - const Properties& data) +LoadGraphWindow::present(const std::shared_ptr<const GraphModel>& graph, + bool import, + const Properties& data) { _import = import; set_graph(graph); @@ -115,7 +116,7 @@ LoadGraphWindow::present(const SPtr<const GraphModel>& graph, * This function MUST be called before using the window in any way! */ void -LoadGraphWindow::set_graph(const SPtr<const GraphModel>& graph) +LoadGraphWindow::set_graph(const std::shared_ptr<const GraphModel>& graph) { _graph = graph; _symbol_entry->set_text(""); diff --git a/src/gui/LoadGraphWindow.hpp b/src/gui/LoadGraphWindow.hpp index 7b26eb7d..ab287578 100644 --- a/src/gui/LoadGraphWindow.hpp +++ b/src/gui/LoadGraphWindow.hpp @@ -18,7 +18,6 @@ #define INGEN_GUI_LOADGRAPHWINDOW_HPP #include "ingen/Node.hpp" -#include "ingen/memory.hpp" #include <gtkmm/builder.h> #include <gtkmm/button.h> @@ -50,11 +49,11 @@ public: void init(App& app) { _app = &app; } - void set_graph(const SPtr<const client::GraphModel>& graph); + void set_graph(const std::shared_ptr<const client::GraphModel>& graph); - void present(const SPtr<const client::GraphModel>& graph, - bool import, - const Properties& data); + void present(const std::shared_ptr<const client::GraphModel>& graph, + bool import, + const Properties& data); protected: void on_show() override; @@ -74,7 +73,7 @@ private: Properties _initial_data; - SPtr<const client::GraphModel> _graph; + std::shared_ptr<const client::GraphModel> _graph; Gtk::Label* _symbol_label = nullptr; Gtk::Entry* _symbol_entry = nullptr; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 41702884..134cde1b 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -28,6 +28,7 @@ #include <algorithm> #include <cassert> #include <cstddef> +#include <memory> #include <string> using std::string; @@ -122,8 +123,8 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, } void -LoadPluginWindow::present(const SPtr<const GraphModel>& graph, - const Properties& data) +LoadPluginWindow::present(const std::shared_ptr<const GraphModel>& graph, + const Properties& data) { set_graph(graph); _initial_data = data; @@ -161,7 +162,7 @@ LoadPluginWindow::name_cleared(Gtk::EntryIconPosition pos, const GdkEventButton* * This function MUST be called before using the window in any way! */ void -LoadPluginWindow::set_graph(const SPtr<const GraphModel>& graph) +LoadPluginWindow::set_graph(const std::shared_ptr<const GraphModel>& graph) { if (_graph) { _graph = graph; @@ -196,7 +197,8 @@ LoadPluginWindow::on_show() } void -LoadPluginWindow::set_plugins(const SPtr<const ClientStore::Plugins>& plugins) +LoadPluginWindow::set_plugins( + const std::shared_ptr<const ClientStore::Plugins>& plugins) { _rows.clear(); _plugins_liststore->clear(); @@ -210,7 +212,7 @@ LoadPluginWindow::set_plugins(const SPtr<const ClientStore::Plugins>& plugins) } void -LoadPluginWindow::new_plugin(const SPtr<const PluginModel>& pm) +LoadPluginWindow::new_plugin(const std::shared_ptr<const PluginModel>& pm) { if (is_visible()) { add_plugin(pm); @@ -220,7 +222,7 @@ LoadPluginWindow::new_plugin(const SPtr<const PluginModel>& pm) } static std::string -get_project_name(const SPtr<const PluginModel>& plugin) +get_project_name(const std::shared_ptr<const PluginModel>& plugin) { std::string name; if (plugin->lilv_plugin()) { @@ -246,7 +248,7 @@ get_project_name(const SPtr<const PluginModel>& plugin) } static std::string -get_author_name(const SPtr<const PluginModel>& plugin) +get_author_name(const std::shared_ptr<const PluginModel>& plugin) { std::string name; if (plugin->lilv_plugin()) { @@ -260,8 +262,8 @@ get_author_name(const SPtr<const PluginModel>& plugin) } void -LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, - const SPtr<const PluginModel>& plugin) +LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, + const std::shared_ptr<const PluginModel>& plugin) { const URIs& uris = _app->uris(); const Atom& name = plugin->get_property(uris.doap_name); @@ -291,7 +293,7 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, } void -LoadPluginWindow::add_plugin(const SPtr<const PluginModel>& plugin) +LoadPluginWindow::add_plugin(const std::shared_ptr<const PluginModel>& plugin) { if (plugin->lilv_plugin() && lilv_plugin_is_replaced(plugin->lilv_plugin())) { return; @@ -330,8 +332,7 @@ LoadPluginWindow::plugin_selection_changed() *_selection->get_selected_rows().begin()); if (iter) { Gtk::TreeModel::Row row = *iter; - SPtr<const PluginModel> p = row.get_value( - _plugins_columns._col_plugin); + auto p = row.get_value(_plugins_columns._col_plugin); _name_offset = _app->store()->child_name_offset( _graph->path(), p->default_block_symbol()); _name_entry->set_text(generate_module_name(p, _name_offset)); @@ -354,8 +355,9 @@ LoadPluginWindow::plugin_selection_changed() * sends the notification back. */ string -LoadPluginWindow::generate_module_name(const SPtr<const PluginModel>& plugin, - int offset) +LoadPluginWindow::generate_module_name( + const std::shared_ptr<const PluginModel>& plugin, + int offset) { std::stringstream ss; ss << plugin->default_block_symbol(); @@ -368,11 +370,11 @@ LoadPluginWindow::generate_module_name(const SPtr<const PluginModel>& plugin, void LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) { - const URIs& uris = _app->uris(); - Gtk::TreeModel::Row row = *iter; - SPtr<const PluginModel> plugin = row.get_value(_plugins_columns._col_plugin); - bool polyphonic = _polyphonic_checkbutton->get_active(); - string name = _name_entry->get_text(); + const URIs& uris = _app->uris(); + Gtk::TreeModel::Row row = *iter; + auto plugin = row.get_value(_plugins_columns._col_plugin); + bool polyphonic = _polyphonic_checkbutton->get_active(); + string name = _name_entry->get_text(); if (name.empty()) { name = generate_module_name(plugin, _name_offset); diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index b9cfaf28..cd1bec8a 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -21,7 +21,6 @@ #include "ingen/Node.hpp" #include "ingen/client/ClientStore.hpp" -#include "ingen/memory.hpp" #include "ingen_config.h" #include <gtkmm/builder.h> @@ -31,6 +30,7 @@ #include <gtkmm/treeview.h> #include <map> +#include <memory> #include <string> namespace ingen { @@ -54,14 +54,15 @@ public: LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void set_graph(const SPtr<const client::GraphModel>& graph); + void set_graph(const std::shared_ptr<const client::GraphModel>& graph); - void set_plugins(const SPtr<const client::ClientStore::Plugins>& plugins); + void set_plugins( + const std::shared_ptr<const client::ClientStore::Plugins>& plugins); - void add_plugin(const SPtr<const client::PluginModel>& plugin); + void add_plugin(const std::shared_ptr<const client::PluginModel>& plugin); - void present(const SPtr<const client::GraphModel>& graph, - const Properties& data); + void present(const std::shared_ptr<const client::GraphModel>& graph, + const Properties& data); protected: void on_show() override; @@ -87,7 +88,7 @@ private: Gtk::TreeModelColumn<Glib::ustring> _col_uri; // Not displayed: - Gtk::TreeModelColumn< SPtr<const client::PluginModel> > _col_plugin; + Gtk::TreeModelColumn<std::shared_ptr<const client::PluginModel>> _col_plugin; }; /** Column for the filter criteria combo box. */ @@ -110,10 +111,10 @@ private: void name_changed(); void name_cleared(Gtk::EntryIconPosition pos, const GdkEventButton* event); - void set_row(Gtk::TreeModel::Row& row, - const SPtr<const client::PluginModel>& plugin); + void set_row(Gtk::TreeModel::Row& row, + const std::shared_ptr<const client::PluginModel>& plugin); - void new_plugin(const SPtr<const client::PluginModel>& pm); + void new_plugin(const std::shared_ptr<const client::PluginModel>& pm); void plugin_property_changed(const URI& plugin, const URI& predicate, @@ -122,15 +123,15 @@ private: void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); void plugin_selection_changed(); - static std::string - generate_module_name(const SPtr<const client::PluginModel>& plugin, - int offset = 0); + static std::string generate_module_name( + const std::shared_ptr<const client::PluginModel>& plugin, + int offset = 0); void load_plugin(const Gtk::TreeModel::iterator& iter); Properties _initial_data; - SPtr<const client::GraphModel> _graph; + std::shared_ptr<const client::GraphModel> _graph; using Rows = std::map<URI, Gtk::TreeModel::iterator>; Rows _rows; diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index 228bd91c..cd803e6d 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -49,8 +49,8 @@ NewSubgraphWindow::NewSubgraphWindow(BaseObjectType* cobject, } void -NewSubgraphWindow::present(SPtr<const client::GraphModel> graph, - Properties data) +NewSubgraphWindow::present(std::shared_ptr<const client::GraphModel> graph, + Properties data) { set_graph(graph); _initial_data = data; @@ -62,7 +62,7 @@ NewSubgraphWindow::present(SPtr<const client::GraphModel> graph, * This function MUST be called before using the window in any way! */ void -NewSubgraphWindow::set_graph(SPtr<const client::GraphModel> graph) +NewSubgraphWindow::set_graph(std::shared_ptr<const client::GraphModel> graph) { _graph = graph; } diff --git a/src/gui/NewSubgraphWindow.hpp b/src/gui/NewSubgraphWindow.hpp index 69c35d05..16cf2a21 100644 --- a/src/gui/NewSubgraphWindow.hpp +++ b/src/gui/NewSubgraphWindow.hpp @@ -20,7 +20,6 @@ #include "Window.hpp" #include "ingen/Node.hpp" -#include "ingen/memory.hpp" #include <gtkmm/builder.h> #include <gtkmm/button.h> @@ -28,6 +27,8 @@ #include <gtkmm/label.h> #include <gtkmm/spinbutton.h> +#include <memory> + namespace ingen { namespace client { class GraphModel; } @@ -46,18 +47,18 @@ public: NewSubgraphWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void set_graph(SPtr<const client::GraphModel> graph); + void set_graph(std::shared_ptr<const client::GraphModel> graph); - void present(SPtr<const client::GraphModel> graph, - Properties data); + void + present(std::shared_ptr<const client::GraphModel> graph, Properties data); private: void name_changed(); void ok_clicked(); void cancel_clicked(); - Properties _initial_data; - SPtr<const client::GraphModel> _graph; + Properties _initial_data; + std::shared_ptr<const client::GraphModel> _graph; Gtk::Entry* _name_entry; Gtk::Label* _message_label; diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 3e9057fc..6c9cf5ce 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -35,6 +35,7 @@ #include <gtkmm/stock.h> #include <cstdint> +#include <memory> #include <string> #include <utility> @@ -56,7 +57,7 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, } void -NodeMenu::init(App& app, SPtr<const client::BlockModel> block) +NodeMenu::init(App& app, std::shared_ptr<const client::BlockModel> block) { ObjectMenu::init(app, block); @@ -71,7 +72,7 @@ NodeMenu::init(App& app, SPtr<const client::BlockModel> block) _randomize_menuitem->signal_activate().connect( sigc::mem_fun(this, &NodeMenu::on_menu_randomize)); - SPtr<PluginModel> plugin = block->plugin_model(); + auto plugin = block->plugin_model(); if (plugin) { // Get the plugin to receive related presets _preset_connection = plugin->signal_preset().connect( @@ -172,7 +173,7 @@ NodeMenu::on_menu_randomize() { _app->interface()->bundle_begin(); - const SPtr<const BlockModel> bm = block(); + const auto bm = block(); for (const auto& p : bm->ports()) { if (p->is_input() && _app->can_control(p.get())) { float min = 0.0f; diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index a997e03f..b35919eb 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -20,7 +20,6 @@ #include "ObjectMenu.hpp" #include "ingen/client/BlockModel.hpp" -#include "ingen/memory.hpp" #include <gtkmm/builder.h> #include <gtkmm/menu.h> @@ -42,7 +41,7 @@ public: NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void init(App& app, SPtr<const client::BlockModel> block); + void init(App& app, std::shared_ptr<const client::BlockModel> block); bool has_control_inputs(); @@ -50,7 +49,7 @@ public: sigc::signal<void, bool> signal_embed_gui; protected: - SPtr<const client::BlockModel> block() const { + std::shared_ptr<const client::BlockModel> block() const { return std::dynamic_pointer_cast<const client::BlockModel>(_object); } diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 8e6dc0cf..ab197525 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -50,13 +50,13 @@ using namespace client; namespace gui { -NodeModule::NodeModule(GraphCanvas& canvas, - SPtr<const BlockModel> block) - : Ganv::Module(canvas, block->path().symbol(), 0, 0, true) - , _block(block) - , _gui_widget(nullptr) - , _gui_window(nullptr) - , _initialised(false) +NodeModule::NodeModule(GraphCanvas& canvas, + std::shared_ptr<const BlockModel> block) + : Ganv::Module(canvas, block->path().symbol(), 0, 0, true) + , _block(block) + , _gui_widget(nullptr) + , _gui_window(nullptr) + , _initialised(false) { block->signal_new_port().connect( sigc::mem_fun(this, &NodeModule::new_port_view)); @@ -134,9 +134,9 @@ NodeModule::show_menu(GdkEventButton* ev) } NodeModule* -NodeModule::create(GraphCanvas& canvas, - SPtr<const BlockModel> block, - bool human) +NodeModule::create(GraphCanvas& canvas, + std::shared_ptr<const BlockModel> block, + bool human) { auto graph = std::dynamic_pointer_cast<const GraphModel>(block); @@ -305,7 +305,7 @@ NodeModule::rename() } void -NodeModule::new_port_view(SPtr<const PortModel> port) +NodeModule::new_port_view(std::shared_ptr<const PortModel> port) { Port::create(app(), *this, port); @@ -319,7 +319,7 @@ NodeModule::new_port_view(SPtr<const PortModel> port) } Port* -NodeModule::port(SPtr<const PortModel> model) +NodeModule::port(std::shared_ptr<const PortModel> model) { for (iterator p = begin(); p != end(); ++p) { Port* const port = dynamic_cast<Port*>(*p); @@ -331,7 +331,7 @@ NodeModule::port(SPtr<const PortModel> model) } void -NodeModule::delete_port_view(SPtr<const PortModel> model) +NodeModule::delete_port_view(std::shared_ptr<const PortModel> model) { Port* p = port(model); if (p) { diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index d4b845cf..55a255a8 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -17,10 +17,11 @@ #ifndef INGEN_GUI_NODEMODULE_HPP #define INGEN_GUI_NODEMODULE_HPP +#include "Port.hpp" + #include "ganv/Module.hpp" -#include "ingen/memory.hpp" -#include "Port.hpp" +#include <memory> namespace ingen { namespace client { @@ -46,26 +47,26 @@ class NodeMenu; class NodeModule : public Ganv::Module { public: - static NodeModule* create( - GraphCanvas& canvas, - SPtr<const client::BlockModel> block, - bool human); + static NodeModule* create(GraphCanvas& canvas, + std::shared_ptr<const client::BlockModel> block, + bool human); ~NodeModule() override; App& app() const; - Port* port(SPtr<const client::PortModel> model); + Port* port(std::shared_ptr<const client::PortModel> model); - void delete_port_view(SPtr<const client::PortModel> model); + void delete_port_view(std::shared_ptr<const client::PortModel> model); virtual void store_location(double ax, double ay); void show_human_names(bool b); - SPtr<const client::BlockModel> block() const { return _block; } + std::shared_ptr<const client::BlockModel> block() const { return _block; } protected: - NodeModule(GraphCanvas& canvas, SPtr<const client::BlockModel> block); + NodeModule(GraphCanvas& canvas, + std::shared_ptr<const client::BlockModel> block); virtual bool on_double_click(GdkEventButton* ev); @@ -81,7 +82,7 @@ protected: void rename(); void property_changed(const URI& key, const Atom& value); - void new_port_view(SPtr<const client::PortModel> port); + void new_port_view(std::shared_ptr<const client::PortModel> port); void port_activity(uint32_t index, const Atom& value); void port_value_changed(uint32_t index, const Atom& value); @@ -90,12 +91,12 @@ protected: bool show_menu(GdkEventButton* ev); - SPtr<const client::BlockModel> _block; - NodeMenu* _menu; - SPtr<client::PluginUI> _plugin_ui; - Gtk::Widget* _gui_widget; - Gtk::Window* _gui_window; ///< iff popped up - bool _initialised; + std::shared_ptr<const client::BlockModel> _block; + NodeMenu* _menu; + std::shared_ptr<client::PluginUI> _plugin_ui; + Gtk::Widget* _gui_widget; + Gtk::Window* _gui_window; ///< iff popped up + bool _initialised; }; } // namespace gui diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 11648a30..52fec864 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -25,6 +25,7 @@ #include "ingen/client/ObjectModel.hpp" #include <cstdint> +#include <memory> namespace ingen { @@ -54,7 +55,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, } void -ObjectMenu::init(App& app, SPtr<const ObjectModel> object) +ObjectMenu::init(App& app, std::shared_ptr<const ObjectModel> object) { _app = &app; _object = object; diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index 8714917e..2f3caa01 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -18,13 +18,14 @@ #define INGEN_GUI_OBJECTMENU_HPP #include "ingen/client/ObjectModel.hpp" -#include "ingen/memory.hpp" #include <gtkmm/builder.h> #include <gtkmm/checkmenuitem.h> #include <gtkmm/menu.h> #include <gtkmm/menuitem.h> +#include <memory> + namespace ingen { namespace gui { @@ -43,10 +44,14 @@ public: ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void init(App& app, SPtr<const client::ObjectModel> object); + void init(App& app, std::shared_ptr<const client::ObjectModel> object); + + std::shared_ptr<const client::ObjectModel> object() const + { + return _object; + } - SPtr<const client::ObjectModel> object() const { return _object; } - App* app() const { return _app; } + App* app() const { return _app; } protected: void on_menu_learn(); @@ -58,16 +63,16 @@ protected: void property_changed(const URI& predicate, const Atom& value); - App* _app; - SPtr<const client::ObjectModel> _object; - Gtk::MenuItem* _learn_menuitem; - Gtk::MenuItem* _unlearn_menuitem; - Gtk::CheckMenuItem* _polyphonic_menuitem; - Gtk::MenuItem* _disconnect_menuitem; - Gtk::MenuItem* _rename_menuitem; - Gtk::MenuItem* _destroy_menuitem; - Gtk::MenuItem* _properties_menuitem; - Gtk::SeparatorMenuItem* _separator_menuitem; + App* _app; + std::shared_ptr<const client::ObjectModel> _object; + Gtk::MenuItem* _learn_menuitem; + Gtk::MenuItem* _unlearn_menuitem; + Gtk::CheckMenuItem* _polyphonic_menuitem; + Gtk::MenuItem* _disconnect_menuitem; + Gtk::MenuItem* _rename_menuitem; + Gtk::MenuItem* _destroy_menuitem; + Gtk::MenuItem* _properties_menuitem; + Gtk::SeparatorMenuItem* _separator_menuitem; bool _enable_signal; }; diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp index 2b2cf037..2f6dfc82 100644 --- a/src/gui/PluginMenu.cpp +++ b/src/gui/PluginMenu.cpp @@ -65,7 +65,7 @@ PluginMenu::clear() } void -PluginMenu::add_plugin(SPtr<client::PluginModel> p) +PluginMenu::add_plugin(std::shared_ptr<client::PluginModel> p) { using iterator = ClassMenus::iterator; @@ -144,7 +144,8 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu, } void -PluginMenu::add_plugin_to_menu(MenuRecord& menu, SPtr<client::PluginModel> p) +PluginMenu::add_plugin_to_menu(MenuRecord& menu, + std::shared_ptr<client::PluginModel> p) { const URIs& uris = _world.uris(); LilvWorld* lworld = _world.lilv_world(); diff --git a/src/gui/PluginMenu.hpp b/src/gui/PluginMenu.hpp index 38831f5a..9b08dc0a 100644 --- a/src/gui/PluginMenu.hpp +++ b/src/gui/PluginMenu.hpp @@ -18,7 +18,6 @@ #define INGEN_GUI_PLUGINMENU_HPP #include "ingen/World.hpp" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include <gtkmm/menu.h> @@ -46,9 +45,9 @@ public: PluginMenu(ingen::World& world); void clear(); - void add_plugin(SPtr<client::PluginModel> p); + void add_plugin(std::shared_ptr<client::PluginModel> p); - sigc::signal< void, std::weak_ptr<client::PluginModel> > signal_load_plugin; + sigc::signal<void, std::weak_ptr<client::PluginModel>> signal_load_plugin; private: struct MenuRecord { @@ -67,7 +66,8 @@ private: const LV2Children& children, std::set<const char*>& ancestors); - void add_plugin_to_menu(MenuRecord& menu, SPtr<client::PluginModel> p); + void add_plugin_to_menu(MenuRecord& menu, + std::shared_ptr<client::PluginModel> p); void load_plugin(std::weak_ptr<client::PluginModel> weak_plugin); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 3da9cf46..a1c43aa5 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -44,28 +44,29 @@ namespace ingen { namespace gui { Port* -Port::create(App& app, - Ganv::Module& module, - SPtr<const PortModel> pm, - bool flip) +Port::create(App& app, + Ganv::Module& module, + std::shared_ptr<const PortModel> pm, + bool flip) { return new Port(app, module, pm, port_label(app, pm), flip); } /** @param flip Make an input port appear as an output port, and vice versa. */ -Port::Port(App& app, - Ganv::Module& module, - SPtr<const PortModel> pm, - const std::string& name, - bool flip) - : Ganv::Port(module, name, - flip ? (!pm->is_input()) : pm->is_input(), - app.style()->get_port_color(pm.get())) - , _app(app) - , _port_model(pm) - , _entered(false) - , _flipped(flip) +Port::Port(App& app, + Ganv::Module& module, + std::shared_ptr<const PortModel> pm, + const std::string& name, + bool flip) + : Ganv::Port(module, + name, + flip ? (!pm->is_input()) : pm->is_input(), + app.style()->get_port_color(pm.get())) + , _app(app) + , _port_model(pm) + , _entered(false) + , _flipped(flip) { assert(pm); @@ -112,7 +113,7 @@ Port::~Port() } std::string -Port::port_label(App& app, SPtr<const PortModel> pm) +Port::port_label(App& app, std::shared_ptr<const PortModel> pm) { if (!pm) { return ""; @@ -149,7 +150,7 @@ Port::ensure_label() void Port::update_metadata() { - SPtr<const PortModel> pm = _port_model.lock(); + auto pm = _port_model.lock(); if (pm && _app.can_control(pm.get()) && pm->is_numeric()) { auto parent = std::dynamic_pointer_cast<const BlockModel>(pm->parent()); if (parent) { @@ -513,7 +514,7 @@ bool Port::on_selected(gboolean b) { if (b) { - SPtr<const PortModel> pm = _port_model.lock(); + auto pm = _port_model.lock(); if (pm) { auto block = std::dynamic_pointer_cast<const BlockModel>(pm->parent()); diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index dd5c8b92..c605cdba 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -18,7 +18,6 @@ #define INGEN_GUI_PORT_HPP #include "ganv/Port.hpp" -#include "ingen/memory.hpp" #include <gtkmm/menu.h> @@ -45,15 +44,17 @@ class GraphBox; class Port : public Ganv::Port { public: - static Port* create( - App& app, - Ganv::Module& module, - SPtr<const client::PortModel> pm, - bool flip = false); + static Port* create(App& app, + Ganv::Module& module, + std::shared_ptr<const client::PortModel> pm, + bool flip = false); ~Port() override; - SPtr<const client::PortModel> model() const { return _port_model.lock(); } + std::shared_ptr<const client::PortModel> model() const + { + return _port_model.lock(); + } bool show_menu(GdkEventButton* ev); void update_metadata(); @@ -65,13 +66,14 @@ public: bool on_selected(gboolean b) override; private: - Port(App& app, - Ganv::Module& module, - SPtr<const client::PortModel> pm, - const std::string& name, - bool flip = false); - - static std::string port_label(App& app, SPtr<const client::PortModel> pm); + Port(App& app, + Ganv::Module& module, + std::shared_ptr<const client::PortModel> pm, + const std::string& name, + bool flip = false); + + static std::string + port_label(App& app, std::shared_ptr<const client::PortModel> pm); Gtk::Menu* build_enum_menu(); Gtk::Menu* build_uri_menu(); diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index fb706c9b..c8b9807e 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -22,7 +22,6 @@ #include "ingen/Interface.hpp" #include "ingen/client/GraphModel.hpp" #include "ingen/client/PortModel.hpp" -#include "ingen/memory.hpp" #include <memory> #include <string> @@ -46,7 +45,9 @@ PortMenu::PortMenu(BaseObjectType* cobject, } void -PortMenu::init(App& app, SPtr<const PortModel> port, bool internal_graph_port) +PortMenu::init(App& app, + std::shared_ptr<const PortModel> port, + bool internal_graph_port) { const URIs& uris = app.uris(); diff --git a/src/gui/PortMenu.hpp b/src/gui/PortMenu.hpp index 8cb069f7..9ff632bf 100644 --- a/src/gui/PortMenu.hpp +++ b/src/gui/PortMenu.hpp @@ -20,7 +20,6 @@ #include "ObjectMenu.hpp" #include "ingen/client/PortModel.hpp" -#include "ingen/memory.hpp" #include <gtkmm/builder.h> #include <gtkmm/menu.h> @@ -39,9 +38,9 @@ public: PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void init(App& app, - SPtr<const client::PortModel> port, - bool internal_graph_port = false); + void init(App& app, + std::shared_ptr<const client::PortModel> port, + bool internal_graph_port = false); private: void on_menu_disconnect() override; diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 5c7a58ea..ef832c5b 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -33,6 +33,7 @@ #include <cfloat> #include <climits> #include <cstdint> +#include <memory> #include <set> #include <utility> @@ -96,7 +97,7 @@ PropertiesWindow::reset() } void -PropertiesWindow::present(SPtr<const ObjectModel> model) +PropertiesWindow::present(std::shared_ptr<const ObjectModel> model) { set_object(model); Gtk::Window::present(); @@ -200,7 +201,7 @@ PropertiesWindow::class_supported(const rdfs::URISet& types) * This function MUST be called before using this object in any way. */ void -PropertiesWindow::set_object(SPtr<const ObjectModel> model) +PropertiesWindow::set_object(std::shared_ptr<const ObjectModel> model) { reset(); _model = model; diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp index 015c0a93..d91c9268 100644 --- a/src/gui/PropertiesWindow.hpp +++ b/src/gui/PropertiesWindow.hpp @@ -20,7 +20,6 @@ #include "Window.hpp" #include "ingen/client/BlockModel.hpp" -#include "ingen/memory.hpp" #include <gtkmm/alignment.h> #include <gtkmm/box.h> @@ -54,8 +53,8 @@ public: PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void present(SPtr<const client::ObjectModel> model); - void set_object(SPtr<const client::ObjectModel> model); + void present(std::shared_ptr<const client::ObjectModel> model); + void set_object(std::shared_ptr<const client::ObjectModel> model); private: /** Record of a property (row in the table) */ @@ -108,21 +107,21 @@ private: using Records = std::map<URI, Record>; Records _records; - SPtr<const client::ObjectModel> _model; - ComboColumns _combo_columns; - Glib::RefPtr<Gtk::ListStore> _key_store; - sigc::connection _property_connection; - sigc::connection _property_removed_connection; - Gtk::VBox* _vbox; - Gtk::ScrolledWindow* _scrolledwindow; - Gtk::Table* _table; - Gtk::ComboBox* _key_combo; - LV2_URID _value_type; - Gtk::Bin* _value_bin; - Gtk::Button* _add_button; - Gtk::Button* _cancel_button; - Gtk::Button* _apply_button; - Gtk::Button* _ok_button; + std::shared_ptr<const client::ObjectModel> _model; + ComboColumns _combo_columns; + Glib::RefPtr<Gtk::ListStore> _key_store; + sigc::connection _property_connection; + sigc::connection _property_removed_connection; + Gtk::VBox* _vbox; + Gtk::ScrolledWindow* _scrolledwindow; + Gtk::Table* _table; + Gtk::ComboBox* _key_combo; + LV2_URID _value_type; + Gtk::Bin* _value_bin; + Gtk::Button* _add_button; + Gtk::Button* _cancel_button; + Gtk::Button* _apply_button; + Gtk::Button* _ok_button; }; } // namespace gui diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index 1091c443..5bee419c 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -115,7 +115,7 @@ datatypes(World& world, URISet& types, bool super) } URISet -types(World& world, SPtr<const client::ObjectModel> model) +types(World& world, std::shared_ptr<const client::ObjectModel> model) { using PropIter = Properties::const_iterator; using PropRange = std::pair<PropIter, PropIter>; @@ -145,7 +145,7 @@ types(World& world, SPtr<const client::ObjectModel> model) } URISet -properties(World& world, SPtr<const client::ObjectModel> model) +properties(World& world, std::shared_ptr<const client::ObjectModel> model) { URISet properties; URISet types = rdfs::types(world, model); diff --git a/src/gui/RDFS.hpp b/src/gui/RDFS.hpp index d2812bc0..70c46a8e 100644 --- a/src/gui/RDFS.hpp +++ b/src/gui/RDFS.hpp @@ -18,10 +18,10 @@ #define INGEN_GUI_RDF_HPP #include "ingen/URI.hpp" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include <map> +#include <memory> #include <set> #include <string> @@ -61,10 +61,12 @@ void datatypes(World& world, URISet& types, bool super); Objects instances(World& world, const URISet& types); /** Get all the types which `model` is an instance of. */ -URISet types(World& world, SPtr<const client::ObjectModel> model); +URISet +types(World& world, std::shared_ptr<const client::ObjectModel> model); /** Get all the properties with domains appropriate for `model`. */ -URISet properties(World& world, SPtr<const client::ObjectModel> model); +URISet +properties(World& world, std::shared_ptr<const client::ObjectModel> model); /** Return the range (value types) of `prop`. * @param recursive If true, include all subclasses. diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 8c5e9edb..b8bd89b8 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -24,6 +24,7 @@ #include "ingen/client/ObjectModel.hpp" #include "lv2/core/lv2.h" +#include <memory> #include <string> namespace ingen { @@ -58,7 +59,7 @@ RenameWindow::RenameWindow(BaseObjectType* cobject, * This function MUST be called before using this object in any way. */ void -RenameWindow::set_object(SPtr<const ObjectModel> object) +RenameWindow::set_object(std::shared_ptr<const ObjectModel> object) { _object = object; _symbol_entry->set_text(object->path().symbol()); @@ -68,7 +69,7 @@ RenameWindow::set_object(SPtr<const ObjectModel> object) } void -RenameWindow::present(SPtr<const ObjectModel> object) +RenameWindow::present(std::shared_ptr<const ObjectModel> object) { set_object(object); _symbol_entry->grab_focus(); diff --git a/src/gui/RenameWindow.hpp b/src/gui/RenameWindow.hpp index 2ea2d897..49fb93ba 100644 --- a/src/gui/RenameWindow.hpp +++ b/src/gui/RenameWindow.hpp @@ -20,13 +20,14 @@ #include "Window.hpp" #include "ingen/client/ObjectModel.hpp" -#include "ingen/memory.hpp" #include <gtkmm/builder.h> #include <gtkmm/button.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> +#include <memory> + namespace ingen { namespace gui { @@ -40,16 +41,16 @@ public: RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void present(SPtr<const client::ObjectModel> object); + void present(std::shared_ptr<const client::ObjectModel> object); private: - void set_object(SPtr<const client::ObjectModel> object); + void set_object(std::shared_ptr<const client::ObjectModel> object); void values_changed(); void cancel_clicked(); void ok_clicked(); - SPtr<const client::ObjectModel> _object; + std::shared_ptr<const client::ObjectModel> _object; Gtk::Entry* _symbol_entry; Gtk::Entry* _label_entry; diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index 1c89d564..1cbc775f 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -36,10 +36,9 @@ using namespace client; namespace gui { -SubgraphModule::SubgraphModule(GraphCanvas& canvas, - SPtr<const GraphModel> graph) - : NodeModule(canvas, graph) - , _graph(graph) +SubgraphModule::SubgraphModule(GraphCanvas& canvas, + std::shared_ptr<const GraphModel> graph) + : NodeModule(canvas, graph), _graph(graph) { assert(graph); } diff --git a/src/gui/SubgraphModule.hpp b/src/gui/SubgraphModule.hpp index 1571c2ee..816d042a 100644 --- a/src/gui/SubgraphModule.hpp +++ b/src/gui/SubgraphModule.hpp @@ -17,11 +17,11 @@ #ifndef INGEN_GUI_SUBGRAPHMODULE_HPP #define INGEN_GUI_SUBGRAPHMODULE_HPP -#include "ingen/memory.hpp" - #include "GraphPortModule.hpp" #include "NodeModule.hpp" +#include <memory> + namespace ingen { namespace client { @@ -40,7 +40,8 @@ class GraphCanvas; class SubgraphModule : public NodeModule { public: - SubgraphModule(GraphCanvas& canvas, SPtr<const client::GraphModel> graph); + SubgraphModule(GraphCanvas& canvas, + std::shared_ptr<const client::GraphModel> graph); ~SubgraphModule() override = default; @@ -51,10 +52,10 @@ public: void browse_to_graph(); void menu_remove(); - SPtr<const client::GraphModel> graph() const { return _graph; } + std::shared_ptr<const client::GraphModel> graph() const { return _graph; } protected: - SPtr<const client::GraphModel> _graph; + std::shared_ptr<const client::GraphModel> _graph; }; } // namespace gui diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 45ac4f7f..41b1320e 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -24,6 +24,7 @@ #include "ingen/client/GraphModel.hpp" #include <cassert> +#include <memory> #include <string> using boost::optional; @@ -31,7 +32,7 @@ using boost::optional; namespace ingen { namespace gui { -ThreadedLoader::ThreadedLoader(App& app, SPtr<Interface> engine) +ThreadedLoader::ThreadedLoader(App& app, std::shared_ptr<Interface> engine) : _app(app) , _sem(0) , _engine(std::move(engine)) @@ -52,7 +53,7 @@ ThreadedLoader::~ThreadedLoader() } } -SPtr<Parser> +std::shared_ptr<Parser> ThreadedLoader::parser() { return _app.world().parser(); @@ -115,7 +116,8 @@ ThreadedLoader::load_graph_event(const FilePath& file_path, } void -ThreadedLoader::save_graph(SPtr<const client::GraphModel> model, const URI& uri) +ThreadedLoader::save_graph(std::shared_ptr<const client::GraphModel> model, + const URI& uri) { std::lock_guard<std::mutex> lock(_mutex); @@ -128,8 +130,9 @@ ThreadedLoader::save_graph(SPtr<const client::GraphModel> model, const URI& uri) } void -ThreadedLoader::save_graph_event(SPtr<const client::GraphModel> model, - const URI& uri) +ThreadedLoader::save_graph_event( + std::shared_ptr<const client::GraphModel> model, + const URI& uri) { assert(uri.scheme() == "file"); if (_app.serialiser()) { diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index 3ab8f4a2..ec591a9c 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -27,6 +27,7 @@ #include <sigc++/sigc++.h> #include <list> +#include <memory> #include <mutex> #include <thread> #include <utility> @@ -56,7 +57,7 @@ class ThreadedLoader { public: ThreadedLoader(App& app, - SPtr<Interface> engine); + std::shared_ptr<Interface> engine); ~ThreadedLoader(); @@ -66,9 +67,10 @@ public: boost::optional<Raul::Symbol> engine_symbol, boost::optional<Properties> engine_data); - void save_graph(SPtr<const client::GraphModel> model, const URI& uri); + void + save_graph(std::shared_ptr<const client::GraphModel> model, const URI& uri); - SPtr<Parser> parser(); + std::shared_ptr<Parser> parser(); private: void load_graph_event(const FilePath& file_path, @@ -76,21 +78,21 @@ private: boost::optional<Raul::Symbol> engine_symbol, boost::optional<Properties> engine_data); - void save_graph_event(SPtr<const client::GraphModel> model, - const URI& filename); + void save_graph_event(std::shared_ptr<const client::GraphModel> model, + const URI& filename); /** Returns nothing and takes no parameters (because they have all been bound) */ using Closure = sigc::slot<void>; void run(); - App& _app; - Raul::Semaphore _sem; - SPtr<Interface> _engine; - std::mutex _mutex; - std::list<Closure> _events; - bool _exit_flag; - std::thread _thread; + App& _app; + Raul::Semaphore _sem; + std::shared_ptr<Interface> _engine; + std::mutex _mutex; + std::list<Closure> _events; + bool _exit_flag; + std::thread _thread; }; } // namespace gui diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 43a2110c..4a6c2901 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -99,7 +99,7 @@ WindowFactory::num_open_graph_windows() } GraphBox* -WindowFactory::graph_box(SPtr<const GraphModel> graph) +WindowFactory::graph_box(std::shared_ptr<const GraphModel> graph) { GraphWindow* window = graph_window(graph); if (window) { @@ -110,7 +110,7 @@ WindowFactory::graph_box(SPtr<const GraphModel> graph) } GraphWindow* -WindowFactory::graph_window(SPtr<const GraphModel> graph) +WindowFactory::graph_window(std::shared_ptr<const GraphModel> graph) { if (!graph) { return nullptr; @@ -122,7 +122,7 @@ WindowFactory::graph_window(SPtr<const GraphModel> graph) } GraphWindow* -WindowFactory::parent_graph_window(SPtr<const BlockModel> block) +WindowFactory::parent_graph_window(std::shared_ptr<const BlockModel> block) { if (!block) { return nullptr; @@ -138,9 +138,9 @@ WindowFactory::parent_graph_window(SPtr<const BlockModel> block) * presented and `preferred` left unmodified. */ void -WindowFactory::present_graph(SPtr<const GraphModel> graph, - GraphWindow* preferred, - SPtr<GraphView> view) +WindowFactory::present_graph(std::shared_ptr<const GraphModel> graph, + GraphWindow* preferred, + std::shared_ptr<GraphView> view) { assert(!view || view->graph() == graph); @@ -164,8 +164,8 @@ WindowFactory::present_graph(SPtr<const GraphModel> graph, } GraphWindow* -WindowFactory::new_graph_window(SPtr<const GraphModel> graph, - SPtr<GraphView> view) +WindowFactory::new_graph_window(std::shared_ptr<const GraphModel> graph, + std::shared_ptr<GraphView> view) { assert(!view || view->graph() == graph); @@ -206,8 +206,8 @@ WindowFactory::remove_graph_window(GraphWindow* win, GdkEventAny* ignored) } void -WindowFactory::present_load_plugin(SPtr<const GraphModel> graph, - Properties data) +WindowFactory::present_load_plugin(std::shared_ptr<const GraphModel> graph, + Properties data) { _app.request_plugins_if_necessary(); @@ -230,7 +230,7 @@ WindowFactory::present_load_plugin(SPtr<const GraphModel> graph, } void -WindowFactory::present_load_graph(SPtr<const GraphModel> graph, +WindowFactory::present_load_graph(std::shared_ptr<const GraphModel> graph, Properties data) { auto w = _graph_windows.find(graph->path()); @@ -243,8 +243,8 @@ WindowFactory::present_load_graph(SPtr<const GraphModel> graph, } void -WindowFactory::present_load_subgraph(SPtr<const GraphModel> graph, - Properties data) +WindowFactory::present_load_subgraph(std::shared_ptr<const GraphModel> graph, + Properties data) { auto w = _graph_windows.find(graph->path()); @@ -256,8 +256,8 @@ WindowFactory::present_load_subgraph(SPtr<const GraphModel> graph, } void -WindowFactory::present_new_subgraph(SPtr<const GraphModel> graph, - Properties data) +WindowFactory::present_new_subgraph(std::shared_ptr<const GraphModel> graph, + Properties data) { auto w = _graph_windows.find(graph->path()); @@ -269,7 +269,7 @@ WindowFactory::present_new_subgraph(SPtr<const GraphModel> graph, } void -WindowFactory::present_rename(SPtr<const ObjectModel> object) +WindowFactory::present_rename(std::shared_ptr<const ObjectModel> object) { auto w = _graph_windows.find(object->path()); if (w == _graph_windows.end()) { @@ -284,7 +284,7 @@ WindowFactory::present_rename(SPtr<const ObjectModel> object) } void -WindowFactory::present_properties(SPtr<const ObjectModel> object) +WindowFactory::present_properties(std::shared_ptr<const ObjectModel> object) { auto w = _graph_windows.find(object->path()); if (w == _graph_windows.end()) { diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index 5b1a6984..00ddce55 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -18,10 +18,10 @@ #define INGEN_GUI_WINDOWFACTORY_HPP #include "ingen/Node.hpp" -#include "ingen/memory.hpp" #include <cstddef> #include <map> +#include <memory> namespace ingen { @@ -56,21 +56,30 @@ public: size_t num_open_graph_windows(); - GraphBox* graph_box(SPtr<const client::GraphModel> graph); - GraphWindow* graph_window(SPtr<const client::GraphModel> graph); - GraphWindow* parent_graph_window(SPtr<const client::BlockModel> block); + GraphBox* graph_box(std::shared_ptr<const client::GraphModel> graph); + GraphWindow* graph_window(std::shared_ptr<const client::GraphModel> graph); - void present_graph( - SPtr<const client::GraphModel> graph, - GraphWindow* preferred = nullptr, - SPtr<GraphView> view = nullptr); + GraphWindow* + parent_graph_window(std::shared_ptr<const client::BlockModel> block); - void present_load_plugin(SPtr<const client::GraphModel> graph, Properties data=Properties()); - void present_load_graph(SPtr<const client::GraphModel> graph, Properties data=Properties()); - void present_load_subgraph(SPtr<const client::GraphModel> graph, Properties data=Properties()); - void present_new_subgraph(SPtr<const client::GraphModel> graph, Properties data=Properties()); - void present_rename(SPtr<const client::ObjectModel> object); - void present_properties(SPtr<const client::ObjectModel> object); + void present_graph(std::shared_ptr<const client::GraphModel> graph, + GraphWindow* preferred = nullptr, + std::shared_ptr<GraphView> view = nullptr); + + void present_load_plugin(std::shared_ptr<const client::GraphModel> graph, + Properties data = Properties()); + + void present_load_graph(std::shared_ptr<const client::GraphModel> graph, + Properties data = Properties()); + + void present_load_subgraph(std::shared_ptr<const client::GraphModel> graph, + Properties data = Properties()); + + void present_new_subgraph(std::shared_ptr<const client::GraphModel> graph, + Properties data = Properties()); + + void present_rename(std::shared_ptr<const client::ObjectModel> object); + void present_properties(std::shared_ptr<const client::ObjectModel> object); bool remove_graph_window(GraphWindow* win, GdkEventAny* ignored = nullptr); @@ -81,8 +90,9 @@ public: private: using GraphWindowMap = std::map<Raul::Path, GraphWindow*>; - GraphWindow* new_graph_window(SPtr<const client::GraphModel> graph, - SPtr<GraphView> view); + GraphWindow* + new_graph_window(std::shared_ptr<const client::GraphModel> graph, + std::shared_ptr<GraphView> view); App& _app; GraphBox* _main_box; diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp index c26bd205..5830fbba 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -46,12 +46,15 @@ struct GUIModule : public Module { app->run(); } - SPtr<Interface> make_client(World& world) { - SPtr<SigClientInterface> sci(new SigClientInterface()); - return world.engine() ? sci : SPtr<Interface>(new QueuedInterface(sci)); + std::shared_ptr<Interface> make_client(World& world) + { + auto sci = std::make_shared<SigClientInterface>(); + return world.engine() + ? sci + : std::shared_ptr<Interface>(new QueuedInterface(sci)); } - SPtr<gui::App> app; + std::shared_ptr<gui::App> app; }; } // namespace gui diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 0bd3c5ec..35e74f7d 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -30,7 +30,6 @@ #include "ingen/client/GraphModel.hpp" #include "ingen/client/SigClientInterface.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "ingen/paths.hpp" #include "ingen/runtime_paths.hpp" #include "lv2/atom/atom.h" @@ -84,16 +83,16 @@ struct IngenLV2UI { , sink(nullptr) {} - int argc; - char** argv; - Forge* forge; - World* world; - IngenLV2AtomSink* sink; - SPtr<gui::App> app; - SPtr<gui::GraphBox> view; - SPtr<Interface> engine; - SPtr<AtomReader> reader; - SPtr<client::SigClientInterface> client; + int argc; + char** argv; + Forge* forge; + World* world; + IngenLV2AtomSink* sink; + std::shared_ptr<gui::App> app; + std::shared_ptr<gui::GraphBox> view; + std::shared_ptr<Interface> engine; + std::shared_ptr<AtomReader> reader; + std::shared_ptr<client::SigClientInterface> client; }; } // namespace ingen @@ -107,10 +106,6 @@ instantiate(const LV2UI_Descriptor* descriptor, LV2UI_Widget* widget, const LV2_Feature* const* features) { -#if __cplusplus >= 201103L - using ingen::SPtr; -#endif - ingen::set_bundle_path(bundle_path); ingen::IngenLV2UI* ui = new ingen::IngenLV2UI(); @@ -142,16 +137,15 @@ instantiate(const LV2UI_Descriptor* descriptor, ui->world->uris(), write_function, controller); // Set up an engine interface that writes LV2 atoms - ui->engine = SPtr<ingen::Interface>( + ui->engine = std::shared_ptr<ingen::Interface>( new ingen::AtomWriter( ui->world->uri_map(), ui->world->uris(), *ui->sink)); ui->world->set_interface(ui->engine); // Create App and client - ui->app = ingen::gui::App::create(*ui->world); - ui->client = SPtr<ingen::client::SigClientInterface>( - new ingen::client::SigClientInterface()); + ui->app = ingen::gui::App::create(*ui->world); + ui->client = std::make_shared<ingen::client::SigClientInterface>(); ui->app->set_is_plugin(true); ui->app->attach(ui->client); diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index 948e80dd..bdba2389 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -20,7 +20,6 @@ #include "ingen/Log.hpp" #include "ingen/Parser.hpp" #include "ingen/World.hpp" -#include "ingen/memory.hpp" #include "ingen/paths.hpp" #include "ingen/runtime_paths.hpp" #include "ingen_config.h" @@ -141,8 +140,8 @@ main(int argc, char** argv) } // If we don't have a local engine interface (from the GUI), use network - SPtr<Interface> engine_interface(world->interface()); - SPtr<Interface> dummy_client(new DummyInterface()); + auto engine_interface = world->interface(); + auto dummy_client = std::make_shared<DummyInterface>(); if (!engine_interface) { const char* const uri = conf.option("connect").ptr<char>(); ingen_try(URI::is_valid(uri), diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index 2368109e..e9c218d9 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -35,6 +35,7 @@ #include <algorithm> #include <cstdint> +#include <memory> #include <utility> #include <vector> @@ -61,12 +62,12 @@ BlockFactory::plugins() return _plugins; } -std::set<SPtr<PluginImpl>> +std::set<std::shared_ptr<PluginImpl>> BlockFactory::refresh() { // Record current plugins, and those that are currently zombies - const Plugins old_plugins(_plugins); - std::set<SPtr<PluginImpl>> zombies; + const Plugins old_plugins(_plugins); + std::set<std::shared_ptr<PluginImpl>> zombies; for (const auto& p : _plugins) { if (p.second->is_zombie()) { zombies.insert(p.second); @@ -77,7 +78,7 @@ BlockFactory::refresh() load_lv2_plugins(); // Add any new plugins to response - std::set<SPtr<PluginImpl>> new_plugins; + std::set<std::shared_ptr<PluginImpl>> new_plugins; for (const auto& p : _plugins) { auto o = old_plugins.find(p.first); if (o == old_plugins.end()) { @@ -146,13 +147,12 @@ void BlockFactory::load_lv2_plugins() { // Build an array of port type nodes for checking compatibility - using Types = std::vector<SPtr<LilvNode>>; + using Types = std::vector<std::shared_ptr<LilvNode>>; Types types; for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) { const URI& uri(PortType(static_cast<PortType::ID>(t)).uri()); - types.push_back( - SPtr<LilvNode>(lilv_new_uri(_world.lilv_world(), uri.c_str()), - lilv_node_free)); + types.push_back(std::shared_ptr<LilvNode>( + lilv_new_uri(_world.lilv_world(), uri.c_str()), lilv_node_free)); } const LilvPlugins* plugins = lilv_world_get_all_plugins(_world.lilv_world()); diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp index aff2e9f4..e285ba92 100644 --- a/src/server/BlockFactory.hpp +++ b/src/server/BlockFactory.hpp @@ -18,10 +18,10 @@ #define INGEN_ENGINE_BLOCKFACTORY_HPP #include "ingen/URI.hpp" -#include "ingen/memory.hpp" #include "raul/Noncopyable.hpp" #include <map> +#include <memory> #include <set> namespace ingen { @@ -47,11 +47,11 @@ public: * * @return The set of newly loaded plugins. */ - std::set<SPtr<PluginImpl>> refresh(); + std::set<std::shared_ptr<PluginImpl>> refresh(); void load_plugin(const URI& uri); - using Plugins = std::map<URI, SPtr<PluginImpl>>; + using Plugins = std::map<URI, std::shared_ptr<PluginImpl>>; const Plugins& plugins(); PluginImpl* plugin(const URI& uri); diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index ffe2aaf9..9e9a09ad 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -26,6 +26,7 @@ #include "ingen/Properties.hpp" #include "ingen/Resource.hpp" #include "ingen/URI.hpp" +#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "lv2/urid/urid.h" #include "raul/Array.hpp" @@ -34,6 +35,7 @@ #include <boost/optional/optional.hpp> #include <cstdint> +#include <memory> #include <set> namespace Raul { diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index b7dc4526..04fbdba0 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -22,6 +22,7 @@ #include "ingen/Interface.hpp" #include <cstddef> +#include <memory> #include <utility> namespace ingen { @@ -37,7 +38,7 @@ Broadcaster::~Broadcaster() /** Register a client to receive messages over the notification band. */ void -Broadcaster::register_client(const SPtr<Interface>& client) +Broadcaster::register_client(const std::shared_ptr<Interface>& client) { std::lock_guard<std::mutex> lock(_clients_mutex); _clients.insert(client); @@ -48,7 +49,7 @@ Broadcaster::register_client(const SPtr<Interface>& client) * @return true if client was found and removed. */ bool -Broadcaster::unregister_client(const SPtr<Interface>& client) +Broadcaster::unregister_client(const std::shared_ptr<Interface>& client) { std::lock_guard<std::mutex> lock(_clients_mutex); const size_t erased = _clients.erase(client); @@ -57,7 +58,8 @@ Broadcaster::unregister_client(const SPtr<Interface>& client) } void -Broadcaster::set_broadcast(const SPtr<Interface>& client, bool broadcast) +Broadcaster::set_broadcast(const std::shared_ptr<Interface>& client, + bool broadcast) { if (broadcast) { _broadcastees.insert(client); diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index c766ceed..5a414432 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -22,10 +22,10 @@ #include "ingen/Interface.hpp" #include "ingen/Message.hpp" #include "ingen/URI.hpp" -#include "ingen/memory.hpp" #include "raul/Noncopyable.hpp" #include <atomic> +#include <memory> #include <mutex> #include <set> @@ -45,17 +45,18 @@ public: Broadcaster() = default; ~Broadcaster() override; - void register_client(const SPtr<Interface>& client); - bool unregister_client(const SPtr<Interface>& client); + void register_client(const std::shared_ptr<Interface>& client); + bool unregister_client(const std::shared_ptr<Interface>& client); - void set_broadcast(const SPtr<Interface>& client, bool broadcast); + void + set_broadcast(const std::shared_ptr<Interface>& client, bool broadcast); /** Ignore a client when broadcasting. * * This is used to prevent feeding back updates to the client that * initiated a property set in the first place. */ - void set_ignore_client(const SPtr<Interface>& client) + void set_ignore_client(const std::shared_ptr<Interface>& client) { _ignore_client = client; } @@ -109,14 +110,14 @@ public: private: friend class Transfer; - using Clients = std::set<SPtr<Interface>>; + using Clients = std::set<std::shared_ptr<Interface>>; - std::mutex _clients_mutex; - Clients _clients; - std::set< SPtr<Interface> > _broadcastees; - std::atomic<bool> _must_broadcast{false}; - unsigned _bundle_depth{0}; - SPtr<Interface> _ignore_client; + std::mutex _clients_mutex; + Clients _clients; + std::set<std::shared_ptr<Interface>> _broadcastees; + std::atomic<bool> _must_broadcast{false}; + unsigned _bundle_depth{0}; + std::shared_ptr<Interface> _ignore_client; }; } // namespace server diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index b1ec1c68..3228106c 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -24,7 +24,6 @@ #include "ingen/URIs.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/atom/atom.h" #include "lv2/urid/urid.h" diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index e7bb146a..2de18ee8 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -26,6 +26,7 @@ #include "lv2/urid/urid.h" #include <algorithm> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp index f0eaa1bf..8af3407a 100644 --- a/src/server/ClientUpdate.cpp +++ b/src/server/ClientUpdate.cpp @@ -29,11 +29,11 @@ #include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/URIs.hpp" -#include "ingen/memory.hpp" #include <algorithm> #include <cstddef> #include <cstdint> +#include <memory> #include <utility> namespace ingen { @@ -101,8 +101,8 @@ ClientUpdate::put_graph(const GraphImpl* graph) // Enqueue arcs for (const auto& a : graph->arcs()) { - const SPtr<const Arc> arc = a.second; - const Connect connect = { arc->tail_path(), arc->head_path() }; + const auto arc = a.second; + const Connect connect = {arc->tail_path(), arc->head_path()}; connects.push_back(connect); } } diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp index 3c6b6172..20bae0a5 100644 --- a/src/server/CompiledGraph.cpp +++ b/src/server/CompiledGraph.cpp @@ -25,6 +25,7 @@ #include "ingen/Configuration.hpp" #include "ingen/Log.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include <algorithm> #include <cassert> diff --git a/src/server/CompiledGraph.hpp b/src/server/CompiledGraph.hpp index 9a06a7c9..52178462 100644 --- a/src/server/CompiledGraph.hpp +++ b/src/server/CompiledGraph.hpp @@ -24,6 +24,7 @@ #include "raul/Noncopyable.hpp" #include <cstddef> +#include <memory> #include <set> #include <string> diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index f465775b..0f67bcb3 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -19,7 +19,6 @@ #include "BufferRef.hpp" -#include "ingen/memory.hpp" #include "lv2/atom/forge.h" #include "raul/Maid.hpp" @@ -142,11 +141,11 @@ private: Type type, const Atom& value_atom); - Engine& _engine; - std::atomic<Binding*> _learn_binding; - SPtr<Bindings> _bindings; - BufferRef _feedback; - LV2_Atom_Forge _forge; + Engine& _engine; + std::atomic<Binding*> _learn_binding; + std::shared_ptr<Bindings> _bindings; + BufferRef _feedback; + LV2_Atom_Forge _forge; }; } // namespace server diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index 23f56b4f..5dca573d 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -23,12 +23,14 @@ #include "types.hpp" #include "ingen/URI.hpp" +#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include <boost/intrusive/slist_hook.hpp> #include <cstddef> #include <cstdint> +#include <memory> namespace Raul { class Symbol; } diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 0d5a57bb..2c7c001f 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -110,17 +110,17 @@ Engine::Engine(ingen::World& world) _world.lv2_features().add_feature(_worker->schedule_feature()); _world.lv2_features().add_feature(_options); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_BUF_SIZE__powerOf2BlockLength))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_BUF_SIZE__powerOf2BlockLength)); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_BUF_SIZE__fixedBlockLength))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_BUF_SIZE__fixedBlockLength)); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_BUF_SIZE__boundedBlockLength))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_BUF_SIZE__boundedBlockLength)); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_STATE__loadDefaultState))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_STATE__loadDefaultState)); if (world.conf().option("dump").get<int32_t>()) { _interface = std::make_shared<Tee>( @@ -159,7 +159,7 @@ Engine::~Engine() thread_ctx->join(); } - const SPtr<Store> store = this->store(); + const auto store = this->store(); if (store) { for (auto& s : *store) { if (!std::dynamic_pointer_cast<NodeImpl>(s.second)->parent()) { @@ -273,7 +273,7 @@ Engine::steal_task(unsigned start_thread) return nullptr; } -SPtr<Store> +std::shared_ptr<Store> Engine::store() const { return _world.store(); @@ -337,7 +337,7 @@ Engine::main_iteration() } void -Engine::set_driver(const SPtr<Driver>& driver) +Engine::set_driver(const std::shared_ptr<Driver>& driver) { _driver = driver; for (const auto& ctx : _run_contexts) { @@ -376,7 +376,8 @@ Engine::reset_load() void Engine::init(double sample_rate, uint32_t block_length, size_t seq_size) { - set_driver(SPtr<Driver>(new DirectDriver(*this, sample_rate, block_length, seq_size))); + set_driver(std::make_shared<DirectDriver>( + *this, sample_rate, block_length, seq_size)); } bool @@ -511,14 +512,14 @@ Engine::log() const } void -Engine::register_client(const SPtr<Interface>& client) +Engine::register_client(const std::shared_ptr<Interface>& client) { log().info("Registering client <%1%>\n", client->uri().c_str()); _broadcaster->register_client(client); } bool -Engine::unregister_client(const SPtr<Interface>& client) +Engine::unregister_client(const std::shared_ptr<Interface>& client) { log().info("Unregistering client <%1%>\n", client->uri().c_str()); return _broadcaster->unregister_client(client); diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 445ac649..ec0319ed 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -25,7 +25,6 @@ #include "ingen/EngineBase.hpp" #include "ingen/Properties.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <chrono> #include <condition_variable> @@ -94,15 +93,15 @@ public: unsigned run(uint32_t sample_count) override; void quit() override; bool main_iteration() override; - void register_client(const SPtr<Interface>& client) override; - bool unregister_client(const SPtr<Interface>& client) override; + void register_client(const std::shared_ptr<Interface>& client) override; + bool unregister_client(const std::shared_ptr<Interface>& client) override; void listen() override; /** Return a random [0..1] float with uniform distribution */ float frand() { return _uniform_dist(_rand_engine); } - void set_driver(const SPtr<Driver>& driver); + void set_driver(const std::shared_ptr<Driver>& driver); /** Return the frame time to execute an event that arrived now. * @@ -137,14 +136,14 @@ public: ingen::World& world() const { return _world; } Log& log() const; - const SPtr<Interface>& interface() const { return _interface; } - const SPtr<EventWriter>& event_writer() const { return _event_writer; } + const std::shared_ptr<Interface>& interface() const { return _interface; } + const std::shared_ptr<EventWriter>& event_writer() const { return _event_writer; } const std::unique_ptr<AtomReader>& atom_interface() const { return _atom_interface; } const std::unique_ptr<BlockFactory>& block_factory() const { return _block_factory; } const std::unique_ptr<Broadcaster>& broadcaster() const { return _broadcaster; } const std::unique_ptr<BufferFactory>& buffer_factory() const { return _buffer_factory; } const std::unique_ptr<ControlBindings>& control_bindings() const { return _control_bindings; } - const SPtr<Driver>& driver() const { return _driver; } + const std::shared_ptr<Driver>& driver() const { return _driver; } const std::unique_ptr<PostProcessor>& post_processor() const { return _post_processor; } const std::unique_ptr<Raul::Maid>& maid() const { return _maid; } const std::unique_ptr<UndoStack>& undo_stack() const { return _undo_stack; } @@ -167,7 +166,7 @@ public: void signal_tasks_available(); Task* steal_task(unsigned start_thread); - SPtr<Store> store() const; + std::shared_ptr<Store> store() const; SampleRate sample_rate() const; SampleCount block_length() const; @@ -183,10 +182,10 @@ public: private: ingen::World& _world; - SPtr<LV2Options> _options; + std::shared_ptr<LV2Options> _options; std::unique_ptr<BufferFactory> _buffer_factory; std::unique_ptr<Raul::Maid> _maid; - SPtr<Driver> _driver; + std::shared_ptr<Driver> _driver; std::unique_ptr<Worker> _worker; std::unique_ptr<Worker> _sync_worker; std::unique_ptr<Broadcaster> _broadcaster; @@ -197,8 +196,8 @@ private: std::unique_ptr<PostProcessor> _post_processor; std::unique_ptr<PreProcessor> _pre_processor; std::unique_ptr<SocketListener> _listener; - SPtr<EventWriter> _event_writer; - SPtr<Interface> _interface; + std::shared_ptr<EventWriter> _event_writer; + std::shared_ptr<Interface> _interface; std::unique_ptr<AtomReader> _atom_interface; GraphImpl* _root_graph; diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 93c175b8..89e6ec1a 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -22,12 +22,12 @@ #include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/Status.hpp" -#include "ingen/memory.hpp" #include "raul/Deletable.hpp" #include "raul/Noncopyable.hpp" #include "raul/Path.hpp" #include <atomic> +#include <memory> namespace ingen { namespace server { @@ -107,7 +107,7 @@ public: inline Engine& engine() { return _engine; } protected: - Event(Engine& engine, SPtr<Interface> client, int32_t id, FrameTime time) + Event(Engine& engine, std::shared_ptr<Interface> client, int32_t id, FrameTime time) : _engine(engine) , _next(nullptr) , _request_client(std::move(client)) @@ -149,14 +149,14 @@ protected: return _status; } - Engine& _engine; - std::atomic<Event*> _next; - SPtr<Interface> _request_client; - int32_t _request_id; - FrameTime _time; - Status _status; - std::string _err_subject; - Mode _mode; + Engine& _engine; + std::atomic<Event*> _next; + std::shared_ptr<Interface> _request_client; + int32_t _request_id; + FrameTime _time; + Status _status; + std::string _err_subject; + Mode _mode; }; } // namespace server diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 3bf1d03b..184cefb7 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -23,7 +23,8 @@ #include "ingen/Interface.hpp" #include "ingen/Message.hpp" #include "ingen/URI.hpp" -#include "ingen/memory.hpp" + +#include <memory> namespace ingen { namespace server { @@ -39,11 +40,12 @@ public: URI uri() const override { return URI("ingen:/clients/event_writer"); } - SPtr<Interface> respondee() const override { + std::shared_ptr<Interface> respondee() const override { return _respondee; } - void set_respondee(const SPtr<Interface>& respondee) override { + void set_respondee(const std::shared_ptr<Interface>& respondee) override + { _respondee = respondee; } @@ -70,9 +72,9 @@ public: void operator()(const Undo&); protected: - Engine& _engine; - SPtr<Interface> _respondee; - Event::Mode _event_mode; + Engine& _engine; + std::shared_ptr<Interface> _respondee; + Event::Mode _event_mode; private: SampleCount now() const; diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 4d1d7856..fca0ec4f 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -29,6 +29,7 @@ #include "ingen/Forge.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include <cassert> @@ -276,13 +277,13 @@ GraphImpl::remove_block(BlockImpl& block) } void -GraphImpl::add_arc(const SPtr<ArcImpl>& a) +GraphImpl::add_arc(const std::shared_ptr<ArcImpl>& a) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); _arcs.emplace(std::make_pair(a->tail(), a->head()), a); } -SPtr<ArcImpl> +std::shared_ptr<ArcImpl> GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 455e9c8a..2ff4cdff 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -21,7 +21,6 @@ #include "DuplexPort.hpp" #include "ThreadManager.hpp" -#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include <cassert> @@ -157,12 +156,13 @@ public: /** Add an arc to this graph. * Pre-processing thread only. */ - void add_arc(const SPtr<ArcImpl>& a); + void add_arc(const std::shared_ptr<ArcImpl>& a); /** Remove an arc from this graph. * Pre-processing thread only. */ - SPtr<ArcImpl> remove_arc(const PortImpl* tail, const PortImpl* dst_port); + std::shared_ptr<ArcImpl> + remove_arc(const PortImpl* tail, const PortImpl* dst_port); bool has_arc(const PortImpl* tail, const PortImpl* dst_port) const; diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index d238398a..ab951aca 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -29,6 +29,7 @@ #include "ingen/Atom.hpp" #include "ingen/Node.hpp" #include "ingen/URIs.hpp" +#include "ingen/memory.hpp" #include "raul/Array.hpp" #include <cassert> diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index ad8b10a4..1bb29b9c 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -22,7 +22,6 @@ #include "PortType.hpp" #include "types.hpp" -#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include <boost/intrusive/options.hpp> @@ -30,6 +29,7 @@ #include <cstdint> #include <cstdlib> +#include <memory> namespace Raul { class Symbol; } diff --git a/src/server/InternalBlock.cpp b/src/server/InternalBlock.cpp index 4aa4cff2..f7072184 100644 --- a/src/server/InternalBlock.cpp +++ b/src/server/InternalBlock.cpp @@ -28,6 +28,7 @@ #include <cstddef> #include <cstdint> +#include <memory> namespace Raul { class Symbol; diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index b3f669ce..969961cd 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -32,6 +32,7 @@ #include "ingen/URIMap.hpp" #include "ingen/World.hpp" #include "ingen/fmt.hpp" +#include "ingen/memory.hpp" #include "lv2/atom/util.h" #include <jack/midiport.h> @@ -568,11 +569,10 @@ JackDriver::_session_cb(jack_session_event_t* event) jack_get_client_name(_client), event->client_uuid); - SPtr<Serialiser> serialiser = _engine.world().serialiser(); - if (serialiser) { + if (auto serialiser = _engine.world().serialiser()) { std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex()); - SPtr<Node> root(_engine.root_graph(), NullDeleter<Node>); + std::shared_ptr<Node> root(_engine.root_graph(), NullDeleter<Node>); serialiser->write_bundle(root, URI(std::string("file://") + event->session_dir)); } diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 7855a0f1..fb1e3192 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -76,7 +76,7 @@ LV2Block::~LV2Block() drop_instances(_prepared_instances); } -SPtr<LV2Block::Instance> +std::shared_ptr<LV2Block::Instance> LV2Block::make_instance(URIs& uris, SampleRate rate, uint32_t voice, @@ -180,7 +180,7 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly) _prepared_instances = bufs.maid().make_managed<Instances>( poly, *_instances, nullptr); for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) { - SPtr<Instance> inst = make_instance(bufs.uris(), rate, i, true); + auto inst = make_instance(bufs.uris(), rate, i, true); if (!inst) { _prepared_instances.reset(); return false; @@ -653,8 +653,8 @@ void LV2Block::apply_state(const std::unique_ptr<Worker>& worker, const LilvState* state) { - World& world = parent_graph()->engine().world(); - SPtr<LV2_Feature> sched; + World& world = parent_graph()->engine().world(); + std::shared_ptr<LV2_Feature> sched; if (worker) { sched = worker->schedule_feature()->feature(world, this); } diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 0413a245..66bf8517 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -22,6 +22,7 @@ #include "types.hpp" #include "ingen/LV2Features.hpp" +#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "lv2/worker/worker.h" #include "raul/Array.hpp" @@ -103,16 +104,14 @@ protected: LilvInstance* const instance; }; - SPtr<Instance> make_instance(URIs& uris, - SampleRate rate, - uint32_t voice, - bool preparing); + std::shared_ptr<Instance> + make_instance(URIs& uris, SampleRate rate, uint32_t voice, bool preparing); inline LilvInstance* instance(uint32_t voice) { return static_cast<LilvInstance*>((*_instances)[voice]->instance); } - using Instances = Raul::Array<SPtr<Instance>>; + using Instances = Raul::Array<std::shared_ptr<Instance>>; static void drop_instances(const MPtr<Instances>& instances) { if (instances) { @@ -149,13 +148,13 @@ protected: static LV2_Worker_Status work_respond( LV2_Worker_Respond_Handle handle, uint32_t size, const void* data); - LV2Plugin* _lv2_plugin; - MPtr<Instances> _instances; - MPtr<Instances> _prepared_instances; - const LV2_Worker_Interface* _worker_iface; - std::mutex _work_mutex; - Responses _responses; - SPtr<LV2Features::FeatureArray> _features; + LV2Plugin* _lv2_plugin; + MPtr<Instances> _instances; + MPtr<Instances> _prepared_instances; + const LV2_Worker_Interface* _worker_iface; + std::mutex _work_mutex; + Responses _responses; + std::shared_ptr<LV2Features::FeatureArray> _features; }; } // namespace server diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp index 33f5781b..d7493276 100644 --- a/src/server/LV2Options.hpp +++ b/src/server/LV2Options.hpp @@ -21,6 +21,8 @@ #include "ingen/URIs.hpp" #include "lv2/options/options.h" +#include <memory> + namespace ingen { namespace server { @@ -38,7 +40,7 @@ public: const char* uri() const override { return LV2_OPTIONS__options; } - SPtr<LV2_Feature> feature(World& w, Node* n) override { + std::shared_ptr<LV2_Feature> feature(World& w, Node* n) override { const LV2_Options_Option options[] = { { LV2_OPTIONS_INSTANCE, 0, _uris.bufsz_minBlockLength, sizeof(int32_t), _uris.atom_Int, &_block_length }, @@ -55,7 +57,7 @@ public: f->URI = LV2_OPTIONS__options; f->data = malloc(sizeof(options)); memcpy(f->data, options, sizeof(options)); - return SPtr<LV2_Feature>(f, &free_feature); + return std::shared_ptr<LV2_Feature>(f, &free_feature); } private: diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index 322aacb8..ddad2ea7 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -24,6 +24,8 @@ #include "ingen/LV2Features.hpp" #include "lv2/resize-port/resize-port.h" +#include <memory> + namespace ingen { namespace server { @@ -44,7 +46,7 @@ struct ResizeFeature : public ingen::LV2Features::Feature { const char* uri() const { return LV2_RESIZE_PORT_URI; } - SPtr<LV2_Feature> feature(World& w, Node* n) { + std::shared_ptr<LV2_Feature> feature(World& w, Node* n) { BlockImpl* block = dynamic_cast<BlockImpl*>(n); if (!block) { return nullptr; @@ -56,7 +58,7 @@ struct ResizeFeature : public ingen::LV2Features::Feature { LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature)); f->URI = LV2_RESIZE_PORT_URI; f->data = data; - return SPtr<LV2_Feature>(f, &free_feature); + return std::shared_ptr<LV2_Feature>(f, &free_feature); } }; diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 714c57f7..a6d2ff26 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -26,6 +26,7 @@ #include "ingen/Forge.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "lv2/atom/util.h" #include "raul/Array.hpp" #include "raul/Maid.hpp" diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index c0d44ef6..0c12f85d 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -24,11 +24,13 @@ #include "types.hpp" #include "ingen/Atom.hpp" +#include "ingen/memory.hpp" #include "raul/Array.hpp" #include <atomic> #include <cstdint> #include <cstdlib> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/PreProcessContext.hpp b/src/server/PreProcessContext.hpp index a1bdbb5f..558349f8 100644 --- a/src/server/PreProcessContext.hpp +++ b/src/server/PreProcessContext.hpp @@ -20,6 +20,8 @@ #include "CompiledGraph.hpp" #include "GraphImpl.hpp" +#include "ingen/memory.hpp" + #include <unordered_set> namespace Raul { class Maid; } diff --git a/src/server/RunContext.hpp b/src/server/RunContext.hpp index 10414bde..bc09f7c3 100644 --- a/src/server/RunContext.hpp +++ b/src/server/RunContext.hpp @@ -17,7 +17,6 @@ #ifndef INGEN_ENGINE_RUNCONTEXT_HPP #define INGEN_ENGINE_RUNCONTEXT_HPP -#include "ingen/memory.hpp" #include "types.hpp" #include "lv2/urid/urid.h" diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp index 272aa627..9d8d461d 100644 --- a/src/server/SocketListener.cpp +++ b/src/server/SocketListener.cpp @@ -33,6 +33,7 @@ #include <cstdint> #include <cstdlib> #include <cstring> +#include <memory> #include <sstream> #include <string> #include <thread> @@ -170,14 +171,14 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock) } if (pfds[0].revents & POLLIN) { - SPtr<Raul::Socket> conn = unix_sock->accept(); + auto conn = unix_sock->accept(); if (conn) { new SocketServer(world, *engine, conn); } } if (pfds[1].revents & POLLIN) { - SPtr<Raul::Socket> conn = net_sock->accept(); + auto conn = net_sock->accept(); if (conn) { new SocketServer(world, *engine, conn); } diff --git a/src/server/SocketServer.hpp b/src/server/SocketServer.hpp index 9f762ddf..76cfa76a 100644 --- a/src/server/SocketServer.hpp +++ b/src/server/SocketServer.hpp @@ -29,6 +29,8 @@ #include "ingen/World.hpp" #include "raul/Socket.hpp" +#include <memory> + namespace ingen { namespace server { @@ -36,19 +38,19 @@ namespace server { class SocketServer { public: - SocketServer(World& world, - server::Engine& engine, - const SPtr<Raul::Socket>& sock) + SocketServer(World& world, + server::Engine& engine, + const std::shared_ptr<Raul::Socket>& sock) : _engine(engine) , _sink(world.conf().option("dump").get<int32_t>() - ? SPtr<Interface>( - new Tee({SPtr<Interface>(new EventWriter(engine)), - SPtr<Interface>(new StreamWriter(world.uri_map(), + ? std::shared_ptr<Interface>( + new Tee({std::shared_ptr<Interface>(new EventWriter(engine)), + std::shared_ptr<Interface>(new StreamWriter(world.uri_map(), world.uris(), URI("ingen:/engine"), stderr, ColorContext::Color::CYAN))})) - : SPtr<Interface>(new EventWriter(engine))) + : std::shared_ptr<Interface>(new EventWriter(engine))) , _reader(new SocketReader(world, *_sink, sock)) , _writer(new SocketWriter(world.uri_map(), world.uris(), @@ -72,10 +74,10 @@ protected: } private: - server::Engine& _engine; - SPtr<Interface> _sink; - SPtr<SocketReader> _reader; - SPtr<SocketWriter> _writer; + server::Engine& _engine; + std::shared_ptr<Interface> _sink; + std::shared_ptr<SocketReader> _reader; + std::shared_ptr<SocketWriter> _writer; }; } // namespace server diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 1180fa47..a0747ae8 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -25,6 +25,7 @@ #include "lv2/worker/worker.h" #include <cstdlib> +#include <memory> namespace ingen { @@ -91,7 +92,7 @@ Worker::request(LV2Block* block, return LV2_WORKER_SUCCESS; } -SPtr<LV2_Feature> +std::shared_ptr<LV2_Feature> Worker::Schedule::feature(World&, Node* n) { auto* block = dynamic_cast<LV2Block*>(n); @@ -108,7 +109,7 @@ Worker::Schedule::feature(World&, Node* n) f->URI = LV2_WORKER__schedule; f->data = data; - return SPtr<LV2_Feature>(f, &free_feature); + return std::shared_ptr<LV2_Feature>(f, &free_feature); } Worker::Worker(Log& log, uint32_t buffer_size, bool synchronous) diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index cc79629c..7d5c1f02 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -18,7 +18,6 @@ #define INGEN_ENGINE_WORKER_HPP #include "ingen/LV2Features.hpp" -#include "ingen/memory.hpp" #include "lv2/worker/worker.h" #include "raul/RingBuffer.hpp" #include "raul/Semaphore.hpp" @@ -46,7 +45,7 @@ public: const char* uri() const override { return LV2_WORKER__schedule; } - SPtr<LV2_Feature> feature(World& world, Node* n) override; + std::shared_ptr<LV2_Feature> feature(World& world, Node* n) override; const bool synchronous; }; @@ -55,10 +54,10 @@ public: uint32_t size, const void* data); - SPtr<Schedule> schedule_feature() { return _schedule; } + std::shared_ptr<Schedule> schedule_feature() { return _schedule; } private: - SPtr<Schedule> _schedule; + std::shared_ptr<Schedule> _schedule; Log& _log; Raul::Semaphore _sem; diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index b269ca45..444bd4b7 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -39,15 +39,16 @@ namespace ingen { namespace server { namespace events { -Connect::Connect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Connect& msg) - : Event(engine, client, msg.seq, timestamp) - , _msg(msg) - , _graph(nullptr) - , _head(nullptr) -{} +Connect::Connect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Connect& msg) + : Event(engine, client, msg.seq, timestamp) + , _msg(msg) + , _graph(nullptr) + , _head(nullptr) +{ +} bool Connect::pre_process(PreProcessContext& ctx) diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 305ad7a8..217860ac 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -22,6 +22,10 @@ #include "PortImpl.hpp" #include "types.hpp" +#include "ingen/memory.hpp" + +#include <memory> + namespace ingen { namespace server { @@ -38,10 +42,10 @@ namespace events { class Connect : public Event { public: - Connect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Connect& msg); + Connect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Connect& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; @@ -49,16 +53,16 @@ public: void undo(Interface& target) override; private: - const ingen::Connect _msg; - GraphImpl* _graph; - InputPort* _head; - MPtr<CompiledGraph> _compiled_graph; - SPtr<ArcImpl> _arc; - MPtr<PortImpl::Voices> _voices; - Properties _tail_remove; - Properties _tail_add; - Properties _head_remove; - Properties _head_add; + const ingen::Connect _msg; + GraphImpl* _graph; + InputPort* _head; + MPtr<CompiledGraph> _compiled_graph; + std::shared_ptr<ArcImpl> _arc; + MPtr<PortImpl::Voices> _voices; + Properties _tail_remove; + Properties _tail_add; + Properties _head_remove; + Properties _head_add; }; } // namespace events diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index dbe57dc0..d57849b2 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -37,15 +37,15 @@ namespace ingen { namespace server { namespace events { -Copy::Copy(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Copy& msg) - : Event(engine, client, msg.seq, timestamp) - , _msg(msg) - , _old_block(nullptr) - , _parent(nullptr) - , _block(nullptr) +Copy::Copy(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Copy& msg) + : Event(engine, client, msg.seq, timestamp) + , _msg(msg) + , _old_block(nullptr) + , _parent(nullptr) + , _block(nullptr) {} bool diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp index aa1eae5d..fb788873 100644 --- a/src/server/events/Copy.hpp +++ b/src/server/events/Copy.hpp @@ -20,6 +20,10 @@ #include "CompiledGraph.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" + +#include <memory> + namespace ingen { namespace server { @@ -35,10 +39,10 @@ namespace events { class Copy : public Event { public: - Copy(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Copy& msg); + Copy(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Copy& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; @@ -50,11 +54,11 @@ private: bool engine_to_filesystem(PreProcessContext& ctx); bool filesystem_to_engine(PreProcessContext& ctx); - const ingen::Copy _msg; - SPtr<BlockImpl> _old_block; - GraphImpl* _parent; - BlockImpl* _block; - MPtr<CompiledGraph> _compiled_graph; + const ingen::Copy _msg; + std::shared_ptr<BlockImpl> _old_block; + GraphImpl* _parent; + BlockImpl* _block; + MPtr<CompiledGraph> _compiled_graph; }; } // namespace events diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 4b48cfde..c443645a 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -32,23 +32,24 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include <memory> #include <utility> namespace ingen { namespace server { namespace events { -CreateBlock::CreateBlock(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _properties(properties) - , _graph(nullptr) - , _block(nullptr) +CreateBlock::CreateBlock(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _properties(properties) + , _graph(nullptr) + , _block(nullptr) {} bool @@ -56,8 +57,8 @@ CreateBlock::pre_process(PreProcessContext& ctx) { using iterator = Properties::const_iterator; - const ingen::URIs& uris = _engine.world().uris(); - const SPtr<Store> store = _engine.store(); + const ingen::URIs& uris = _engine.world().uris(); + const std::shared_ptr<Store> store = _engine.store(); // Check sanity of target path if (_path.is_root()) { diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index a9f43a80..dc2efa58 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -21,7 +21,10 @@ #include "CompiledGraph.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" + #include <cstdint> +#include <memory> namespace ingen { namespace server { @@ -38,12 +41,12 @@ namespace events { class CreateBlock : public Event { public: - CreateBlock(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - Properties& properties); + CreateBlock(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + Properties& properties); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 7a1d9a75..1b04482f 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -26,26 +26,28 @@ #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include <memory> #include <utility> namespace ingen { namespace server { namespace events { -CreateGraph::CreateGraph(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _properties(properties) - , _graph(nullptr) - , _parent(nullptr) +CreateGraph::CreateGraph(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _properties(properties) + , _graph(nullptr) + , _parent(nullptr) {} void diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index 7fbf9bdc..ea24891d 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -41,12 +41,12 @@ namespace events { class CreateGraph : public Event { public: - CreateGraph(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties); + CreateGraph(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 2520378c..2cf66386 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -30,30 +30,32 @@ #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Array.hpp" #include "raul/Path.hpp" #include <cassert> +#include <memory> #include <utility> namespace ingen { namespace server { namespace events { -CreatePort::CreatePort(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _port_type(PortType::UNKNOWN) - , _buf_type(0) - , _graph(nullptr) - , _graph_port(nullptr) - , _engine_port(nullptr) - , _properties(properties) +CreatePort::CreatePort(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _port_type(PortType::UNKNOWN) + , _buf_type(0) + , _graph(nullptr) + , _graph_port(nullptr) + , _engine_port(nullptr) + , _properties(properties) { const ingen::URIs& uris = _engine.world().uris(); diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 9ad8987a..c0f57655 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -21,12 +21,14 @@ #include "Event.hpp" #include "PortType.hpp" +#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include "raul/Path.hpp" #include <boost/optional/optional.hpp> #include <cstdint> +#include <memory> namespace ingen { namespace server { @@ -44,12 +46,12 @@ namespace events { class CreatePort : public Event { public: - CreatePort(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties); + CreatePort(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index d0a77a31..fb5035ec 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -31,6 +31,7 @@ #include "ingen/Forge.hpp" #include "ingen/Store.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" @@ -44,10 +45,10 @@ namespace ingen { namespace server { namespace events { -Delete::Delete(Engine& engine, - const SPtr<Interface>& client, - FrameTime timestamp, - const ingen::Del& msg) +Delete::Delete(Engine& engine, + const std::shared_ptr<Interface>& client, + FrameTime timestamp, + const ingen::Del& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) , _engine_port(nullptr) diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index c556bbd9..bda7a784 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -22,6 +22,7 @@ #include "GraphImpl.hpp" #include "ingen/Store.hpp" +#include "ingen/memory.hpp" #include <cstdint> #include <map> @@ -46,10 +47,10 @@ class DisconnectAll; class Delete : public Event { public: - Delete(Engine& engine, - const SPtr<Interface>& client, - FrameTime timestamp, - const ingen::Del& msg); + Delete(Engine& engine, + const std::shared_ptr<Interface>& client, + FrameTime timestamp, + const ingen::Del& msg); ~Delete() override; @@ -64,8 +65,8 @@ private: const ingen::Del _msg; Raul::Path _path; - SPtr<BlockImpl> _block; ///< Non-null iff a block - SPtr<DuplexPort> _port; ///< Non-null iff a port + std::shared_ptr<BlockImpl> _block; ///< Non-null iff a block + std::shared_ptr<DuplexPort> _port; ///< Non-null iff a port EnginePort* _engine_port; MPtr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph MPtr<CompiledGraph> _compiled_graph; ///< Graph's new process order diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 2dc9e22b..04b30630 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -33,8 +33,10 @@ #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" +#include <memory> #include <mutex> #include <set> #include <string> @@ -48,10 +50,10 @@ class PreProcessContext; namespace events { -Delta::Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Put& msg) +Delta::Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Put& msg) : Event(engine, client, msg.seq, timestamp) , _create_event(nullptr) , _subject(msg.uri) @@ -67,10 +69,10 @@ Delta::Delta(Engine& engine, init(); } -Delta::Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Delta& msg) +Delta::Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Delta& msg) : Event(engine, client, msg.seq, timestamp) , _create_event(nullptr) , _subject(msg.uri) @@ -87,10 +89,10 @@ Delta::Delta(Engine& engine, init(); } -Delta::Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::SetProperty& msg) +Delta::Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::SetProperty& msg) : Event(engine, client, msg.seq, timestamp) , _subject(msg.subject) , _properties{{msg.predicate, msg.value}} diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index c4199262..40c3cc27 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -21,6 +21,7 @@ #include "ControlBindings.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" #include "lilv/lilv.h" #include <boost/optional/optional.hpp> @@ -48,20 +49,20 @@ class SetPortValue; class Delta : public Event { public: - Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Put& msg); + Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Put& msg); - Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Delta& msg); + Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Delta& msg); - Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::SetProperty& msg); + Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::SetProperty& msg); ~Delta() override = default; @@ -78,11 +79,7 @@ public: Execution get_execution() const override; private: - enum class Type { - SET, - PUT, - PATCH - }; + enum class Type { SET, PUT, PATCH }; enum class SpecialType { NONE, diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 3df5fd64..4918e5bf 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -29,6 +29,7 @@ #include "ThreadManager.hpp" #include "ingen/Store.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" @@ -43,10 +44,10 @@ namespace ingen { namespace server { namespace events { -Disconnect::Disconnect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Disconnect& msg) +Disconnect::Disconnect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Disconnect& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) , _graph(nullptr) diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index d6a455c8..8b43d0d0 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -20,6 +20,7 @@ #include "CompiledGraph.hpp" #include "Event.hpp" #include "PortImpl.hpp" +#include "ingen/memory.hpp" #include "types.hpp" #include <memory> @@ -39,10 +40,10 @@ namespace events { class Disconnect : public Event { public: - Disconnect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Disconnect& msg); + Disconnect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Disconnect& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; @@ -59,11 +60,11 @@ public: inline InputPort* head() { return _head; } private: - Engine& _engine; - PortImpl* _tail; - InputPort* _head; - SPtr<ArcImpl> _arc; - MPtr<PortImpl::Voices> _voices; + Engine& _engine; + PortImpl* _tail; + InputPort* _head; + std::shared_ptr<ArcImpl> _arc; + MPtr<PortImpl::Voices> _voices; }; private: diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index cc4284ff..47f8092a 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -32,6 +32,7 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include <memory> #include <mutex> #include <set> #include <utility> @@ -40,16 +41,16 @@ namespace ingen { namespace server { namespace events { -DisconnectAll::DisconnectAll(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::DisconnectAll& msg) - : Event(engine, client, msg.seq, timestamp) - , _msg(msg) - , _parent(nullptr) - , _block(nullptr) - , _port(nullptr) - , _deleting(false) +DisconnectAll::DisconnectAll(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::DisconnectAll& msg) + : Event(engine, client, msg.seq, timestamp) + , _msg(msg) + , _parent(nullptr) + , _block(nullptr) + , _port(nullptr) + , _deleting(false) { } diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 09d1165f..9080d3e7 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -21,9 +21,11 @@ #include "Disconnect.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <list> +#include <memory> namespace ingen { namespace server { @@ -43,10 +45,10 @@ class Disconnect; class DisconnectAll : public Event { public: - DisconnectAll(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::DisconnectAll& msg); + DisconnectAll(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::DisconnectAll& msg); DisconnectAll(Engine& engine, GraphImpl* parent, diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 9194226d..1399fd6d 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -31,16 +31,17 @@ #include "ingen/World.hpp" #include <cstdint> +#include <memory> #include <mutex> namespace ingen { namespace server { namespace events { -Get::Get(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Get& msg) +Get::Get(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Get& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) , _object(nullptr) diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 0c3d053d..2ccb88e3 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -22,6 +22,8 @@ #include "Event.hpp" #include "types.hpp" +#include <memory> + namespace ingen { namespace server { @@ -39,10 +41,10 @@ namespace events { class Get : public Event { public: - Get(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Get& msg); + Get(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Get& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext&) override; diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index d7eb1804..8db6335c 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -20,6 +20,8 @@ #include "PreProcessContext.hpp" #include "UndoStack.hpp" +#include "ingen/memory.hpp" + #include <memory> #include <utility> @@ -27,19 +29,19 @@ namespace ingen { namespace server { namespace events { -Mark::Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleBegin& msg) +Mark::Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleBegin& msg) : Event(engine, client, msg.seq, timestamp) , _type(Type::BUNDLE_BEGIN) , _depth(-1) {} -Mark::Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleEnd& msg) +Mark::Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleEnd& msg) : Event(engine, client, msg.seq, timestamp) , _type(Type::BUNDLE_END) , _depth(-1) diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index 2bcdafb2..b6279f0c 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -19,7 +19,10 @@ #include "Event.hpp" +#include "ingen/memory.hpp" + #include <map> +#include <memory> namespace ingen { namespace server { @@ -40,15 +43,15 @@ namespace events { class Mark : public Event { public: - Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleBegin& msg); - - Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleEnd& msg); + Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleBegin& msg); + + Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleEnd& msg); void mark(PreProcessContext& ctx) override; bool pre_process(PreProcessContext& ctx) override; diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index d7262143..13d92ef2 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -25,16 +25,17 @@ #include "GraphImpl.hpp" #include "events/Move.hpp" +#include <memory> #include <mutex> namespace ingen { namespace server { namespace events { -Move::Move(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Move& msg) +Move::Move(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Move& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) { diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 5c71ce96..7037388f 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -22,6 +22,8 @@ #include "ingen/Store.hpp" #include "raul/Path.hpp" +#include <memory> + namespace ingen { namespace server { @@ -36,10 +38,10 @@ namespace events { class Move : public Event { public: - Move(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Move& msg); + Move(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Move& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 66511a0c..c8c60e04 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -31,20 +31,21 @@ #include "ingen/World.hpp" #include <cassert> +#include <memory> namespace ingen { namespace server { namespace events { /** Internal */ -SetPortValue::SetPortValue(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - PortImpl* port, - const Atom& value, - bool activity, - bool synthetic) +SetPortValue::SetPortValue(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Atom& value, + bool activity, + bool synthetic) : Event(engine, client, id, timestamp) , _port(port) , _value(value) diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index df30d514..576b01a0 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -25,6 +25,7 @@ #include "ingen/Atom.hpp" #include <cstdint> +#include <memory> namespace ingen { namespace server { @@ -40,14 +41,14 @@ namespace events { class SetPortValue : public Event { public: - SetPortValue(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - PortImpl* port, - const Atom& value, - bool activity, - bool synthetic = false); + SetPortValue(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Atom& value, + bool activity, + bool synthetic = false); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index c855dbfb..22695415 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -22,23 +22,24 @@ #include "ingen/AtomReader.hpp" #include <deque> +#include <memory> namespace ingen { namespace server { namespace events { -Undo::Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Undo& msg) +Undo::Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Undo& msg) : Event(engine, client, msg.seq, timestamp) , _is_redo(false) {} -Undo::Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Redo& msg) +Undo::Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Redo& msg) : Event(engine, client, msg.seq, timestamp) , _is_redo(true) {} diff --git a/src/server/events/Undo.hpp b/src/server/events/Undo.hpp index 1fdaa4dd..7be79a39 100644 --- a/src/server/events/Undo.hpp +++ b/src/server/events/Undo.hpp @@ -21,6 +21,8 @@ #include "UndoStack.hpp" #include "types.hpp" +#include <memory> + namespace ingen { namespace server { namespace events { @@ -32,15 +34,15 @@ namespace events { class Undo : public Event { public: - Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Undo& msg); - - Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Redo& msg); + Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Undo& msg); + + Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Redo& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp index fba2e434..429ac8e1 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -21,12 +21,14 @@ #include "ingen/Module.hpp" #include "ingen/World.hpp" +#include <memory> + using namespace ingen; struct IngenEngineModule : public ingen::Module { void load(ingen::World& world) override { server::set_denormal_flags(world.log()); - SPtr<server::Engine> engine(new server::Engine(world)); + auto engine = std::make_shared<server::Engine>(world); world.set_engine(engine); if (!world.interface()) { world.set_interface(engine->interface()); diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index 62fef4e3..0bbf2640 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -23,6 +23,7 @@ #include "ingen/Module.hpp" #include "ingen/World.hpp" +#include <memory> #include <string> using namespace ingen; @@ -45,7 +46,7 @@ struct IngenJackModule : public ingen::Module { world.conf().option("jack-name").ptr<char>(), nullptr); - engine->set_driver(SPtr<server::Driver>(driver)); + engine->set_driver(std::shared_ptr<server::Driver>(driver)); } }; diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index ed86ee03..d1fb293e 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -88,7 +88,7 @@ class Lib { public: explicit Lib(const char* bundle_path); - using Graphs = std::vector<SPtr<const LV2Graph>>; + using Graphs = std::vector<std::shared_ptr<const LV2Graph>>; Graphs graphs; }; @@ -434,7 +434,8 @@ using namespace ingen; using namespace ingen::server; static void -ingen_lv2_main(const SPtr<Engine>& engine, const SPtr<LV2Driver>& driver) +ingen_lv2_main(const std::shared_ptr<Engine>& engine, + const std::shared_ptr<LV2Driver>& driver) { while (true) { // Wait until there is work to be done @@ -452,7 +453,7 @@ ingen_lv2_main(const SPtr<Engine>& engine, const SPtr<LV2Driver>& driver) struct IngenPlugin { std::unique_ptr<ingen::World> world; - SPtr<Engine> engine; + std::shared_ptr<Engine> engine; std::unique_ptr<std::thread> main; LV2_URID_Map* map = nullptr; int argc = 0; @@ -472,7 +473,7 @@ find_graphs(const URI& manifest_uri) Lib::Graphs graphs; for (const auto& r : resources) { - graphs.push_back(SPtr<const LV2Graph>(new LV2Graph(r))); + graphs.push_back(std::make_shared<LV2Graph>(r)); } return graphs; @@ -572,11 +573,11 @@ ingen_instantiate(const LV2_Descriptor* descriptor, "queue-size", plugin->world->forge().make(std::max(block_length, seq_size) * 4)); - SPtr<server::Engine> engine(new server::Engine(*plugin->world)); + auto engine = std::make_shared<server::Engine>(*plugin->world); plugin->engine = engine; plugin->world->set_engine(engine); - SPtr<Interface> interface = engine->interface(); + std::shared_ptr<Interface> interface = engine->interface(); plugin->world->set_interface(interface); @@ -584,7 +585,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, server::ThreadManager::single_threaded = true; auto* driver = new LV2Driver(*engine, block_length, seq_size, rate); - engine->set_driver(SPtr<ingen::server::Driver>(driver)); + engine->set_driver(std::shared_ptr<ingen::server::Driver>(driver)); engine->activate(); server::ThreadManager::single_threaded = true; @@ -611,7 +612,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, /* Register client after loading graph so the to-ui ring does not overflow. Since we are not yet rolling, it won't be drained, causing a deadlock. */ - SPtr<Interface> client(&driver->writer(), NullDeleter<Interface>); + std::shared_ptr<Interface> client(&driver->writer(), NullDeleter<Interface>); interface->set_respondee(client); engine->register_client(client); @@ -780,7 +781,7 @@ ingen_restore(LV2_Handle instance, #if 0 // Remove existing root graph contents - SPtr<Engine> engine = plugin->engine; + std::shared_ptr<Engine> engine = plugin->engine; for (const auto& b : engine->root_graph()->blocks()) { plugin->world->interface()->del(b.uri()); } diff --git a/src/server/ingen_portaudio.cpp b/src/server/ingen_portaudio.cpp index f5d95fb0..93180eba 100644 --- a/src/server/ingen_portaudio.cpp +++ b/src/server/ingen_portaudio.cpp @@ -20,7 +20,8 @@ #include "ingen/Log.hpp" #include "ingen/Module.hpp" #include "ingen/World.hpp" -#include "ingen/memory.hpp" + +#include <memory> namespace ingen { namespace server { class Driver; } } @@ -38,7 +39,7 @@ struct IngenPortAudioModule : public ingen::Module { auto* driver = new server::PortAudioDriver(*engine); driver->attach(); - engine->set_driver(SPtr<server::Driver>(driver)); + engine->set_driver(std::shared_ptr<server::Driver>(driver)); } }; diff --git a/src/server/internals/BlockDelay.cpp b/src/server/internals/BlockDelay.cpp index 2974ca18..cd9dbf9b 100644 --- a/src/server/internals/BlockDelay.cpp +++ b/src/server/internals/BlockDelay.cpp @@ -26,6 +26,8 @@ #include "raul/Array.hpp" #include "raul/Maid.hpp" +#include <memory> + namespace ingen { namespace server { diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index f2498eba..22549ae4 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -32,6 +32,7 @@ #include <cassert> #include <cmath> #include <initializer_list> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 48320ac3..f101d466 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -20,7 +20,10 @@ #include "InternalBlock.hpp" #include "types.hpp" +#include "ingen/memory.hpp" + #include <cstdint> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp index 3f5d2d8e..d81ca04d 100644 --- a/src/server/internals/Time.cpp +++ b/src/server/internals/Time.cpp @@ -29,6 +29,8 @@ #include "lv2/atom/util.h" #include "lv2/midi/midi.h" +#include <memory> + namespace ingen { namespace server { namespace internals { diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index d6dad889..cc966eb3 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -32,6 +32,7 @@ #include <cassert> #include <cmath> +#include <memory> namespace ingen { namespace server { |