root/main/trunk/greenstone2/runtime-src/src/recpt/os_process.h @ 22177

Revision 22177, 2.2 KB (checked in by davidb, 10 years ago)

Further development of the os_process classes

  • Property svn:executable set to *
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 };
38enum OSProcessWarnStatus { withoutWarning, withWarning };
39
40class osprocess
41{
42 
43 public:
44  osprocess(char* cmdline, OSProcessPipeMode mode);
45  virtual ~osprocess();
46 
47  /* one day might want these
48  virtual bool end_of_pipe(); 
49  virtual bool end_of_read_pipe();
50  virtual bool end_of_write_pipe();
51  */
52
53  virtual int write(char* buffer, const int buffer_len)=0;
54  virtual int read(char* buffer, const int buffer_len)=0;
55 
56  virtual bool close_write_pipe(OSProcessWarnStatus warn_status=withWarning)=0;
57  virtual bool close_read_pipe(OSProcessWarnStatus warn_status=withWarning)=0;
58  virtual bool close();
59
60 
61 protected:
62  OSProcessPipeMode mode_;
63
64};
65
66#endif
67
Note: See TracBrowser for help on using the browser.