Audacity 3.2.0
PluginHost.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file PluginHost.h
6
7 @author Vitaly Sverchinsky
8
9 Part of lib-module-manager library
10
11**********************************************************************/
12
13#pragma once
14
15#include "IPCChannel.h"
16#include <memory>
17#include <mutex>
18#include <optional>
19#include <condition_variable>
20#include <wx/string.h>
21
22#include "IPCClient.h"
23#include "PluginIPCUtils.h"
24
35class MODULE_MANAGER_API PluginHost final : public IPCChannelStatusCallback
36{
37 static constexpr auto HostArgument = "--host";
38
39 std::unique_ptr<IPCClient> mClient;
40 IPCChannel* mChannel{nullptr};
42 std::mutex mSync;
43 std::condition_variable mRequestCondition;
44 std::optional<wxString> mRequest;
45
46 bool mRunning{true};
47
48 void Stop() noexcept;
49
50public:
56 static bool Start(int connectPort);
57
59 static bool IsHostProcess();
60
61 explicit PluginHost(int connectPort);
62
63 void OnConnect(IPCChannel& channel) noexcept override;
64 void OnDisconnect() noexcept override;
65 void OnConnectionError() noexcept override;
66 void OnDataAvailable(const void* data, size_t size) noexcept override;
67
68 bool Serve();
69};
Interface for sending data from client to server or vice versa, complemented by IPCChannelStatusCallb...
Definition: IPCChannel.h:22
Interface for listening connection status changes.
Definition: IPCChannel.h:37
Internal class, processes plugin validation requests from the main app. Request is a simple string fo...
Definition: PluginHost.h:36
detail::InputMessageReader mInputMessageReader
Definition: PluginHost.h:41
std::mutex mSync
Definition: PluginHost.h:42
std::optional< wxString > mRequest
Definition: PluginHost.h:44
std::unique_ptr< IPCClient > mClient
Definition: PluginHost.h:39
std::condition_variable mRequestCondition
Definition: PluginHost.h:43