source: main/trunk/greenstone2/runtime-src/src/recpt/os_process.h@ 22173

Last change on this file since 22173 was 22173, checked in by davidb, 14 years ago

Some initial development on the ability to have bi-directional pipes to spawned processes (with no DOS windows being opened up in the case of Windows). Think popen2()

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/**********************************************************************
2 *
3 * os_process.h -- base class for OS specific calls related to creating
4 * process *without* (in the case of Windows) opening a
5 * DOS window.
6 *
7 * Nett effect is OS neutral way to support
8 * popen() and related functions
9 *
10 * Copyright (C) 2010 The New Zealand Digital Library Project
11 *
12 * A component of the Greenstone digital library software
13 * from the New Zealand Digital Library Project at the
14 * University of Waikato, New Zealand.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 *
30 *********************************************************************/
31
32#ifndef OS_PROCESS_H
33#define OS_PROCESS_H
34
35 #include <stdlib.h>
36
37enum OSProcessPipeMode { uniRead=0, uniWrite=1, biReadWrite=2, noPipe=3 };
38
39class osprocess
40{
41
42 public:
43 osprocess(char* cmdline);
44 osprocess(char* cmdline, OSProcessPipeMode mode);
45 virtual ~osprocess();
46
47 /*
48 virtual bool eop(); // end of pipe
49 virtual bool eop(OSProcessPipeMode); // end of pipe, for designated pipe
50 */
51
52 virtual int write(char* buffer, const int buffer_len);
53 virtual int read(char* buffer, const int buffer_len);
54
55 virtual bool close();
56 virtual bool close(OSProcessPipeMode mode);
57
58 protected:
59 OSProcessPipeMode mode_;
60 bool read_pipe_open_;
61 bool write_pipe_open_;
62
63};
64
65#endif
66
Note: See TracBrowser for help on using the repository browser.