annotate liboctave/util/action-container.h @ 25103:078b795c5219 stable

maint: style check C++ ahead of 4.4 release. * ButtonGroup.cc, Canvas.cc, Figure.cc, GLCanvas.cc, GLCanvas.h, ListBoxControl.cc, ObjectProxy.cc, QTerminal.h, dialog.cc, documentation.cc, files-dock-widget.cc, history-dock-widget.cc, file-editor-tab.cc, file-editor.h, find-dialog.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h, main-window.cc, webinfo.cc, resource-manager.h, settings-dialog.cc, shortcut-manager.cc, shortcut-manager.h, variable-editor.cc, workspace-view.cc, build-env.in.cc, __ilu__.cc, cellfun.cc, data.cc, dirfns.cc, dynamic-ld.h, environment.cc, error.cc, fcn-info.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, help.cc, interpreter.cc, load-path.cc, load-save.cc, ls-mat5.cc, mex.cc, oct-stream.cc, oct-stream.h, qz.cc, sighandlers.cc, sparse-xpow.cc, svd.cc, symscope.h, symtab.cc, symtab.h, sysdep.cc, url-handle-manager.h, utils.cc, variables.cc, __init_fltk__.cc, __ode15__.cc, gzip.cc, ov-base.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-java.cc, ov-re-diag.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, bp-table.cc, comment-list.h, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, lex.h, parse.h, pt-binop.h, pt-decl.h, pt-eval.cc, pt-jit.cc, pt-jit.h, pt-misc.h, token.h, CMatrix.cc, CMatrix.h, CSparse.cc, CSparse.h, dMatrix.h, fCMatrix.cc, fCMatrix.h, fMatrix.h, Faddeeva.cc, gepbalance.cc, hess.cc, oct-fftw.cc, oct-fftw.h, file-stat.cc, lo-sysinfo.cc, action-container.h, f77-fcn.h, lo-regexp.cc, oct-mutex.h, oct-shlib.cc: Use Octave coding conventions in C++ files.
author Rik <rik@octave.org>
date Tue, 03 Apr 2018 13:52:07 -0700
parents 6652d3823428
children b3d357990b52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
25054
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
3 Copyright (C) 1993-2018 John W. Eaton
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 Copyright (C) 2009-2010 VZLU Prague
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 This file is part of Octave.
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24397
diff changeset
8 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
9 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24397
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
11 (at your option) any later version.
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
16 GNU General Public License for more details.
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24397
diff changeset
20 <https://www.gnu.org/licenses/>.
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 */
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 #if ! defined (octave_action_container_h)
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 #define octave_action_container_h 1
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
27 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
28
23442
53f5f8231c37 allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents: 23437
diff changeset
29 #include <cstddef>
53f5f8231c37 allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents: 23437
diff changeset
30
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 // This class allows registering actions in a list for later
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 // execution, either explicitly or when the container goes out of
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 // scope.
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
35 // FIXME: is there a better name for this class?
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
37 // FIXME: we should probably be using std::function, std::bind, and
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
38 // related c++11 features to implement this functionality.
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
39
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
40 namespace octave
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 {
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
42 class
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
43 action_container
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 {
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
46
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
47 // A generic unwind_protect element. Knows how to run itself and
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
48 // discard itself. Also, contains a pointer to the next element.
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
49 class elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
50 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
51 public:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
52
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
53 friend class action_container;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
54
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
55 elem (void) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
56
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
57 // No copying!
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
59 elem (const elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
60
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
61 elem& operator = (const elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
62
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
63 virtual ~elem (void) = default;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
65 virtual void run (void) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
66 };
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
67
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
68 // An element that merely runs a void (*)(void) function.
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
69
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
70 class fcn_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
71 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
72 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
73
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
74 fcn_elem (void (*fptr) (void))
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
75 : e_fptr (fptr) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
76
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
77 void run (void) { e_fptr (); }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
79 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
80
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
81 void (*e_fptr) (void);
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
82 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
83
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
84 // An element that stores a variable of type T along with a void (*) (T)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
85 // function pointer, and calls the function with the parameter.
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
87 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
88 class fcn_arg_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
89 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
90 public:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
91
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
92 fcn_arg_elem (void (*fcn) (T), T arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
93 : e_fcn (fcn), e_arg (arg) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
94
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
95 // No copying!
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
96
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
97 fcn_arg_elem (const fcn_arg_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
98
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
99 fcn_arg_elem& operator = (const fcn_arg_elem&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
100
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
101 void run (void) { e_fcn (e_arg); }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
102
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
103 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
104
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
105 void (*e_fcn) (T);
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
106
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
107 T e_arg;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
108 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
109
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
110 // An element that stores a variable of type T along with a
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
111 // void (*) (const T&) function pointer, and calls the function with
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
112 // the parameter.
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
114 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
115 class fcn_crefarg_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
116 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
117 public:
23437
442fe5b5afb5 new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
118
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
119 fcn_crefarg_elem (void (*fcn) (const T&), const T& arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
120 : e_fcn (fcn), e_arg (arg) { }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
121
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
122 void run (void) { e_fcn (e_arg); }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
123
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
124 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
125
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
126 void (*e_fcn) (const T&);
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
127
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
128 T e_arg;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
129 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
130
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
131 // An element for calling a member function.
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
132
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
133 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
134 class method_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
135 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
136 public:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
137
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
138 method_elem (T *obj, void (T::*method) (void))
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
139 : e_obj (obj), e_method (method) { }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
141 method_elem (T& obj, void (T::*method) (void))
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
142 : e_obj (&obj), e_method (method) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
143
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
144 // No copying!
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
145
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
146 method_elem (const method_elem&) = delete;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
148 method_elem operator = (const method_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
149
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
150 void run (void) { (e_obj->*e_method) (); }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
151
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
152 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
153
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
154 T *e_obj;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
156 void (T::*e_method) (void);
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
157 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
158
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
159 // An element for calling a member function with a single argument
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
160
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
161 template <typename T, typename A>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
162 class method_arg_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
163 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
164 public:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
165
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
166 method_arg_elem (T *obj, void (T::*method) (A), A arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
167 : e_obj (obj), e_method (method), e_arg (arg) { }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
169 method_arg_elem (T& obj, void (T::*method) (A), A arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
170 : e_obj (&obj), e_method (method), e_arg (arg) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
171
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
172 // No copying!
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
173
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
174 method_arg_elem (const method_arg_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
175
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
176 method_arg_elem operator = (const method_arg_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
177
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
178 void run (void) { (e_obj->*e_method) (e_arg); }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
179
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
180 private:
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
182 T *e_obj;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
183
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
184 void (T::*e_method) (A);
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
185
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
186 A e_arg;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
187 };
23437
442fe5b5afb5 new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
188
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
189 // An element for calling a member function with a single argument
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
190
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
191 template <typename T, typename A>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
192 class method_crefarg_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
193 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
194 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
195
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
196 method_crefarg_elem (T *obj, void (T::*method) (const A&), const A& arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
197 : e_obj (obj), e_method (method), e_arg (arg) { }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
198
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
199 method_crefarg_elem (T& obj, void (T::*method) (const A&), const A& arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
200 : e_obj (&obj), e_method (method), e_arg (arg) { }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
201
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
202 // No copying!
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
203
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
204 method_crefarg_elem (const method_crefarg_elem&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
205
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
206 method_crefarg_elem operator = (const method_crefarg_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
207
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
208 void run (void) { (e_obj->*e_method) (e_arg); }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
210 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
211
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
212 T *e_obj;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
213
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
214 void (T::*e_method) (const A&);
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
215
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
216 A e_arg;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
217 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
218
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
219 /// An element for calling a member function with two arguments
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
220 template <class T, class A, class B>
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
221 class method_arg2_elem : public elem
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
222 {
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
223 public:
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
224 method_arg2_elem (T *obj, void (T::*method) (const A&, const B&),
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
225 const A& arg_a, const B& arg_b)
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
226 : e_obj (obj), e_method (method),
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
227 e_arg_a (arg_a), e_arg_b (arg_b) { }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
228
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
229 void run (void) { (e_obj->*e_method) (e_arg_a, e_arg_b); }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
230
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
231 private:
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
232
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
233 T *e_obj;
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
234 void (T::*e_method) (const A&, const B&);
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
235 A e_arg_a;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
236 B e_arg_b;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
237
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
238 // No copying!
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
239
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
240 method_arg2_elem (const method_arg2_elem&);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
241
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
242 method_arg2_elem operator = (const method_arg2_elem&);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
243 };
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
244
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
245 /// An element for calling a member function with three arguments
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
246 template <class T, class A, class B, class C>
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
247 class method_arg3_elem : public elem
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
248 {
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
249 public:
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
250 method_arg3_elem (T *obj,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
251 void (T::*method) (const A&, const B&, const C&),
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
252 const A& arg_a, const B& arg_b, const C& arg_c)
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
253 : e_obj (obj), e_method (method),
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
254 e_arg_a (arg_a), e_arg_b (arg_b), e_arg_c (arg_c)
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
255 { }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
256
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
257 void run (void) { (e_obj->*e_method) (e_arg_a, e_arg_b, e_arg_c); }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
258
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
259 private:
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
260
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
261 T *e_obj;
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
262 void (T::*e_method) (const A&, const B&, const C&);
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
263 A e_arg_a;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
264 B e_arg_b;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
265 C e_arg_c;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
266
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
267 // No copying!
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
268
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
269 method_arg3_elem (const method_arg3_elem&);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
270
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
271 method_arg3_elem operator = (const method_arg3_elem&);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
272 };
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
273
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
274 /// An element for calling a member function with three arguments
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
275 template <class T, class A, class B, class C, class D>
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
276 class method_arg4_elem : public elem
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
277 {
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
278 public:
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
279 method_arg4_elem (T *obj,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
280 void (T::*method) (const A&, const B&, const C&, const D&),
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
281 const A& arg_a, const B& arg_b, const C& arg_c,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
282 const D& arg_d)
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
283 : e_obj (obj), e_method (method),
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
284 e_arg_a (arg_a), e_arg_b (arg_b), e_arg_c (arg_c), e_arg_d (arg_d)
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
285 { }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
286
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
287 void run (void)
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
288 {
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
289 (e_obj->*e_method) (e_arg_a, e_arg_b, e_arg_c, e_arg_d);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
290 }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
291
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
292 private:
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
293
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
294 T *e_obj;
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
295 void (T::*e_method) (const A&, const B&, const C&, const D&);
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
296 A e_arg_a;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
297 B e_arg_b;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
298 C e_arg_c;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
299 D e_arg_d;
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
300
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
301 // No copying!
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
302
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
303 method_arg4_elem (const method_arg4_elem&);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
304
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
305 method_arg4_elem operator = (const method_arg4_elem&);
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
306 };
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
307
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
308 // An element that stores arbitrary variable, and restores it.
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
310 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
311 class restore_var_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
312 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
313 public:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
314
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
315 restore_var_elem (T& ref, const T& val)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
316 : e_ptr (&ref), e_val (val) { }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
318 // No copying!
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
319
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
320 restore_var_elem (const restore_var_elem&) = delete;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
321
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
322 restore_var_elem& operator = (const restore_var_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
323
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
324 void run (void) { *e_ptr = e_val; }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
326 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
327
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
328 T *e_ptr, e_val;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
329 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
330
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
331 // Deletes a class allocated using new.
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
332
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
333 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
334 class delete_ptr_elem : public elem
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
335 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
336 public:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
337
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
338 delete_ptr_elem (T *ptr)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
339 : e_ptr (ptr) { }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
340
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
341 // No copying!
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
342
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
343 delete_ptr_elem (const delete_ptr_elem&) = delete;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
344
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
345 delete_ptr_elem operator = (const delete_ptr_elem&) = delete;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
347 void run (void) { delete e_ptr; }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
348
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
349 private:
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
350
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
351 T *e_ptr;
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
352 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
353
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
354 action_container (void) { }
23437
442fe5b5afb5 new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
355
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
356 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
357
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
358 action_container (const action_container&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
359
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
360 action_container& operator = (const action_container&) = delete;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
362 virtual ~action_container (void) = default;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
363
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
364 virtual void add (elem *new_elem) = 0;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
365
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
366 // Call to void func (void).
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
367 void add_fcn (void (*fcn) (void))
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
368 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
369 add (new fcn_elem (fcn));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
370 }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
371
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
372 // Call to void func (T).
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
373 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
374 void add_fcn (void (*action) (T), T val)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
375 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
376 add (new fcn_arg_elem<T> (action, val));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
377 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
378
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
379 // Call to void func (const T&).
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
380 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
381 void add_fcn (void (*action) (const T&), const T& val)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
382 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
383 add (new fcn_crefarg_elem<T> (action, val));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
384 }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
385
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
386 // Call to T::method (void).
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
387 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
388 void add_method (T *obj, void (T::*method) (void))
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
389 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
390 add (new method_elem<T> (obj, method));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
391 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
393 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
394 void add_method (T& obj, void (T::*method) (void))
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
395 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
396 add (new method_elem<T> (obj, method));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
397 }
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
398
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
399 // Call to T::method (A).
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
400 template <typename T, typename A>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
401 void add_method (T *obj, void (T::*method) (A), A arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
402 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
403 add (new method_arg_elem<T, A> (obj, method, arg));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
404 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
405
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
406 template <typename T, typename A>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
407 void add_method (T& obj, void (T::*method) (A), A arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
408 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
409 add (new method_arg_elem<T, A> (obj, method, arg));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
410 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
411
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
412 // Call to T::method (const A&).
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
413 template <typename T, typename A>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
414 void add_method (T *obj, void (T::*method) (const A&), const A& arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
415 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
416 add (new method_crefarg_elem<T, A> (obj, method, arg));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
417 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
419 template <typename T, typename A>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
420 void add_method (T& obj, void (T::*method) (const A&), const A& arg)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
421 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
422 add (new method_crefarg_elem<T, A> (obj, method, arg));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
423 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
424
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
425 // Call to T::method (A, B).
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
426 template <class T, class A, class B>
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
427 void add_method (T *obj, void (T::*method) (const A&, const B&),
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
428 const A& arg_a, const B& arg_b)
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
429 {
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
430 add (new method_arg2_elem<T, A, B> (obj, method, arg_a, arg_b));
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
431 }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
432
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
433 // Call to T::method (A, B, C).
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
434 template <class T, class A, class B, class C>
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
435 void add_method (T *obj,
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
436 void (T::*method) (const A&, const B&, const C&),
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
437 const A& arg_a, const B& arg_b, const C& arg_c)
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
438 {
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
439 add (new method_arg3_elem<T, A, B, C> (obj, method, arg_a,
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
440 arg_b, arg_c));
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
441 }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
442
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
443 // Call to T::method (A, B, C, D).
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
444 template <class T, class A, class B, class C, class D>
24397
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
445 void add_method (T *obj,
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
446 void (T::*method) (const A&, const B&, const C&, const D&),
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
447 const A& arg_a, const B& arg_b,
08f19fd144f4 don't use const reference template arguments to create var editor callbacks
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
448 const C& arg_c, const D& arg_d)
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
449 {
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
450 add (new method_arg4_elem<T, A, B, C, D> (obj, method, arg_a,
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
451 arg_b, arg_c, arg_d));
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
452 }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23747
diff changeset
453
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
454 // Call to delete (T*).
23437
442fe5b5afb5 new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
455
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
456 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
457 void add_delete (T *obj)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
458 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
459 add (new delete_ptr_elem<T> (obj));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
460 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
461
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
462 // Protect any variable.
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
463 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
464 void protect_var (T& var)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
465 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
466 add (new restore_var_elem<T> (var, var));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
467 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
468
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
469 // Protect any variable, value given.
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
470 template <typename T>
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
471 void protect_var (T& var, const T& val)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
472 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
473 add (new restore_var_elem<T> (var, val));
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
474 }
23437
442fe5b5afb5 new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
475
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
476 operator bool (void) const { return ! empty (); }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
477
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
478 virtual void run_first (void) = 0;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
479
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
480 void run (size_t num)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
481 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
482 if (num > size ())
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
483 num = size ();
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
484
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
485 for (size_t i = 0; i < num; i++)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
486 run_first ();
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
487 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
488
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
489 void run (void) { run (size ()); }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
490
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
491 virtual void discard_first (void) = 0;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
492
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
493 void discard (size_t num)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
494 {
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
495 if (num > size ())
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
496 num = size ();
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
497
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
498 for (size_t i = 0; i < num; i++)
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
499 discard_first ();
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
500 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
501
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
502 void discard (void) { discard (size ()); }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
504 virtual size_t size (void) const = 0;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
505
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
506 bool empty (void) const { return size () == 0; }
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
507 };
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
508 }
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
509
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
510 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
511
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
512 OCTAVE_DEPRECATED (4.4, "use 'octave::action_container' instead")
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
513 typedef octave::action_container action_container;
15396
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
514
1054ab58cd58 abstract unwind_protect
John W. Eaton <jwe@octave.org>
parents:
diff changeset
515 #endif
23747
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
516
0b4d1575a2e2 move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23442
diff changeset
517 #endif