4933
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 |
7016
|
5 This file is part of Octave. |
4933
|
6 |
7016
|
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. |
4933
|
16 |
|
17 You should have received a copy of the GNU General Public License |
7016
|
18 along with Octave; see the file COPYING. If not, see |
|
19 <http://www.gnu.org/licenses/>. |
4933
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_fcn_inline_h) |
|
24 #define octave_fcn_inline_h 1 |
|
25 |
|
26 #include <iostream> |
|
27 #include <string> |
|
28 |
|
29 #include "oct-alloc.h" |
|
30 |
|
31 #include "ov-base.h" |
|
32 #include "ov-base-mat.h" |
|
33 #include "ov-fcn.h" |
|
34 #include "ov-typeinfo.h" |
|
35 #include "symtab.h" |
|
36 #include "ov-fcn-handle.h" |
|
37 |
|
38 // Inline functions. |
|
39 |
|
40 class |
|
41 octave_fcn_inline : public octave_fcn_handle |
|
42 { |
|
43 public: |
|
44 |
|
45 octave_fcn_inline (void) |
4967
|
46 : octave_fcn_handle (), iftext (), ifargs () { } |
4933
|
47 |
|
48 octave_fcn_inline (const std::string& f, const string_vector& a, |
|
49 const std::string& n = std::string ()); |
|
50 |
4967
|
51 octave_fcn_inline (const octave_fcn_inline& fi) |
|
52 : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { } |
|
53 |
4933
|
54 ~octave_fcn_inline (void) { } |
|
55 |
5759
|
56 octave_base_value *clone (void) const { return new octave_fcn_inline (*this); } |
|
57 octave_base_value *empty_clone (void) const { return new octave_fcn_inline (); } |
4967
|
58 |
4954
|
59 bool is_inline_function (void) const { return true; } |
|
60 |
4933
|
61 octave_fcn_inline *fcn_inline_value (bool = false) { return this; } |
|
62 |
|
63 std::string fcn_text (void) const { return iftext; } |
|
64 |
|
65 string_vector fcn_arg_names (void) const { return ifargs; } |
|
66 |
5279
|
67 octave_value convert_to_str_internal (bool, bool, char) const; |
4933
|
68 |
6625
|
69 Octave_map map_value (void) const; |
|
70 |
6974
|
71 bool save_ascii (std::ostream& os); |
4972
|
72 |
|
73 bool load_ascii (std::istream& is); |
|
74 |
|
75 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
76 |
|
77 bool load_binary (std::istream& is, bool swap, |
|
78 oct_mach_info::float_format fmt); |
|
79 |
|
80 #if defined (HAVE_HDF5) |
|
81 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
82 |
|
83 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
84 #endif |
|
85 |
4933
|
86 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
87 |
|
88 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
89 |
|
90 private: |
|
91 |
|
92 DECLARE_OCTAVE_ALLOCATOR |
|
93 |
|
94 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
95 |
|
96 // The expression of an inline function. |
|
97 std::string iftext; |
|
98 |
|
99 // The args of an inline function. |
|
100 string_vector ifargs; |
|
101 }; |
|
102 |
|
103 #endif |
|
104 |
|
105 /* |
|
106 ;;; Local Variables: *** |
|
107 ;;; mode: C++ *** |
|
108 ;;; End: *** |
|
109 */ |
|
110 |