GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-fcn-inline.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2013 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_ov_fcn_inline_h)
24 #define octave_ov_fcn_inline_h 1
25 
26 #include <iosfwd>
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
43 {
44 public:
45 
47  : octave_fcn_handle (), iftext (), ifargs () { }
48 
49  octave_fcn_inline (const std::string& f, const string_vector& a,
50  const std::string& n = std::string ());
51 
53  : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { }
54 
55  ~octave_fcn_inline (void) { }
56 
57  octave_base_value *clone (void) const
58  { return new octave_fcn_inline (*this); }
59  octave_base_value *empty_clone (void) const
60  { return new octave_fcn_inline (); }
61 
62  bool is_inline_function (void) const { return true; }
63 
64  octave_fcn_inline *fcn_inline_value (bool = false) { return this; }
65 
66  std::string fcn_text (void) const { return iftext; }
67 
68  string_vector fcn_arg_names (void) const { return ifargs; }
69 
70  octave_value convert_to_str_internal (bool, bool, char) const;
71 
72  octave_map map_value (void) const;
73 
74  bool save_ascii (std::ostream& os);
75 
76  bool load_ascii (std::istream& is);
77 
78  bool save_binary (std::ostream& os, bool& save_as_floats);
79 
80  bool load_binary (std::istream& is, bool swap,
82 
83 #if defined (HAVE_HDF5)
84  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
85 
86  bool load_hdf5 (hid_t loc_id, const char *name);
87 #endif
88 
89  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
90 
91  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
92 
93 private:
94 
96 
98 
99  // The expression of an inline function.
100  std::string iftext;
101 
102  // The args of an inline function.
104 };
105 
106 #endif