summaryrefslogtreecommitdiffstats
path: root/src/client/BlockModel.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-12 23:38:03 +0000
committerDavid Robillard <d@drobilla.net>2013-01-12 23:38:03 +0000
commitdf1447c665e6c3631961297a9d3e9aff4e94c47f (patch)
treec0ff117c362e6d571f430f886ab62f372b59af08 /src/client/BlockModel.cpp
parentbb335dca695273622b7a4ebbefbe9e089edb9ab4 (diff)
downloadingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.tar.gz
ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.tar.bz2
ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.zip
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
Diffstat (limited to 'src/client/BlockModel.cpp')
-rw-r--r--src/client/BlockModel.cpp42
1 files changed, 22 insertions, 20 deletions
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<PluginModel> plugin,
- const Raul::Path& path)
+BlockModel::BlockModel(URIs& uris,
+ SPtr<PluginModel> 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<PortModel> port)
+BlockModel::remove_port(SPtr<PortModel> 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<ObjectModel> c)
+BlockModel::add_child(SPtr<ObjectModel> c)
{
assert(c->parent().get() == this);
//ObjectModel::add_child(c);
- SharedPtr<PortModel> pm = PtrCast<PortModel>(c);
+ SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c);
assert(pm);
add_port(pm);
}
bool
-BlockModel::remove_child(SharedPtr<ObjectModel> c)
+BlockModel::remove_child(SPtr<ObjectModel> c)
{
assert(c->path().is_child_of(path()));
assert(c->parent().get() == this);
//bool ret = ObjectModel::remove_child(c);
- SharedPtr<PortModel> pm = PtrCast<PortModel>(c);
+ SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c);
assert(pm);
remove_port(pm);
@@ -127,7 +127,7 @@ BlockModel::remove_child(SharedPtr<ObjectModel> c)
}
void
-BlockModel::add_port(SharedPtr<PortModel> pm)
+BlockModel::add_port(SPtr<PortModel> pm)
{
assert(pm);
assert(pm->path().is_child_of(path()));
@@ -140,13 +140,13 @@ BlockModel::add_port(SharedPtr<PortModel> pm)
_signal_new_port.emit(pm);
}
-SharedPtr<const PortModel>
+SPtr<const PortModel>
BlockModel::get_port(const Raul::Symbol& symbol) const
{
for (auto p : _ports)
if (p->symbol() == symbol)
return p;
- return SharedPtr<PortModel>();
+ return SPtr<PortModel>();
}
Ingen::Node*
@@ -158,10 +158,10 @@ BlockModel::port(uint32_t index) const
}
void
-BlockModel::default_port_value_range(SharedPtr<const PortModel> port,
- float& min,
- float& max,
- uint32_t srate) const
+BlockModel::default_port_value_range(SPtr<const PortModel> 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<const PortModel> port,
}
void
-BlockModel::port_value_range(SharedPtr<const PortModel> port,
- float& min, float& max, uint32_t srate) const
+BlockModel::port_value_range(SPtr<const PortModel> 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<const PortModel> port) const
+BlockModel::port_label(SPtr<const PortModel> 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<const PortModel> port) const
}
void
-BlockModel::set(SharedPtr<ObjectModel> model)
+BlockModel::set(SPtr<ObjectModel> model)
{
- SharedPtr<BlockModel> block = PtrCast<BlockModel>(model);
+ SPtr<BlockModel> block = dynamic_ptr_cast<BlockModel>(model);
if (block) {
_plugin_uri = block->_plugin_uri;
_plugin = block->_plugin;