From 8a7cc98bd39e95fbdab7bbb8e3e6e4aa351c219b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Aug 2020 16:34:02 +0200 Subject: Remove wrappers for standard memory functions --- src/client/BlockModel.cpp | 7 ++++--- src/client/ClientStore.cpp | 33 +++++++++++++++++---------------- src/client/GraphModel.cpp | 15 ++++++++------- src/client/PortModel.cpp | 3 ++- 4 files changed, 31 insertions(+), 27 deletions(-) (limited to 'src/client') diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index 3d68d8da..d672b439 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include namespace ingen { @@ -107,7 +108,7 @@ BlockModel::add_child(const SPtr& c) //ObjectModel::add_child(c); - SPtr pm = dynamic_ptr_cast(c); + SPtr pm = std::dynamic_pointer_cast(c); assert(pm); add_port(pm); } @@ -120,7 +121,7 @@ BlockModel::remove_child(const SPtr& c) //bool ret = ObjectModel::remove_child(c); - SPtr pm = dynamic_ptr_cast(c); + SPtr pm = std::dynamic_pointer_cast(c); assert(pm); remove_port(pm); @@ -274,7 +275,7 @@ BlockModel::port_label(const SPtr& port) const void BlockModel::set(const SPtr& model) { - SPtr block = dynamic_ptr_cast(model); + SPtr block = std::dynamic_pointer_cast(model); if (block) { _plugin_uri = block->_plugin_uri; _plugin = block->_plugin; diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index a0c30c85..279d0cc6 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -63,7 +64,7 @@ ClientStore::add_object(const SPtr& object) // one (with precedence to the new values). auto existing = find(object->path()); if (existing != end()) { - dynamic_ptr_cast(existing->second)->set(object); + std::dynamic_pointer_cast(existing->second)->set(object); } else { if (!object->path().is_root()) { SPtr parent = _object(object->path().parent()); @@ -98,12 +99,12 @@ ClientStore::remove_object(const Raul::Path& path) return SPtr(); } - SPtr object = dynamic_ptr_cast(top->second); + SPtr object = std::dynamic_pointer_cast(top->second); // Remove object and any adjacent arcs from parent if applicable if (object && object->parent()) { - SPtr port = dynamic_ptr_cast(object); - if (port && dynamic_ptr_cast(port->parent())) { + SPtr port = std::dynamic_pointer_cast(object); + if (port && std::dynamic_pointer_cast(port->parent())) { disconnect_all(port->parent()->path(), path); if (port->parent()->parent()) { disconnect_all(port->parent()->parent()->path(), path); @@ -159,7 +160,7 @@ ClientStore::_object(const Raul::Path& path) if (i == end()) { return SPtr(); } else { - SPtr model = dynamic_ptr_cast(i->second); + SPtr model = std::dynamic_pointer_cast(i->second); assert(model); assert(model->path().is_root() || model->parent()); return model; @@ -289,7 +290,7 @@ ClientStore::operator()(const Put& msg) const Raul::Path path(uri_to_path(uri)); - SPtr obj = dynamic_ptr_cast(_object(path)); + SPtr obj = std::dynamic_pointer_cast(_object(path)); if (obj) { obj->set_properties(properties); return; @@ -407,19 +408,19 @@ ClientStore::connection_graph(const Raul::Path& tail_path, SPtr graph; if (tail_path.parent() == head_path.parent()) { - graph = dynamic_ptr_cast(_object(tail_path.parent())); + graph = std::dynamic_pointer_cast(_object(tail_path.parent())); } if (!graph && tail_path.parent() == head_path.parent().parent()) { - graph = dynamic_ptr_cast(_object(tail_path.parent())); + graph = std::dynamic_pointer_cast(_object(tail_path.parent())); } if (!graph && tail_path.parent().parent() == head_path.parent()) { - graph = dynamic_ptr_cast(_object(head_path.parent())); + graph = std::dynamic_pointer_cast(_object(head_path.parent())); } if (!graph) { - graph = dynamic_ptr_cast(_object(tail_path.parent().parent())); + graph = std::dynamic_pointer_cast(_object(tail_path.parent().parent())); } if (!graph) { @@ -434,8 +435,8 @@ bool ClientStore::attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path) { - SPtr tail = dynamic_ptr_cast(_object(tail_path)); - SPtr head = dynamic_ptr_cast(_object(head_path)); + SPtr tail = std::dynamic_pointer_cast(_object(tail_path)); + SPtr head = std::dynamic_pointer_cast(_object(head_path)); if (tail && head) { SPtr graph = connection_graph(tail_path, head_path); @@ -457,8 +458,8 @@ ClientStore::operator()(const Connect& msg) void ClientStore::operator()(const Disconnect& msg) { - SPtr tail = dynamic_ptr_cast(_object(msg.tail)); - SPtr head = dynamic_ptr_cast(_object(msg.head)); + SPtr tail = std::dynamic_pointer_cast(_object(msg.tail)); + SPtr head = std::dynamic_pointer_cast(_object(msg.head)); SPtr graph = connection_graph(msg.tail, msg.head); if (graph) { graph->remove_arc(tail.get(), head.get()); @@ -468,7 +469,7 @@ ClientStore::operator()(const Disconnect& msg) void ClientStore::operator()(const DisconnectAll& msg) { - SPtr graph = dynamic_ptr_cast(_object(msg.graph)); + SPtr graph = std::dynamic_pointer_cast(_object(msg.graph)); SPtr object = _object(msg.path); if (!graph || !object) { @@ -479,7 +480,7 @@ ClientStore::operator()(const DisconnectAll& msg) const GraphModel::Arcs arcs = graph->arcs(); for (const auto& a : arcs) { - SPtr arc = dynamic_ptr_cast(a.second); + SPtr arc = std::dynamic_pointer_cast(a.second); if (arc->tail()->parent() == object || arc->head()->parent() == object || arc->tail()->path() == msg.path diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index 90ab2964..a2d50a20 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -22,6 +22,7 @@ #include "ingen/client/ClientStore.hpp" #include +#include #include #include @@ -33,13 +34,13 @@ GraphModel::add_child(const SPtr& c) { assert(c->parent().get() == this); - SPtr pm = dynamic_ptr_cast(c); + SPtr pm = std::dynamic_pointer_cast(c); if (pm) { add_port(pm); return; } - SPtr bm = dynamic_ptr_cast(c); + SPtr bm = std::dynamic_pointer_cast(c); if (bm) { _signal_new_block.emit(bm); } @@ -51,13 +52,13 @@ GraphModel::remove_child(const SPtr& o) assert(o->path().is_child_of(path())); assert(o->parent().get() == this); - SPtr pm = dynamic_ptr_cast(o); + SPtr pm = std::dynamic_pointer_cast(o); if (pm) { remove_arcs_on(pm); remove_port(pm); } - SPtr bm = dynamic_ptr_cast(o); + SPtr bm = std::dynamic_pointer_cast(o); if (bm) { _signal_removed_block.emit(bm); } @@ -74,7 +75,7 @@ GraphModel::remove_arcs_on(const SPtr& p) auto next = j; ++next; - SPtr arc = dynamic_ptr_cast(j->second); + SPtr arc = std::dynamic_pointer_cast(j->second); if (arc->tail_path().parent() == p->path() || arc->tail_path() == p->path() || arc->head_path().parent() == p->path() @@ -102,7 +103,7 @@ GraphModel::get_arc(const Node* tail, const Node* head) { auto i = _arcs.find(std::make_pair(tail, head)); if (i != _arcs.end()) { - return dynamic_ptr_cast(i->second); + return std::dynamic_pointer_cast(i->second); } else { return SPtr(); } @@ -148,7 +149,7 @@ GraphModel::remove_arc(const Node* tail, const Node* head) { auto i = _arcs.find(std::make_pair(tail, head)); if (i != _arcs.end()) { - SPtr arc = dynamic_ptr_cast(i->second); + SPtr arc = std::dynamic_pointer_cast(i->second); _signal_removed_arc.emit(arc); _arcs.erase(i); } diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index fa1a7abe..b3562f77 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -18,6 +18,7 @@ #include "ingen/client/PortModel.hpp" #include +#include #include namespace ingen { @@ -69,7 +70,7 @@ PortModel::set(const SPtr& model) { ObjectModel::set(model); - SPtr port = dynamic_ptr_cast(model); + SPtr port = std::dynamic_pointer_cast(model); if (port) { _index = port->_index; _direction = port->_direction; -- cgit v1.2.1