4933
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 |
|
5 This program is free software; you can redistribute it and/or modify it |
|
6 under the terms of the GNU General Public License as published by |
|
7 the Free Software Foundation; either version 2, or (at your option) |
|
8 any later version. |
|
9 |
|
10 This program is distributed in the hope that it will be useful, but |
|
11 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
17 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 02110-1301, USA. |
4933
|
19 |
|
20 */ |
|
21 |
|
22 #if !defined (octave_fcn_inline_h) |
|
23 #define octave_fcn_inline_h 1 |
|
24 |
|
25 #include <iostream> |
|
26 #include <string> |
|
27 |
|
28 #include "oct-alloc.h" |
|
29 |
|
30 #include "ov-base.h" |
|
31 #include "ov-base-mat.h" |
|
32 #include "ov-fcn.h" |
|
33 #include "ov-typeinfo.h" |
|
34 #include "symtab.h" |
|
35 #include "ov-fcn-handle.h" |
|
36 |
|
37 // Inline functions. |
|
38 |
|
39 class |
|
40 octave_fcn_inline : public octave_fcn_handle |
|
41 { |
|
42 public: |
|
43 |
|
44 octave_fcn_inline (void) |
4967
|
45 : octave_fcn_handle (), iftext (), ifargs () { } |
4933
|
46 |
|
47 octave_fcn_inline (const std::string& f, const string_vector& a, |
|
48 const std::string& n = std::string ()); |
|
49 |
4967
|
50 octave_fcn_inline (const octave_fcn_inline& fi) |
|
51 : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { } |
|
52 |
4933
|
53 ~octave_fcn_inline (void) { } |
|
54 |
5759
|
55 octave_base_value *clone (void) const { return new octave_fcn_inline (*this); } |
|
56 octave_base_value *empty_clone (void) const { return new octave_fcn_inline (); } |
4967
|
57 |
4954
|
58 bool is_inline_function (void) const { return true; } |
|
59 |
4933
|
60 octave_fcn_inline *fcn_inline_value (bool = false) { return this; } |
|
61 |
|
62 std::string fcn_text (void) const { return iftext; } |
|
63 |
|
64 string_vector fcn_arg_names (void) const { return ifargs; } |
|
65 |
5279
|
66 octave_value convert_to_str_internal (bool, bool, char) const; |
4933
|
67 |
4972
|
68 bool save_ascii (std::ostream& os, bool& infnan_warned, |
|
69 bool strip_nan_and_inf); |
|
70 |
|
71 bool load_ascii (std::istream& is); |
|
72 |
|
73 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
74 |
|
75 bool load_binary (std::istream& is, bool swap, |
|
76 oct_mach_info::float_format fmt); |
|
77 |
|
78 #if defined (HAVE_HDF5) |
|
79 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
80 |
|
81 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
82 #endif |
|
83 |
4933
|
84 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
85 |
|
86 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
87 |
|
88 private: |
|
89 |
|
90 DECLARE_OCTAVE_ALLOCATOR |
|
91 |
|
92 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
93 |
|
94 // The expression of an inline function. |
|
95 std::string iftext; |
|
96 |
|
97 // The args of an inline function. |
|
98 string_vector ifargs; |
|
99 }; |
|
100 |
|
101 #endif |
|
102 |
|
103 /* |
|
104 ;;; Local Variables: *** |
|
105 ;;; mode: C++ *** |
|
106 ;;; End: *** |
|
107 */ |
|
108 |