Debian Codegraph @

HercStudio/StatusRunner.cpp

raw symbols SCIP
1 /*
2 * File: StatusRunner.cpp
3 *
4 * Author: Jacob Dekel
5 * Created on: Aug 7, 2009
6 *
7 * Copyright (c) 2009-2013 Jacob Dekel
8 * $Id$
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25 #include "StatusRunner.h"cxx . . $ `<file>/HercStudio/StatusRunner.h`/
26 #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/
27 #include "NamedPipe.h"cxx . . $ `<file>/HercStudio/NamedPipe.h`/
28
29 #include <fcntl.h>
30
31 StatusRunnercxx . . $ StatusRunner#::StatusRunnercxx . . $ StatusRunner#StatusRunner(d09fd573a95a1071).(SynchronizedQueuecxx . . $ SynchronizedQueue#& statusQueue, HerculesExecutorcxx . . $ HerculesExecutor# * herculesExecutor)
32 : Runnercxx . . $ Runner#(statusQueue), mHerculesExecutorcxx . . $ StatusRunner#mHerculesExecutor.(herculesExecutor)
33 {
34
35 }
36
37 StatusRunnercxx . . $ StatusRunner#::~cxx . . $ StatusRunner#`~StatusRunner`(49f6e7a06ebc5aa8).StatusRunnercxx . . $ StatusRunner#()
38 {
39 }
40
41 void StatusRunnercxx . . $ StatusRunner#::runcxx . . $ StatusRunner#run(49f6e7a06ebc5aa8).()
42 {
43 #ifdef hFramework
44 mProcess = mHerculesExecutor->getQProcess();
45 connect(mHerculesExecutor->getQProcess(),
46 SIGNAL(readyReadStandardError()),
47 this,
48 SLOT(readStandardError()));
49 return;
50 #else
51 QFilecxx . . $ QFile#& statusFile = NamedPipecxx . . $ NamedPipe#::getInstancecxx . . $ NamedPipe#getInstance(464fad7f4e589b3).().getHerculesStatuscxx . . $ NamedPipe#getHerculesStatus(b409ea4a0265da19).();
52 QByteArraycxx . . $ QByteArray# buffcxx . . $ QByteArray#QByteArray(49f6e7a06ebc5aa8).;
53 buff.resizecxx . . $ QByteArray#resize(d4f767463ce0a6b3).(512);
54 mRunningcxx . . $ Runner#mRunning. = true;
55 bool lineRead = false;
56 int startupCounter = 0;
57
58 while(mRunningcxx . . $ Runner#mRunning.)
59 {
60 int size;
61 if ((size = statusFile.readLinecxx . . $ QIODevice#readLine(2e638bc8ed65be6c).(buff.datacxx . . $ QByteArray#data(41208ce6ca65dd58).(),512)) <= 0)
62 {
63 // we wait up to 2 seconds for data to appear in the log
64 if (!lineRead)
65 {
66 if (startupCounter++ < 200)
67 {
68 QThreadcxx . . $ QThread#::msleepcxx . . $ QThread#msleep(2c44cd906ae4e829).(10);
69 continue; // retry reading by returning to main loop
70 }
71 }
72 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! newDatacxx . . $ Runner#newData(49f6e7a06ebc5aa8).();
73 break;
74 }
75 lineRead = true;
76 buff[cxx . . $ QByteArray#`operator[]`(6eaff86c84670f1a).size-1] =cxx . . $ QByteRef#`operator=`(fee4eda3ac0bfad3). '\0';
77 mQueuecxx . . $ Runner#mQueue..push_backcxx . . $ SynchronizedQueue#push_back(45672f3c6961a244).(buff);
78 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! newDatacxx . . $ Runner#newData(49f6e7a06ebc5aa8).();
79 }
80 #endif
81 }
82
83
84 void StatusRunnercxx . . $ StatusRunner#::readStandardErrorcxx . . $ StatusRunner#readStandardError(49f6e7a06ebc5aa8).()
85 {
86 mProcesscxx . . $ StatusRunner#mProcess.->setReadChannelcxx . . $ QProcess#setReadChannel(bf19820e89ffcdec).(QProcesscxx . . $ QProcess#::StandardErrorcxx . . $ QProcess#StandardError.);
87 while (true)
88 {
89 QByteArraycxx . . $ QByteArray# output = mProcesscxx . . $ QByteArray#QByteArray(3203d9f8f38841a4).->readLinecxx . . $ QIODevice#readLine(1117a85f2fd4e5c8).();
90 if (output.lengthcxx . . $ QByteArray#length(455f465bc33b4cdf).() == 0) break;
91 output[cxx . . $ QByteArray#`operator[]`(6eaff86c84670f1a).output.lengthcxx . . $ QByteArray#length(455f465bc33b4cdf).()-1]=cxx . . $ QByteRef#`operator=`(fee4eda3ac0bfad3).'\0';
92 mQueuecxx . . $ Runner#mQueue..push_backcxx . . $ SynchronizedQueue#push_back(3203d9f8f38841a4).(outputcxx . . $ QByteArray#QByteArray(34d26762b42c433a)..datacxx . . $ QByteArray#data(41208ce6ca65dd58).());
93 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! newDatacxx . . $ Runner#newData(49f6e7a06ebc5aa8).();
94 }
95 }
96