comparison vamp-client/ProcessQtTransport.h @ 118:ff3fd8d1b2dc

Boilerplate comments
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 27 Oct 2016 12:01:37 +0100
parents 5a716f08e4be
children 5876f3e9c677
comparison
equal deleted inserted replaced
117:5dffc5147176 118:ff3fd8d1b2dc
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 /*
3 Piper C++
4
5 An API for audio analysis and feature extraction plugins.
6
7 Centre for Digital Music, Queen Mary, University of London.
8 Copyright 2006-2016 Chris Cannam and QMUL.
9
10 Permission is hereby granted, free of charge, to any person
11 obtaining a copy of this software and associated documentation
12 files (the "Software"), to deal in the Software without
13 restriction, including without limitation the rights to use, copy,
14 modify, merge, publish, distribute, sublicense, and/or sell copies
15 of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
17
18 The above copyright notice and this permission notice shall be
19 included in all copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
25 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
29 Except as contained in this notice, the names of the Centre for
30 Digital Music; Queen Mary, University of London; and Chris Cannam
31 shall not be used in advertising or otherwise to promote the sale,
32 use or other dealings in this Software without prior written
33 authorization.
34 */
2 35
3 #ifndef PIPER_PROCESS_QT_TRANSPORT_H 36 #ifndef PIPER_PROCESS_QT_TRANSPORT_H
4 #define PIPER_PROCESS_QT_TRANSPORT_H 37 #define PIPER_PROCESS_QT_TRANSPORT_H
5 38
6 #include "SynchronousTransport.h" 39 #include "SynchronousTransport.h"
62 } 95 }
63 96
64 ~ProcessQtTransport() { 97 ~ProcessQtTransport() {
65 if (m_process) { 98 if (m_process) {
66 if (m_process->state() != QProcess::NotRunning) { 99 if (m_process->state() != QProcess::NotRunning) {
67 m_process->closeWriteChannel(); 100 m_process->closeWriteChannel();
68 m_process->waitForFinished(200); 101 m_process->waitForFinished(200);
69 m_process->close(); 102 m_process->close();
70 m_process->waitForFinished(); 103 m_process->waitForFinished();
71 std::cerr << "server exited" << std::endl; 104 std::cerr << "server exited" << std::endl;
72 } 105 }
86 } 119 }
87 120
88 std::vector<char> 121 std::vector<char>
89 call(const char *ptr, size_t size) override { 122 call(const char *ptr, size_t size) override {
90 123
91 QMutexLocker locker(&m_mutex); 124 QMutexLocker locker(&m_mutex);
92 125
93 if (!m_completenessChecker) { 126 if (!m_completenessChecker) {
94 throw std::logic_error("No completeness checker set on transport"); 127 throw std::logic_error("No completeness checker set on transport");
95 } 128 }
96 129
97 std::cerr << "writing " << size << " bytes to server" << std::endl; 130 std::cerr << "writing " << size << " bytes to server" << std::endl;
102 135
103 while (!complete) { 136 while (!complete) {
104 137
105 qint64 byteCount = m_process->bytesAvailable(); 138 qint64 byteCount = m_process->bytesAvailable();
106 139
107 if (!byteCount) { 140 if (!byteCount) {
108 std::cerr << "waiting for data from server..." << std::endl; 141 std::cerr << "waiting for data from server..." << std::endl;
109 m_process->waitForReadyRead(1000); 142 m_process->waitForReadyRead(1000);
110 if (m_process->state() == QProcess::NotRunning) { 143 if (m_process->state() == QProcess::NotRunning) {
111 QProcess::ProcessError err = m_process->error(); 144 QProcess::ProcessError err = m_process->error();
112 if (err == QProcess::Crashed) { 145 if (err == QProcess::Crashed) {
113 std::cerr << "Server crashed during request" << std::endl; 146 std::cerr << "Server crashed during request" << std::endl;
114 } else { 147 } else {