GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
oct-procbuf.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2025 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
39
40class procbuf : public c_file_ptr_buf
41{
42public:
43
45 : c_file_ptr_buf (nullptr), m_wstatus (-1), m_open_p (false),
46 m_proc_pid (-1), m_next (nullptr)
47 { }
48
49 procbuf (const char *command, int mode)
50 : c_file_ptr_buf (nullptr), m_wstatus (-1), m_open_p (false),
51 m_proc_pid (-1), m_next (nullptr)
52 { open (command, mode); }
53
54 OCTAVE_DISABLE_COPY_MOVE (procbuf)
55
56 ~procbuf () { close (); }
57
58 procbuf * open (const char *command, int mode);
59
60 procbuf * close ();
61
62 int wait_status () const { return m_wstatus; }
63
64 bool is_open () const { return m_open_p; }
65
66 pid_t pid () const { return m_proc_pid; }
67
68protected:
69
71
73
75
77};
78
79OCTAVE_END_NAMESPACE(octave)
80
81#endif
pid_t m_proc_pid
Definition oct-procbuf.h:74
pid_t pid() const
Definition oct-procbuf.h:66
bool is_open() const
Definition oct-procbuf.h:64
int m_wstatus
Definition oct-procbuf.h:70
procbuf * m_next
Definition oct-procbuf.h:76
procbuf(const char *command, int mode)
Definition oct-procbuf.h:49
bool m_open_p
Definition oct-procbuf.h:72
int wait_status() const
Definition oct-procbuf.h:62
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn