f0b7846978a96b649b2014dfd8281bb6aa47c5e9
[ardour.git] / libs / ardour / ardour / control_protocol_manager.h
1 #ifndef ardour_control_protocol_manager_h
2 #define ardour_control_protocol_manager_h
3
4 #include <string>
5 #include <list>
6
7 #include <pbd/lockmonitor.h>
8
9 namespace ARDOUR {
10
11 class ControlProtocol;
12 class ControlProtocolDescriptor;
13
14 struct ControlProtocolInfo {
15     ControlProtocolDescriptor* descriptor;
16     ControlProtocol* protocol;
17     std::string name;
18     std::string path;
19 };
20
21 class ControlProtocolManager
22 {
23   public:
24         ControlProtocolManager ();
25         ~ControlProtocolManager ();
26
27         static ControlProtocolManager& instance() { return *_instance; }
28
29         void discover_control_protocols (std::string search_path);
30         void startup (Session&);
31
32         ControlProtocol* instantiate (Session&, std::string protocol_name);
33         int              teardown (std::string protocol_name);
34
35   private:
36         static ControlProtocolManager* _instance;
37
38         PBD::Lock protocols_lock;
39         std::list<ControlProtocolInfo*> control_protocol_info;
40         std::list<ControlProtocol*>    control_protocols;
41
42         int control_protocol_discover (std::string path);
43         ControlProtocolDescriptor* get_descriptor (std::string path);
44 };
45
46 } // namespace
47
48 #endif // ardour_control_protocol_manager_h