GNU Octave  4.4.1
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-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 // This class is based on the procbuf class from libg++, written by
24 // Per Bothner, Copyright (C) 1993 Free Software Foundation.
25 
26 #if ! defined (octave_oct_procbuf_h)
27 #define octave_oct_procbuf_h 1
28 
29 #include "octave-config.h"
30 
31 #include <sys/types.h>
32 
33 #include "c-file-ptr-stream.h"
34 
35 class
37 {
38 public:
39 
41  : c_file_ptr_buf (nullptr), wstatus (-1), open_p (false), proc_pid (-1),
42  next (nullptr) { }
43 
44  octave_procbuf (const char *command, int mode)
45  : c_file_ptr_buf (nullptr), wstatus (-1), open_p (false), proc_pid (-1),
46  next (nullptr) { open (command, mode); }
47 
48  // No copying!
49 
50  octave_procbuf (const octave_procbuf&) = delete;
51 
52  octave_procbuf& operator = (const octave_procbuf&) = delete;
53 
54  ~octave_procbuf (void) { close (); }
55 
56  octave_procbuf * open (const char *command, int mode);
57 
58  octave_procbuf * close (void);
59 
60  int wait_status (void) const { return wstatus; }
61 
62  bool is_open (void) const { return open_p; }
63 
64  pid_t pid (void) const { return proc_pid; }
65 
66 protected:
67 
68  int wstatus;
69 
70  bool open_p;
71 
72  pid_t proc_pid;
73 
75 };
76 
77 extern void symbols_of_oct_procbuf (void);
78 
79 #endif
int wait_status(void) const
Definition: oct-procbuf.h:60
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
Definition: data.cc:6348
octave_procbuf * next
Definition: oct-procbuf.h:74
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any simply delete all the lines from the buffer before leaving the editor When invoked with no edit the previously executed command
Definition: oct-hist.cc:587
pid_t pid(void) const
Definition: oct-procbuf.h:64
static uint32_t * next
Definition: randmtzig.cc:182
is false
Definition: cellfun.cc:400
void symbols_of_oct_procbuf(void)
octave_procbuf(void)
Definition: oct-procbuf.h:40
bool is_open(void) const
Definition: oct-procbuf.h:62
~octave_procbuf(void)
Definition: oct-procbuf.h:54
octave_procbuf(const char *command, int mode)
Definition: oct-procbuf.h:44