1 /*-------------------------------------------------------------------------
2 * drawElements C++ Base Library
3 * -----------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief deProcess C++ wrapper.
22 *//*--------------------------------------------------------------------*/
24 #include "deProcess.hpp"
31 Process::Process (void)
32 : m_process(deProcess_create())
35 throw std::bad_alloc();
38 Process::~Process (void)
40 deProcess_destroy(m_process);
43 void Process::start (const char* commandLine, const char* workingDirectory)
45 if (!deProcess_start(m_process, commandLine, workingDirectory))
46 throw ProcessError(deProcess_getLastError(m_process));
49 void Process::waitForFinish (void)
51 if (!deProcess_waitForFinish(m_process))
52 throw ProcessError(deProcess_getLastError(m_process));
55 void Process::terminate (void)
57 if (!deProcess_terminate(m_process))
58 throw ProcessError(deProcess_getLastError(m_process));
61 void Process::kill (void)
63 if (!deProcess_kill(m_process))
64 throw ProcessError(deProcess_getLastError(m_process));
67 void Process::closeStdIn (void)
69 if (!deProcess_closeStdIn(m_process))
70 throw ProcessError(deProcess_getLastError(m_process));
73 void Process::closeStdOut (void)
75 if (!deProcess_closeStdOut(m_process))
76 throw ProcessError(deProcess_getLastError(m_process));
79 void Process::closeStdErr (void)
81 if (!deProcess_closeStdErr(m_process))
82 throw ProcessError(deProcess_getLastError(m_process));