Debian Codegraph @

HercStudio/NamedPipe.h

raw symbols SCIP
1 /*
2 * File: NamedPipe.h
3 *
4 * Author: Jacob Dekel
5 * Created on: Aug 7, 2009
6 *
7 * Copyright (c) 2009-2013 Jacob Dekel
8 * $Id$
9 *
10 * This object manages the pipe between hercules and hercules studio
11 *
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 */
26
27 #ifndef NAMEDPIPE_H_
28 #define NAMEDPIPE_H_
29
30 #include <QMutex>
31 #include <QFile>
32
33 #include <string>
34 #include <cstdio>
35
36 class NamedPipe
37 {
38 public:
39 static NamedPipe& getInstance();
40 virtual ~NamedPipe();
41 int recover();
42 void generatePid(int studioPid, int herculesPid);
43 int getHerculesPid();
44 std::string getHerculesCommandline();
45
46 FILE * getHerculesStdin();
47 FILE * getHerculesCommandsFile();
48 FILE * getHerculesStdout();
49 QFile& getHerculesLogfile();
50 FILE * getHerculesStderr();
51 QFile& getHerculesStatus();
52
53 private:
54 static NamedPipe sInstance;
55 std::string mSetPath;
56 std::string mFifo0;
57 std::string mFifo1;
58 std::string mFifo2;
59 bool mRecovery;
60 int mHerculesPid;
61
62 int delDir(std::string& path);
63
64 QMutex mMutex;
65 FILE * mStdinOutput;
66 FILE * mStdout;
67 QFile * mStdoutInput;
68 FILE * mStderr;
69 QFile * mStderrInput;
70
71
72 protected:
73 NamedPipe();
74 };
75
76 #endif /* NAMEDPIPE_H_ */