From df1447c665e6c3631961297a9d3e9aff4e94c47f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Jan 2013 23:38:03 +0000 Subject: Remove Raul::SharedPtr and switch to std::shared_ptr. Use project local short type aliases for shared_ptr and friends. Move Raul::Disposable and Raul::Manageable into Raul::Maid. Use sets to store machina nodes and edges to avoid O(n) searches. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4939 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/BlockModel.cpp | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'src/client/BlockModel.cpp') diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index eb982f0d..0ed58c7a 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -25,9 +25,9 @@ namespace Ingen { namespace Client { -BlockModel::BlockModel(URIs& uris, - SharedPtr plugin, - const Raul::Path& path) +BlockModel::BlockModel(URIs& uris, + SPtr plugin, + const Raul::Path& path) : ObjectModel(uris, path) , _plugin_uri(plugin->uri()) , _plugin(plugin) @@ -65,7 +65,7 @@ BlockModel::~BlockModel() } void -BlockModel::remove_port(SharedPtr port) +BlockModel::remove_port(SPtr port) { for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { if ((*i) == port) { @@ -99,26 +99,26 @@ BlockModel::clear() } void -BlockModel::add_child(SharedPtr c) +BlockModel::add_child(SPtr c) { assert(c->parent().get() == this); //ObjectModel::add_child(c); - SharedPtr pm = PtrCast(c); + SPtr pm = dynamic_ptr_cast(c); assert(pm); add_port(pm); } bool -BlockModel::remove_child(SharedPtr c) +BlockModel::remove_child(SPtr c) { assert(c->path().is_child_of(path())); assert(c->parent().get() == this); //bool ret = ObjectModel::remove_child(c); - SharedPtr pm = PtrCast(c); + SPtr pm = dynamic_ptr_cast(c); assert(pm); remove_port(pm); @@ -127,7 +127,7 @@ BlockModel::remove_child(SharedPtr c) } void -BlockModel::add_port(SharedPtr pm) +BlockModel::add_port(SPtr pm) { assert(pm); assert(pm->path().is_child_of(path())); @@ -140,13 +140,13 @@ BlockModel::add_port(SharedPtr pm) _signal_new_port.emit(pm); } -SharedPtr +SPtr BlockModel::get_port(const Raul::Symbol& symbol) const { for (auto p : _ports) if (p->symbol() == symbol) return p; - return SharedPtr(); + return SPtr(); } Ingen::Node* @@ -158,10 +158,10 @@ BlockModel::port(uint32_t index) const } void -BlockModel::default_port_value_range(SharedPtr port, - float& min, - float& max, - uint32_t srate) const +BlockModel::default_port_value_range(SPtr port, + float& min, + float& max, + uint32_t srate) const { // Default control values min = 0.0; @@ -190,8 +190,10 @@ BlockModel::default_port_value_range(SharedPtr port, } void -BlockModel::port_value_range(SharedPtr port, - float& min, float& max, uint32_t srate) const +BlockModel::port_value_range(SPtr port, + float& min, + float& max, + uint32_t srate) const { assert(port->parent().get() == this); @@ -228,7 +230,7 @@ BlockModel::label() const } std::string -BlockModel::port_label(SharedPtr port) const +BlockModel::port_label(SPtr port) const { const Raul::Atom& name = port->get_property(Raul::URI(LV2_CORE__name)); if (name.is_valid()) { @@ -255,9 +257,9 @@ BlockModel::port_label(SharedPtr port) const } void -BlockModel::set(SharedPtr model) +BlockModel::set(SPtr model) { - SharedPtr block = PtrCast(model); + SPtr block = dynamic_ptr_cast(model); if (block) { _plugin_uri = block->_plugin_uri; _plugin = block->_plugin; -- cgit v1.2.1