diff options
32 files changed, 130 insertions, 102 deletions
diff --git a/ingen/DataAccess.hpp b/ingen/DataAccess.hpp index 79bb84eb..13b5ac47 100644 --- a/ingen/DataAccess.hpp +++ b/ingen/DataAccess.hpp @@ -27,6 +27,7 @@ #include "lv2/data-access/data-access.h" #include <cstdlib> +#include <memory> #include <utility> namespace ingen { @@ -57,7 +58,7 @@ struct DataAccess : public ingen::LV2Features::Feature data->data_access = desc->extension_data; - return make_shared<LV2_Feature>( + return std::make_shared<LV2_Feature>( LV2_Feature{"http://lv2plug.in/ns/ext/data-access", data}); } }; diff --git a/ingen/types.hpp b/ingen/types.hpp index b6461799..2962d16a 100644 --- a/ingen/types.hpp +++ b/ingen/types.hpp @@ -42,21 +42,6 @@ using WPtr = std::weak_ptr<T>; template <class T> using MPtr = Raul::managed_ptr<T>; -template<class T, class U> -SPtr<T> static_ptr_cast(const SPtr<U>& r) { - return std::static_pointer_cast<T>(r); -} - -template<class T, class U> -SPtr<T> dynamic_ptr_cast(const SPtr<U>& r) { - return std::dynamic_pointer_cast<T>(r); -} - -template<class T, class U> -SPtr<T> const_ptr_cast(const SPtr<U>& r) { - return std::const_pointer_cast<T>(r); -} - template <typename T, typename... Args> std::unique_ptr<T> make_unique(Args&&... args) @@ -64,13 +49,6 @@ make_unique(Args&&... args) return std::unique_ptr<T>{new T{std::forward<Args>(args)...}}; } -template <typename T, typename... Args> -std::shared_ptr<T> -make_shared(Args&&... args) -{ - return std::make_shared<T>(std::forward<Args>(args)...); -} - } // namespace ingen #endif // INGEN_TYPES_HPP diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index 43470d94..3a628116 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -19,6 +19,7 @@ #include "lv2/core/lv2.h" #include <cstdlib> +#include <memory> namespace ingen { diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp index c94f0287..bdb2a36e 100644 --- a/src/SocketReader.cpp +++ b/src/SocketReader.cpp @@ -21,7 +21,6 @@ #include "ingen/Log.hpp" #include "ingen/URIMap.hpp" #include "ingen/World.hpp" -#include "lv2/atom/forge.h" #include "lv2/urid/urid.h" #include "raul/Socket.hpp" #include "sord/sordmm.hpp" @@ -29,10 +28,11 @@ #include <cerrno> #include <cstdint> #include <cstdio> -#include <cstring> #include <memory> #include <mutex> #include <poll.h> +#include <sys/socket.h> +#include <sys/types.h> #include <utility> namespace ingen { 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 <cmath> #include <cstdlib> #include <cstring> +#include <memory> #include <string> namespace ingen { @@ -107,7 +108,7 @@ BlockModel::add_child(const SPtr<ObjectModel>& c) //ObjectModel::add_child(c); - SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); + SPtr<PortModel> pm = std::dynamic_pointer_cast<PortModel>(c); assert(pm); add_port(pm); } @@ -120,7 +121,7 @@ BlockModel::remove_child(const SPtr<ObjectModel>& c) //bool ret = ObjectModel::remove_child(c); - SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); + SPtr<PortModel> pm = std::dynamic_pointer_cast<PortModel>(c); assert(pm); remove_port(pm); @@ -274,7 +275,7 @@ BlockModel::port_label(const SPtr<const PortModel>& port) const void BlockModel::set(const SPtr<ObjectModel>& model) { - SPtr<BlockModel> block = dynamic_ptr_cast<BlockModel>(model); + SPtr<BlockModel> block = std::dynamic_pointer_cast<BlockModel>(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 <cassert> #include <cstdint> +#include <memory> #include <string> #include <utility> @@ -63,7 +64,7 @@ ClientStore::add_object(const SPtr<ObjectModel>& object) // one (with precedence to the new values). auto existing = find(object->path()); if (existing != end()) { - dynamic_ptr_cast<ObjectModel>(existing->second)->set(object); + std::dynamic_pointer_cast<ObjectModel>(existing->second)->set(object); } else { if (!object->path().is_root()) { SPtr<ObjectModel> parent = _object(object->path().parent()); @@ -98,12 +99,12 @@ ClientStore::remove_object(const Raul::Path& path) return SPtr<ObjectModel>(); } - SPtr<ObjectModel> object = dynamic_ptr_cast<ObjectModel>(top->second); + SPtr<ObjectModel> object = std::dynamic_pointer_cast<ObjectModel>(top->second); // Remove object and any adjacent arcs from parent if applicable if (object && object->parent()) { - SPtr<PortModel> port = dynamic_ptr_cast<PortModel>(object); - if (port && dynamic_ptr_cast<GraphModel>(port->parent())) { + SPtr<PortModel> port = std::dynamic_pointer_cast<PortModel>(object); + if (port && std::dynamic_pointer_cast<GraphModel>(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<ObjectModel>(); } else { - SPtr<ObjectModel> model = dynamic_ptr_cast<ObjectModel>(i->second); + SPtr<ObjectModel> model = std::dynamic_pointer_cast<ObjectModel>(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<ObjectModel> obj = dynamic_ptr_cast<ObjectModel>(_object(path)); + SPtr<ObjectModel> obj = std::dynamic_pointer_cast<ObjectModel>(_object(path)); if (obj) { obj->set_properties(properties); return; @@ -407,19 +408,19 @@ ClientStore::connection_graph(const Raul::Path& tail_path, SPtr<GraphModel> graph; if (tail_path.parent() == head_path.parent()) { - graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent())); + graph = std::dynamic_pointer_cast<GraphModel>(_object(tail_path.parent())); } if (!graph && tail_path.parent() == head_path.parent().parent()) { - graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent())); + graph = std::dynamic_pointer_cast<GraphModel>(_object(tail_path.parent())); } if (!graph && tail_path.parent().parent() == head_path.parent()) { - graph = dynamic_ptr_cast<GraphModel>(_object(head_path.parent())); + graph = std::dynamic_pointer_cast<GraphModel>(_object(head_path.parent())); } if (!graph) { - graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent().parent())); + graph = std::dynamic_pointer_cast<GraphModel>(_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<PortModel> tail = dynamic_ptr_cast<PortModel>(_object(tail_path)); - SPtr<PortModel> head = dynamic_ptr_cast<PortModel>(_object(head_path)); + SPtr<PortModel> tail = std::dynamic_pointer_cast<PortModel>(_object(tail_path)); + SPtr<PortModel> head = std::dynamic_pointer_cast<PortModel>(_object(head_path)); if (tail && head) { SPtr<GraphModel> graph = connection_graph(tail_path, head_path); @@ -457,8 +458,8 @@ ClientStore::operator()(const Connect& msg) void ClientStore::operator()(const Disconnect& msg) { - SPtr<PortModel> tail = dynamic_ptr_cast<PortModel>(_object(msg.tail)); - SPtr<PortModel> head = dynamic_ptr_cast<PortModel>(_object(msg.head)); + SPtr<PortModel> tail = std::dynamic_pointer_cast<PortModel>(_object(msg.tail)); + SPtr<PortModel> head = std::dynamic_pointer_cast<PortModel>(_object(msg.head)); SPtr<GraphModel> 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<GraphModel> graph = dynamic_ptr_cast<GraphModel>(_object(msg.graph)); + SPtr<GraphModel> graph = std::dynamic_pointer_cast<GraphModel>(_object(msg.graph)); SPtr<ObjectModel> 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<ArcModel> arc = dynamic_ptr_cast<ArcModel>(a.second); + SPtr<ArcModel> arc = std::dynamic_pointer_cast<ArcModel>(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 <cassert> +#include <memory> #include <string> #include <utility> @@ -33,13 +34,13 @@ GraphModel::add_child(const SPtr<ObjectModel>& c) { assert(c->parent().get() == this); - SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); + SPtr<PortModel> pm = std::dynamic_pointer_cast<PortModel>(c); if (pm) { add_port(pm); return; } - SPtr<BlockModel> bm = dynamic_ptr_cast<BlockModel>(c); + SPtr<BlockModel> bm = std::dynamic_pointer_cast<BlockModel>(c); if (bm) { _signal_new_block.emit(bm); } @@ -51,13 +52,13 @@ GraphModel::remove_child(const SPtr<ObjectModel>& o) assert(o->path().is_child_of(path())); assert(o->parent().get() == this); - SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(o); + SPtr<PortModel> pm = std::dynamic_pointer_cast<PortModel>(o); if (pm) { remove_arcs_on(pm); remove_port(pm); } - SPtr<BlockModel> bm = dynamic_ptr_cast<BlockModel>(o); + SPtr<BlockModel> bm = std::dynamic_pointer_cast<BlockModel>(o); if (bm) { _signal_removed_block.emit(bm); } @@ -74,7 +75,7 @@ GraphModel::remove_arcs_on(const SPtr<PortModel>& p) auto next = j; ++next; - SPtr<ArcModel> arc = dynamic_ptr_cast<ArcModel>(j->second); + SPtr<ArcModel> arc = std::dynamic_pointer_cast<ArcModel>(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<ArcModel>(i->second); + return std::dynamic_pointer_cast<ArcModel>(i->second); } else { return SPtr<ArcModel>(); } @@ -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<ArcModel> arc = dynamic_ptr_cast<ArcModel>(i->second); + SPtr<ArcModel> arc = std::dynamic_pointer_cast<ArcModel>(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 <cstdint> +#include <memory> #include <utility> namespace ingen { @@ -69,7 +70,7 @@ PortModel::set(const SPtr<ObjectModel>& model) { ObjectModel::set(model); - SPtr<PortModel> port = dynamic_ptr_cast<PortModel>(model); + SPtr<PortModel> port = std::dynamic_pointer_cast<PortModel>(model); if (port) { _index = port->_index; _direction = port->_direction; diff --git a/src/gui/App.cpp b/src/gui/App.cpp index e62a35e2..49ac2cae 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -55,6 +55,7 @@ #include <cassert> #include <fstream> +#include <memory> #include <string> #include <utility> @@ -217,11 +218,11 @@ App::request_plugins_if_necessary() SPtr<SigClientInterface> App::sig_client() { - SPtr<QueuedInterface> qi = dynamic_ptr_cast<QueuedInterface>(_client); + SPtr<QueuedInterface> qi = std::dynamic_pointer_cast<QueuedInterface>(_client); if (qi) { - return dynamic_ptr_cast<SigClientInterface>(qi->sink()); + return std::dynamic_pointer_cast<SigClientInterface>(qi->sink()); } - return dynamic_ptr_cast<SigClientInterface>(_client); + return std::dynamic_pointer_cast<SigClientInterface>(_client); } SPtr<Serialiser> @@ -427,7 +428,7 @@ App::gtk_main_iteration() return false; } } else { - dynamic_ptr_cast<QueuedInterface>(_client)->emit(); + std::dynamic_pointer_cast<QueuedInterface>(_client)->emit(); } _enable_signal = true; diff --git a/src/gui/Arc.cpp b/src/gui/Arc.cpp index b436dd26..02136770 100644 --- a/src/gui/Arc.cpp +++ b/src/gui/Arc.cpp @@ -19,6 +19,8 @@ #include "ingen/client/ArcModel.hpp" #include "ingen/client/BlockModel.hpp" +#include <memory> + #define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#" namespace ingen { @@ -32,7 +34,7 @@ Arc::Arc(Ganv::Canvas& canvas, { SPtr<const client::ObjectModel> tparent = model->tail()->parent(); SPtr<const client::BlockModel> tparent_block; - if ((tparent_block = dynamic_ptr_cast<const client::BlockModel>(tparent))) { + 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); set_constraining(false); diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 65cb1c7d..2f13e522 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -38,6 +38,7 @@ #include <gtkmm/stock.h> #include <limits> +#include <memory> #include <string> #include <utility> @@ -230,7 +231,7 @@ ConnectWindow::connect(bool existing) if (existing) { uri_str = world.interface()->uri(); _connect_stage = 1; - SPtr<client::SocketClient> client = dynamic_ptr_cast<client::SocketClient>( + SPtr<client::SocketClient> client = std::dynamic_pointer_cast<client::SocketClient>( world.interface()); if (client) { _app->attach(client->respondee()); @@ -527,7 +528,7 @@ ConnectWindow::gtk_callback() next_stage(); } else if (_connect_stage == 4) { if (!_app->store()->empty()) { - SPtr<const GraphModel> root = dynamic_ptr_cast<const GraphModel>( + SPtr<const GraphModel> root = std::dynamic_pointer_cast<const GraphModel>( _app->store()->object(Raul::Path("/"))); if (root) { set_connected_to(_app->interface()); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index e457dfd8..0905a967 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -47,6 +47,7 @@ #endif #include <cassert> +#include <memory> #include <sstream> #include <string> @@ -255,7 +256,7 @@ GraphBox::set_graph_from_path(const Raul::Path& path, assert(view->graph()->path() == path); _app->window_factory()->present_graph(view->graph(), _window, view); } else { - SPtr<const GraphModel> model = dynamic_ptr_cast<const GraphModel>( + SPtr<const GraphModel> model = std::dynamic_pointer_cast<const GraphModel>( _app->store()->object(path)); if (model) { _app->window_factory()->present_graph(model, _window); @@ -814,7 +815,9 @@ GraphBox::event_arrange() void GraphBox::event_parent_activated() { - SPtr<client::GraphModel> parent = dynamic_ptr_cast<client::GraphModel>(_graph->parent()); + SPtr<client::GraphModel> parent = + std::dynamic_pointer_cast<client::GraphModel>(_graph->parent()); + if (parent) { _app->window_factory()->present_graph(parent, _window); } diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index b6a8e5a2..47d69475 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -50,6 +50,7 @@ #include <algorithm> #include <cassert> #include <map> +#include <memory> #include <set> #include <string> @@ -236,7 +237,7 @@ GraphCanvas::build() // Create modules for blocks for (Store::const_iterator i = kids.first; i != kids.second; ++i) { - SPtr<BlockModel> block = dynamic_ptr_cast<BlockModel>(i->second); + SPtr<BlockModel> block = std::dynamic_pointer_cast<BlockModel>(i->second); if (block && block->parent() == _graph) { add_block(block); } @@ -249,7 +250,7 @@ GraphCanvas::build() // Create arcs for (const auto& a : _graph->arcs()) { - connection(dynamic_ptr_cast<ArcModel>(a.second)); + connection(std::dynamic_pointer_cast<ArcModel>(a.second)); } } @@ -324,7 +325,7 @@ GraphCanvas::remove_plugin(const URI& uri) void GraphCanvas::add_block(const SPtr<const BlockModel>& bm) { - SPtr<const GraphModel> pm = dynamic_ptr_cast<const GraphModel>(bm); + SPtr<const GraphModel> pm = std::dynamic_pointer_cast<const GraphModel>(bm); NodeModule* module = nullptr; if (pm) { module = SubgraphModule::create(*this, pm, _human_names); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 27babbfd..cf9858a3 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -31,6 +31,7 @@ #include "ingen/client/GraphModel.hpp" #include <cassert> +#include <memory> #include <string> #include <utility> @@ -48,7 +49,7 @@ GraphPortModule::GraphPortModule(GraphCanvas& canvas, { assert(model); - assert(dynamic_ptr_cast<const GraphModel>(model->parent())); + assert(std::dynamic_pointer_cast<const GraphModel>(model->parent())); set_stacked(model->polyphonic()); if (model->is_input() && !model->is_numeric()) { diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 2179c964..ff4e5f70 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -24,6 +24,8 @@ #include "ingen/client/GraphModel.hpp" #include "raul/Path.hpp" +#include <memory> + namespace ingen { using namespace client; @@ -76,7 +78,7 @@ GraphTreeWindow::init(App& app, ClientStore& store) void GraphTreeWindow::new_object(const SPtr<ObjectModel>& object) { - SPtr<GraphModel> graph = dynamic_ptr_cast<GraphModel>(object); + SPtr<GraphModel> graph = std::dynamic_pointer_cast<GraphModel>(object); if (graph) { add_graph(graph); } diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index 2a3268b4..8bc820e8 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -26,6 +26,7 @@ #include <gtkmm/menu.h> #include <gtkmm/menushell.h> +#include <memory> #include <string> namespace ingen { @@ -50,7 +51,7 @@ public: protected: SPtr<const client::BlockModel> block() const { - return dynamic_ptr_cast<const client::BlockModel>(_object); + return std::dynamic_pointer_cast<const client::BlockModel>(_object); } void add_preset(const URI& uri, const std::string& label); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 7cecfd46..1c62dd10 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -41,6 +41,7 @@ #include <gtkmm/eventbox.h> #include <cassert> +#include <memory> #include <string> namespace ingen { @@ -137,7 +138,7 @@ NodeModule::create(GraphCanvas& canvas, SPtr<const BlockModel> block, bool human) { - SPtr<const GraphModel> graph = dynamic_ptr_cast<const GraphModel>(block); + SPtr<const GraphModel> graph = std::dynamic_pointer_cast<const GraphModel>(block); NodeModule* ret = (graph) ? new SubgraphModule(canvas, graph) @@ -429,13 +430,13 @@ NodeModule::on_event(GdkEvent* ev) return on_double_click(&ev->button); } else if (ev->type == GDK_ENTER_NOTIFY) { GraphBox* const box = app().window_factory()->graph_box( - dynamic_ptr_cast<const GraphModel>(_block->parent())); + std::dynamic_pointer_cast<const GraphModel>(_block->parent())); if (box) { box->object_entered(_block.get()); } } else if (ev->type == GDK_LEAVE_NOTIFY) { GraphBox* const box = app().window_factory()->graph_box( - dynamic_ptr_cast<const GraphModel>(_block->parent())); + std::dynamic_pointer_cast<const GraphModel>(_block->parent())); if (box) { box->object_left(_block.get()); } diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 73ad837a..4282343e 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -35,6 +35,7 @@ #include "ingen/client/PortModel.hpp" #include <cassert> +#include <memory> #include <string> using namespace ingen::client; @@ -125,7 +126,7 @@ Port::port_label(App& app, SPtr<const PortModel> pm) label = name.ptr<char>(); } else { const SPtr<const BlockModel> parent( - dynamic_ptr_cast<const BlockModel>(pm->parent())); + std::dynamic_pointer_cast<const BlockModel>(pm->parent())); if (parent && parent->plugin_model()) { label = parent->plugin_model()->port_human_name(pm->index()); } @@ -150,7 +151,7 @@ Port::update_metadata() { SPtr<const PortModel> pm = _port_model.lock(); if (pm && _app.can_control(pm.get()) && pm->is_numeric()) { - SPtr<const BlockModel> parent = dynamic_ptr_cast<const BlockModel>(pm->parent()); + SPtr<const BlockModel> parent = std::dynamic_pointer_cast<const BlockModel>(pm->parent()); if (parent) { float min = 0.0f; float max = 1.0f; @@ -230,7 +231,7 @@ Port::on_scale_point_activated(float f) Gtk::Menu* Port::build_enum_menu() { - SPtr<const BlockModel> block = dynamic_ptr_cast<BlockModel>(model()->parent()); + SPtr<const BlockModel> block = std::dynamic_pointer_cast<BlockModel>(model()->parent()); Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); PluginModel::ScalePoints points = block->plugin_model()->port_scale_points( @@ -259,7 +260,7 @@ Gtk::Menu* Port::build_uri_menu() { World& world = _app.world(); - SPtr<const BlockModel> block = dynamic_ptr_cast<BlockModel>(model()->parent()); + SPtr<const BlockModel> block = std::dynamic_pointer_cast<BlockModel>(model()->parent()); Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); // Get the port designation, which should be a rdf:Property @@ -373,10 +374,10 @@ Port::activity(const Atom& value) GraphBox* Port::get_graph_box() const { - SPtr<const GraphModel> graph = dynamic_ptr_cast<const GraphModel>(model()->parent()); + SPtr<const GraphModel> graph = std::dynamic_pointer_cast<const GraphModel>(model()->parent()); GraphBox* box = _app.window_factory()->graph_box(graph); if (!box) { - graph = dynamic_ptr_cast<const GraphModel>(model()->parent()->parent()); + graph = std::dynamic_pointer_cast<const GraphModel>(model()->parent()->parent()); box = _app.window_factory()->graph_box(graph); } return box; @@ -514,7 +515,9 @@ Port::on_selected(gboolean b) if (b) { SPtr<const PortModel> pm = _port_model.lock(); if (pm) { - SPtr<const BlockModel> block = dynamic_ptr_cast<const BlockModel>(pm->parent()); + SPtr<const BlockModel> block = + std::dynamic_pointer_cast<const BlockModel>(pm->parent()); + GraphWindow* win = _app.window_factory()->parent_graph_window(block); if (win && win->documentation_is_visible() && block->plugin_model()) { bool html = false; diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index ff3d2571..2fc8ec2e 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -24,6 +24,7 @@ #include "ingen/client/PortModel.hpp" #include "ingen/types.hpp" +#include <memory> #include <string> namespace ingen { @@ -65,7 +66,7 @@ PortMenu::init(App& app, SPtr<const PortModel> port, bool internal_graph_port) sigc::mem_fun(this, &PortMenu::on_menu_expose)); const bool is_control(app.can_control(port.get()) && port->is_numeric()); - const bool is_on_graph(dynamic_ptr_cast<GraphModel>(port->parent())); + const bool is_on_graph(std::dynamic_pointer_cast<GraphModel>(port->parent())); const bool is_input(port->is_input()); if (!is_on_graph) { @@ -108,7 +109,7 @@ void PortMenu::on_menu_set_min() { const URIs& uris = _app->uris(); - SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object); + SPtr<const PortModel> model = std::dynamic_pointer_cast<const PortModel>(_object); const Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) { _app->set_property(_object->uri(), uris.lv2_minimum, value); @@ -119,7 +120,7 @@ void PortMenu::on_menu_set_max() { const URIs& uris = _app->uris(); - SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object); + SPtr<const PortModel> model = std::dynamic_pointer_cast<const PortModel>(_object); const Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) { _app->set_property(_object->uri(), uris.lv2_maximum, value); @@ -130,7 +131,7 @@ void PortMenu::on_menu_reset_range() { const URIs& uris = _app->uris(); - SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object); + SPtr<const PortModel> model = std::dynamic_pointer_cast<const PortModel>(_object); // Remove lv2:minimum and lv2:maximum properties Properties remove; @@ -143,8 +144,8 @@ void PortMenu::on_menu_expose() { const URIs& uris = _app->uris(); - SPtr<const PortModel> port = dynamic_ptr_cast<const PortModel>(_object); - SPtr<const BlockModel> block = dynamic_ptr_cast<const BlockModel>(port->parent()); + SPtr<const PortModel> port = std::dynamic_pointer_cast<const PortModel>(_object); + SPtr<const BlockModel> block = std::dynamic_pointer_cast<const BlockModel>(port->parent()); const std::string label = block->label() + " " + block->port_label(port); const Raul::Path path = Raul::Path(block->path() + Raul::Symbol("_" + port->symbol())); diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index 52c37787..999e06a2 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -27,6 +27,7 @@ #include "ingen/client/GraphModel.hpp" #include <cassert> +#include <memory> #include <utility> namespace ingen { @@ -48,7 +49,7 @@ SubgraphModule::on_double_click(GdkEventButton* event) { assert(_graph); - SPtr<GraphModel> parent = dynamic_ptr_cast<GraphModel>(_graph->parent()); + SPtr<GraphModel> parent = std::dynamic_pointer_cast<GraphModel>(_graph->parent()); GraphWindow* const preferred = ( (parent && (event->state & GDK_SHIFT_MASK)) ? nullptr @@ -84,7 +85,7 @@ SubgraphModule::browse_to_graph() { assert(_graph->parent()); - SPtr<GraphModel> parent = dynamic_ptr_cast<GraphModel>(_graph->parent()); + SPtr<GraphModel> parent = std::dynamic_pointer_cast<GraphModel>(_graph->parent()); GraphWindow* const preferred = (parent) ? app().window_factory()->graph_window(parent) diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index d85987f0..43a2110c 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -29,6 +29,7 @@ #include "ingen/client/GraphModel.hpp" #include <cassert> +#include <memory> #include <stdexcept> #include <string> #include <utility> @@ -127,7 +128,7 @@ WindowFactory::parent_graph_window(SPtr<const BlockModel> block) return nullptr; } - return graph_window(dynamic_ptr_cast<GraphModel>(block->parent())); + return graph_window(std::dynamic_pointer_cast<GraphModel>(block->parent())); } /** Present a GraphWindow for a Graph. diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp index 4504d3fe..c26bd205 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -21,6 +21,8 @@ #include "App.hpp" +#include <memory> + namespace ingen { namespace gui { @@ -32,7 +34,7 @@ struct GUIModule : public Module { if (!world.interface()) { world.set_interface( world.new_interface(URI(uri), make_client(world))); - } else if (!dynamic_ptr_cast<SigClientInterface>( + } else if (!std::dynamic_pointer_cast<SigClientInterface>( world.interface()->respondee())) { world.interface()->set_respondee(make_client(world)); } diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index e1c1eef7..ce33f2ac 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -45,6 +45,7 @@ #include <cstdint> #include <cstring> +#include <memory> #define INGEN_LV2_UI_URI INGEN_NS "GraphUIGtk2" @@ -168,7 +169,7 @@ instantiate(const LV2UI_Descriptor* descriptor, // Create a GraphBox for the root and set as the UI widget SPtr<const ingen::client::GraphModel> root = - ingen::dynamic_ptr_cast<const ingen::client::GraphModel>( + std::dynamic_pointer_cast<const ingen::client::GraphModel>( ui->app->store()->object(Raul::Path("/"))); ui->view = ingen::gui::GraphBox::create(*ui->app, root); ui->view->unparent(); diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 06bd13c5..c14690b1 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -23,8 +23,8 @@ #include "RunContext.hpp" #include "ThreadManager.hpp" +#include "lv2/urid/urid.h" #include "raul/Array.hpp" -#include "raul/Maid.hpp" #include "raul/Symbol.hpp" #include <cassert> @@ -33,6 +33,9 @@ #include <string> namespace ingen { + +class Resource; + namespace server { BlockImpl::BlockImpl(PluginImpl* plugin, diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 8256981b..3ac253b7 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -58,6 +58,7 @@ #include <cstdint> #include <cstdio> #include <limits> +#include <memory> #include <thread> #include <utility> @@ -161,7 +162,7 @@ Engine::~Engine() const SPtr<Store> store = this->store(); if (store) { for (auto& s : *store.get()) { - if (!dynamic_ptr_cast<NodeImpl>(s.second)->parent()) { + if (!std::dynamic_pointer_cast<NodeImpl>(s.second)->parent()) { s.second.reset(); } } diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index c7db23ee..9001b01a 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -17,7 +17,17 @@ #include "EventWriter.hpp" #include "Engine.hpp" -#include "events.hpp" + +#include "events/Connect.hpp" +#include "events/Copy.hpp" +#include "events/Delete.hpp" +#include "events/Delta.hpp" +#include "events/Disconnect.hpp" +#include "events/DisconnectAll.hpp" +#include "events/Get.hpp" +#include "events/Mark.hpp" +#include "events/Move.hpp" +#include "events/Undo.hpp" #include <boost/variant/apply_visitor.hpp> diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 00d4cfd6..502b5465 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -34,6 +34,7 @@ #include <cassert> #include <cstddef> #include <map> +#include <memory> #include <unordered_map> namespace ingen { @@ -116,7 +117,7 @@ GraphImpl::duplicate(Engine& engine, // Add duplicates of all arcs for (const auto& a : _arcs) { - SPtr<ArcImpl> arc = dynamic_ptr_cast<ArcImpl>(a.second); + SPtr<ArcImpl> arc = std::dynamic_pointer_cast<ArcImpl>(a.second); if (arc) { auto t = port_map.find(arc->tail()); auto h = port_map.find(arc->head()); @@ -287,7 +288,7 @@ GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port) ThreadManager::assert_thread(THREAD_PRE_PROCESS); auto i = _arcs.find(std::make_pair(tail, dst_port)); if (i != _arcs.end()) { - SPtr<ArcImpl> arc = dynamic_ptr_cast<ArcImpl>(i->second); + SPtr<ArcImpl> arc = std::dynamic_pointer_cast<ArcImpl>(i->second); _arcs.erase(i); return arc; } else { diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 3e3c6159..04e3ea99 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -22,6 +22,7 @@ #include "ThreadManager.hpp" #include "ingen/types.hpp" +#include "lv2/urid/urid.h" #include <cassert> #include <cstdint> diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index e0d198d7..8e6bcb26 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -21,11 +21,15 @@ #include "LV2Block.hpp" #include "ingen/Log.hpp" +#include "ingen/types.hpp" #include "lv2/worker/worker.h" #include <cstdlib> namespace ingen { + +class World; + namespace server { /// A message in the Worker::_requests ring diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index 5418af4b..a49fa3e4 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -28,6 +28,7 @@ #include "ingen/World.hpp" #include "raul/Path.hpp" +#include <memory> #include <mutex> #include <string> #include <utility> @@ -63,7 +64,7 @@ Copy::pre_process(PreProcessContext& ctx) } // Ensure it is a block (ports are not supported for now) - if (!(_old_block = dynamic_ptr_cast<BlockImpl>(i->second))) { + if (!(_old_block = std::dynamic_pointer_cast<BlockImpl>(i->second))) { return Event::pre_process_done(Status::BAD_OBJECT_TYPE, old_path); } @@ -143,7 +144,7 @@ bool Copy::engine_to_filesystem(PreProcessContext&) { // Ensure source is a graph - SPtr<GraphImpl> graph = dynamic_ptr_cast<GraphImpl>(_old_block); + SPtr<GraphImpl> graph = std::dynamic_pointer_cast<GraphImpl>(_old_block); if (!graph) { return Event::pre_process_done(Status::BAD_OBJECT_TYPE, _msg.old_uri); } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index f5f2e272..e91ab5ef 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -36,6 +36,7 @@ #include <cassert> #include <cstddef> +#include <memory> #include <mutex> #include <string> @@ -79,8 +80,8 @@ Delete::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::NOT_FOUND, _path); } - if (!(_block = dynamic_ptr_cast<BlockImpl>(iter->second))) { - _port = dynamic_ptr_cast<DuplexPort>(iter->second); + if (!(_block = std::dynamic_pointer_cast<BlockImpl>(iter->second))) { + _port = std::dynamic_pointer_cast<DuplexPort>(iter->second); } if ((!_block && !_port) || (_port && !_engine.driver()->dynamic_ports())) { diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index a33fd482..84ecf5ba 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -633,7 +633,7 @@ ingen_connect_port(LV2_Handle instance, uint32_t port, void* data) auto* me = static_cast<IngenPlugin*>(instance); server::Engine* engine = static_cast<server::Engine*>(me->world->engine().get()); - const SPtr<LV2Driver>& driver = static_ptr_cast<LV2Driver>(engine->driver()); + const SPtr<LV2Driver>& driver = std::static_pointer_cast<LV2Driver>(engine->driver()); if (port < driver->ports().size()) { driver->ports().at(port)->set_buffer(data); } else { @@ -645,8 +645,8 @@ static void ingen_activate(LV2_Handle instance) { auto* me = static_cast<IngenPlugin*>(instance); - SPtr<server::Engine> engine = static_ptr_cast<server::Engine>(me->world->engine()); - const SPtr<LV2Driver>& driver = static_ptr_cast<LV2Driver>(engine->driver()); + SPtr<server::Engine> engine = std::static_pointer_cast<server::Engine>(me->world->engine()); + const SPtr<LV2Driver>& driver = std::static_pointer_cast<LV2Driver>(engine->driver()); engine->activate(); me->main = make_unique<std::thread>(ingen_lv2_main, engine, driver); } @@ -655,8 +655,8 @@ static void ingen_run(LV2_Handle instance, uint32_t sample_count) { auto* me = static_cast<IngenPlugin*>(instance); - SPtr<server::Engine> engine = static_ptr_cast<server::Engine>(me->world->engine()); - const SPtr<LV2Driver>& driver = static_ptr_cast<LV2Driver>(engine->driver()); + SPtr<server::Engine> engine = std::static_pointer_cast<server::Engine>(me->world->engine()); + const SPtr<LV2Driver>& driver = std::static_pointer_cast<LV2Driver>(engine->driver()); server::ThreadManager::set_flag(ingen::server::THREAD_PROCESS); server::ThreadManager::set_flag(ingen::server::THREAD_IS_REAL_TIME); |