GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-fcn-inline.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2018 David Bateman
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_ov_fcn_inline_h)
24 #define octave_ov_fcn_inline_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 #include <string>
30 
31 #include "ov-base.h"
32 #include "ov-base-mat.h"
33 #include "ov-fcn.h"
34 #include "ov-typeinfo.h"
35 #include "ov-fcn-handle.h"
36 
37 // Inline functions.
38 
39 class
40 OCTINTERP_API
42 {
43 public:
44 
46  : octave_fcn_handle (), iftext (), ifargs () { }
47 
49  const std::string& n = "");
50 
52  : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { }
53 
54  ~octave_fcn_inline (void) = default;
55 
56  octave_base_value * clone (void) const
57  { return new octave_fcn_inline (*this); }
59  { return new octave_fcn_inline (); }
60 
61  bool is_inline_function (void) const { return true; }
62 
63  octave_fcn_inline * fcn_inline_value (bool = false) { return this; }
64 
65  std::string fcn_text (void) const { return iftext; }
66 
67  string_vector fcn_arg_names (void) const { return ifargs; }
68 
69  octave_value convert_to_str_internal (bool, bool, char) const;
70 
71  octave_map map_value (void) const;
72 
73  bool save_ascii (std::ostream& os);
74 
75  bool load_ascii (std::istream& is);
76 
77  bool save_binary (std::ostream& os, bool& save_as_floats);
78 
79  bool load_binary (std::istream& is, bool swap,
81 
82  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
83 
84  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
85 
86  void print (std::ostream& os, bool pr_as_read_syntax = false);
87 
88  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
89 
90 private:
91 
93 
94  // The expression of an inline function.
96 
97  // The args of an inline function.
99 };
100 
101 #endif
std::string fcn_text(void) const
Definition: ov-fcn-inline.h:65
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
octave_base_value * empty_clone(void) const
Definition: ov-fcn-inline.h:58
bool is_inline_function(void) const
Definition: ov-fcn-inline.h:61
static double fi[256]
Definition: randmtzig.cc:435
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
bool swap
Definition: load-save.cc:738
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:158
string_vector fcn_arg_names(void) const
Definition: ov-fcn-inline.h:67
nd deftypefn *std::string name
Definition: sysdep.cc:647
octave_fcn_inline(const octave_fcn_inline &fi)
Definition: ov-fcn-inline.h:51
octave_base_value * clone(void) const
Definition: ov-fcn-inline.h:56
string_vector ifargs
Definition: ov-fcn-inline.h:98
bool save_as_floats
Definition: load-save.cc:1617
int64_t octave_hdf5_id
std::string iftext
Definition: ov-fcn-inline.h:95
write the output to stdout if nargout is
Definition: load-save.cc:1612
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
octave::stream os
Definition: file-io.cc:627
octave_fcn_inline * fcn_inline_value(bool=false)
Definition: ov-fcn-inline.h:63