OpenShot Audio Library | OpenShotAudio  0.3.0
juce_ConnectedChildProcess.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
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 ChildProcessSlave
48 {
49 public:
54 
56  virtual ~ChildProcessSlave();
57 
74  bool initialiseFromCommandLine (const String& commandLine,
75  const String& commandLineUniqueID,
76  int timeoutMs = 0);
77 
78  //==============================================================================
84  virtual void handleMessageFromMaster (const MemoryBlock&) = 0;
85 
89  virtual void handleConnectionMade();
90 
96  virtual void handleConnectionLost();
97 
103  bool sendMessageToMaster (const MemoryBlock&);
104 
105 private:
106  struct Connection;
107  std::unique_ptr<Connection> connection;
108 
109  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcessSlave)
110 };
111 
112 //==============================================================================
132 class JUCE_API ChildProcessMaster
133 {
134 public:
139 
144  virtual ~ChildProcessMaster();
145 
164  bool launchSlaveProcess (const File& executableToLaunch,
165  const String& commandLineUniqueID,
166  int timeoutMs = 0,
167  int streamFlags = ChildProcess::wantStdOut | ChildProcess::wantStdErr);
168 
172  void killSlaveProcess();
173 
177  virtual void handleMessageFromSlave (const MemoryBlock&) = 0;
178 
182  virtual void handleConnectionLost();
183 
189  bool sendMessageToSlave (const MemoryBlock&);
190 
191 private:
192  std::unique_ptr<ChildProcess> childProcess;
193 
194  struct Connection;
195  std::unique_ptr<Connection> connection;
196 
197  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcessMaster)
198 };
199 
200 } // namespace juce
virtual void handleMessageFromSlave(const MemoryBlock &)=0
virtual void handleMessageFromMaster(const MemoryBlock &)=0