OpenShot Audio Library | OpenShotAudio  0.6.0
juce_ConnectedChildProcess.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2022 - Raw Material Software Limited
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  The code included in this file is provided under the terms of the ISC license
11  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12  To use, copy, modify, and/or distribute this software for any purpose with or
13  without fee is hereby granted provided that the above copyright notice and
14  this permission notice appear in all copies.
15 
16  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18  DISCLAIMED.
19 
20  ==============================================================================
21 */
22 
23 namespace juce
24 {
25 
26 //==============================================================================
47 class JUCE_API ChildProcessWorker
48 {
49 public:
54 
57 
74  bool initialiseFromCommandLine (const String& commandLine,
75  const String& commandLineUniqueID,
76  int timeoutMs = 0);
77 
78  //==============================================================================
84  virtual void handleMessageFromCoordinator (const MemoryBlock& mb);
85 
86  [[deprecated ("Replaced by handleMessageFromCoordinator.")]]
87  virtual void handleMessageFromMaster (const MemoryBlock&) {}
88 
92  virtual void handleConnectionMade();
93 
99  virtual void handleConnectionLost();
100 
106  bool sendMessageToCoordinator (const MemoryBlock&);
107 
108  [[deprecated ("Replaced by sendMessageToCoordinator.")]]
109  bool sendMessageToMaster (const MemoryBlock& mb) { return sendMessageToCoordinator (mb); }
110 
111 private:
112  struct Connection;
113  std::unique_ptr<Connection> connection;
114 
115  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcessWorker)
116 };
117 
118 using ChildProcessSlave [[deprecated ("Replaced by ChildProcessWorker.")]] = ChildProcessWorker;
119 
120 //==============================================================================
141 {
142 public:
147 
152  virtual ~ChildProcessCoordinator();
153 
172  bool launchWorkerProcess (const File& executableToLaunch,
173  const String& commandLineUniqueID,
174  int timeoutMs = 0,
175  int streamFlags = ChildProcess::wantStdOut | ChildProcess::wantStdErr);
176 
177  [[deprecated ("Replaced by launchWorkerProcess.")]]
178  bool launchSlaveProcess (const File& executableToLaunch,
179  const String& commandLineUniqueID,
180  int timeoutMs = 0,
181  int streamFlags = ChildProcess::wantStdOut | ChildProcess::wantStdErr)
182  {
183  return launchWorkerProcess (executableToLaunch, commandLineUniqueID, timeoutMs, streamFlags);
184  }
185 
189  void killWorkerProcess();
190 
191  [[deprecated ("Replaced by killWorkerProcess.")]]
192  void killSlaveProcess() { killWorkerProcess(); }
193 
197  virtual void handleMessageFromWorker (const MemoryBlock&);
198 
199  [[deprecated ("Replaced by handleMessageFromWorker")]]
200  virtual void handleMessageFromSlave (const MemoryBlock&) {}
201 
205  virtual void handleConnectionLost();
206 
212  bool sendMessageToWorker (const MemoryBlock&);
213 
214  [[deprecated ("Replaced by sendMessageToWorker.")]]
215  bool sendMessageToSlave (const MemoryBlock& mb) { return sendMessageToWorker (mb); }
216 
217 private:
218  std::shared_ptr<ChildProcess> childProcess;
219 
220  struct Connection;
221  std::unique_ptr<Connection> connection;
222 
223  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcessCoordinator)
224 };
225 
226 using ChildProcessMaster [[deprecated ("Replaced by ChildProcessCoordinator.")]] = ChildProcessCoordinator;
227 
228 } // namespace juce