1 #include <pbd/controllable.h>
9 sigc::signal<void,Controllable*> Controllable::Destroyed;
10 sigc::signal<bool,Controllable*> Controllable::StartLearning;
11 sigc::signal<void,Controllable*> Controllable::StopLearning;
13 Glib::Mutex* Controllable::registry_lock = 0;
14 Controllable::Controllables Controllable::registry;
16 Controllable::Controllable (std::string name)
19 if (registry_lock == 0) {
20 registry_lock = new Glib::Mutex;
29 Glib::Mutex::Lock lm (*registry_lock);
30 registry.insert (this);
31 this->GoingAway.connect (mem_fun (this, &Controllable::remove));
35 Controllable::remove ()
37 Glib::Mutex::Lock lm (*registry_lock);
38 for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
47 Controllable::by_id (const ID& id)
49 Glib::Mutex::Lock lm (*registry_lock);
51 for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
52 if ((*i)->id() == id) {
61 Controllable::by_name (const std::string& str)
63 Glib::Mutex::Lock lm (*registry_lock);
65 for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
66 if ((*i)->_name == str) {
74 Controllable::get_state ()
76 XMLNode* node = new XMLNode (X_("controllable"));
79 node->add_property (X_("name"), _name); // not reloaded from XML state, just there to look at
80 _id.print (buf, sizeof (buf));
81 node->add_property (X_("id"), buf);
86 Controllable::set_state (const XMLNode& node)
88 const XMLProperty* prop = node.property (X_("id"));
94 error << _("Controllable state node has no ID property") << endmsg;