GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
oct-procbuf.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://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 (0), wstatus (-1), open_p (false), proc_pid (-1),
42  next (0) { }
43 
44  octave_procbuf (const char *command, int mode)
45  : c_file_ptr_buf (0), wstatus (-1), open_p (false), proc_pid (-1),
46  next (0) { open (command, mode); }
47 
48  ~octave_procbuf (void) { close (); }
49 
50  octave_procbuf *open (const char *command, int mode);
51 
52  octave_procbuf *close (void);
53 
54  int wait_status (void) const { return wstatus; }
55 
56  bool is_open (void) const { return open_p; }
57 
58  pid_t pid (void) const { return proc_pid; }
59 
60 protected:
61 
62  int wstatus;
63 
64  bool open_p;
65 
66  pid_t proc_pid;
67 
69 
70 private:
71 
72  // No copying!
73 
75 
76  octave_procbuf& operator = (const octave_procbuf&);
77 };
78 
79 extern void symbols_of_oct_procbuf (void);
80 
81 #endif
int wait_status(void) const
Definition: oct-procbuf.h:54
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:6386
octave_procbuf * next
Definition: oct-procbuf.h:68
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
static uint32_t * next
Definition: randmtzig.cc:183
bool is_open(void) const
Definition: oct-procbuf.h:56
is false
Definition: cellfun.cc:398
void symbols_of_oct_procbuf(void)
octave_procbuf(void)
Definition: oct-procbuf.h:40
~octave_procbuf(void)
Definition: oct-procbuf.h:48
pid_t pid(void) const
Definition: oct-procbuf.h:58
octave_procbuf(const char *command, int mode)
Definition: oct-procbuf.h:44