GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-procbuf.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // 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 // Octave is distributed in the hope that it will be useful, but
16 // 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 Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 // This class is based on the procbuf class from libg++, written by
27 // Per Bothner, Copyright (C) 1993 Free Software Foundation.
28 
29 #if ! defined (octave_oct_procbuf_h)
30 #define octave_oct_procbuf_h 1
31 
32 #include "octave-config.h"
33 
34 #include <sys/types.h>
35 
36 #include "c-file-ptr-stream.h"
37 
38 class
40 {
41 public:
42 
44  : c_file_ptr_buf (nullptr), wstatus (-1), open_p (false), proc_pid (-1),
45  next (nullptr) { }
46 
47  octave_procbuf (const char *command, int mode)
48  : c_file_ptr_buf (nullptr), wstatus (-1), open_p (false), proc_pid (-1),
49  next (nullptr) { open (command, mode); }
50 
51  // No copying!
52 
53  octave_procbuf (const octave_procbuf&) = delete;
54 
55  octave_procbuf& operator = (const octave_procbuf&) = delete;
56 
57  ~octave_procbuf (void) { close (); }
58 
59  octave_procbuf * open (const char *command, int mode);
60 
61  octave_procbuf * close (void);
62 
63  int wait_status (void) const { return wstatus; }
64 
65  bool is_open (void) const { return open_p; }
66 
67  pid_t pid (void) const { return proc_pid; }
68 
69 protected:
70 
71  int wstatus;
72 
73  bool open_p;
74 
75  pid_t proc_pid;
76 
78 };
79 
80 extern void symbols_of_oct_procbuf (void);
81 
82 #endif
octave_procbuf(void)
Definition: oct-procbuf.h:43
~octave_procbuf(void)
Definition: oct-procbuf.h:57
octave_procbuf(const octave_procbuf &)=delete
pid_t pid(void) const
Definition: oct-procbuf.h:67
octave_procbuf(const char *command, int mode)
Definition: oct-procbuf.h:47
bool is_open(void) const
Definition: oct-procbuf.h:65
octave_procbuf * next
Definition: oct-procbuf.h:77
int wait_status(void) const
Definition: oct-procbuf.h:63
static uint32_t * next
Definition: randmtzig.cc:189
void symbols_of_oct_procbuf(void)