diff options
author | Robin Gareus <robin@gareus.org> | 2019-03-23 01:37:28 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-03-23 01:42:03 +0100 |
commit | 1dedadd03f83663ecda2ec0a49c16dbec8d6bd18 (patch) | |
tree | 875e8e9306793df5170cefffacd0f504c875b4b1 /libs/pbd | |
parent | baed14c17e1ff27887afdb4e661bc877081d1e16 (diff) |
Remove c-pointer Controllable* registry
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/controllable.cc | 63 | ||||
-rw-r--r-- | libs/pbd/pbd/controllable.h | 9 |
2 files changed, 1 insertions, 71 deletions
diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index fa25826294..69a58b4d0e 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -34,74 +34,13 @@ PBD::Signal1<bool,Controllable*> Controllable::StartLearning; PBD::Signal1<void,Controllable*> Controllable::StopLearning; PBD::Signal1<void, boost::weak_ptr<PBD::Controllable> > Controllable::GUIFocusChanged; -Glib::Threads::RWLock Controllable::registry_lock; -Controllable::Controllables Controllable::registry; -PBD::ScopedConnectionList* registry_connections = 0; const std::string Controllable::xml_node_name = X_("Controllable"); Controllable::Controllable (const string& name, Flag f) : _name (name) , _flags (f) , _touching (false) -{ - add (*this); -} - -void -Controllable::add (Controllable& ctl) -{ - using namespace boost; - - Glib::Threads::RWLock::WriterLock lm (registry_lock); - registry.insert (&ctl); - - if (!registry_connections) { - registry_connections = new ScopedConnectionList; - } - - /* Controllable::remove() is static - no need to manage this connection */ - - ctl.DropReferences.connect_same_thread (*registry_connections, boost::bind (&Controllable::remove, &ctl)); -} - -void -Controllable::remove (Controllable* ctl) -{ - Glib::Threads::RWLock::WriterLock lm (registry_lock); - - for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) { - if ((*i) == ctl) { - registry.erase (i); - break; - } - } -} - -Controllable* -Controllable::by_id (const ID& id) -{ - Glib::Threads::RWLock::ReaderLock lm (registry_lock); - - for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) { - if ((*i)->id() == id) { - return (*i); - } - } - return 0; -} - -Controllable* -Controllable::by_name (const string& str) -{ - Glib::Threads::RWLock::ReaderLock lm (registry_lock); - - for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) { - if ((*i)->_name == str) { - return (*i); - } - } - return 0; -} +{} XMLNode& Controllable::get_state () diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index d40530c7e2..dbbea5dc5f 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -150,8 +150,6 @@ public: Flag flags() const { return _flags; } void set_flags (Flag f); - static Controllable* by_id (const PBD::ID&); - static Controllable* by_name (const std::string&); static const std::string xml_node_name; protected: @@ -167,13 +165,6 @@ private: std::string _units; Flag _flags; bool _touching; - - static void add (Controllable&); - static void remove (Controllable*); - - typedef std::set<PBD::Controllable*> Controllables; - static Glib::Threads::RWLock registry_lock; - static Controllables registry; }; /* a utility class for the occasions when you need but do not have |