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/client | |
parent | ec0b87a18623c17c16f6a648fcf277abe14142b7 (diff) | |
download | ingen-bdbdf42f3fe990c713c5437724db39274c387eee.tar.gz ingen-bdbdf42f3fe990c713c5437724db39274c387eee.tar.bz2 ingen-bdbdf42f3fe990c713c5437724db39274c387eee.zip |
Remove std::shared_ptr alias
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/BlockModel.cpp | 53 | ||||
-rw-r--r-- | src/client/ClientStore.cpp | 64 | ||||
-rw-r--r-- | src/client/GraphModel.cpp | 12 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 4 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 8 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 49 | ||||
-rw-r--r-- | src/client/PortModel.cpp | 2 |
7 files changed, 98 insertions, 94 deletions
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); |