From a811583380f8181c537094b12bd5e18bce75da50 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 17 May 2022 23:29:08 +0200 Subject: [PATCH] Add API to query registered controllers --- libs/pbd/controllable.cc | 11 +++++++++++ libs/pbd/pbd/controllable.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index e9fd872609..43c385349c 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -145,6 +145,17 @@ Controllable::by_id (const ID& id) return boost::shared_ptr(); } +Controllable::ControllableSet +Controllable::registered_controllables () +{ + ControllableSet rv; + Glib::Threads::RWLock::ReaderLock lm (registry_lock); + for (auto const& i : registry) { + rv.insert (i->shared_from_this ()); + } + return rv; +} + void Controllable::dump_registry () { diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 7f4a202b7f..6494484ae5 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -169,6 +169,10 @@ public: static boost::shared_ptr by_id (const PBD::ID&); static void dump_registry (); + + typedef std::set> ControllableSet; + static ControllableSet registered_controllables (); + static const std::string xml_node_name; protected: