ov-fcn-inline.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2004-2012 David Bateman
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_fcn_inline_h)
00024 #define octave_fcn_inline_h 1
00025 
00026 #include <iosfwd>
00027 #include <string>
00028 
00029 #include "oct-alloc.h"
00030 
00031 #include "ov-base.h"
00032 #include "ov-base-mat.h"
00033 #include "ov-fcn.h"
00034 #include "ov-typeinfo.h"
00035 #include "symtab.h"
00036 #include "ov-fcn-handle.h"
00037 
00038 // Inline functions.
00039 
00040 class
00041 OCTINTERP_API
00042 octave_fcn_inline : public octave_fcn_handle
00043 {
00044 public:
00045 
00046   octave_fcn_inline (void)
00047     : octave_fcn_handle (), iftext (), ifargs () { }
00048 
00049   octave_fcn_inline (const std::string& f, const string_vector& a,
00050                      const std::string& n = std::string ());
00051 
00052   octave_fcn_inline (const octave_fcn_inline& fi)
00053     : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { }
00054 
00055   ~octave_fcn_inline (void) { }
00056 
00057   octave_base_value *clone (void) const { return new octave_fcn_inline (*this); }
00058   octave_base_value *empty_clone (void) const { return new octave_fcn_inline (); }
00059 
00060   bool is_inline_function (void) const { return true; }
00061 
00062   octave_fcn_inline *fcn_inline_value (bool = false) { return this; }
00063 
00064   std::string fcn_text (void) const { return iftext; }
00065 
00066   string_vector fcn_arg_names (void) const { return ifargs; }
00067 
00068   octave_value convert_to_str_internal (bool, bool, char) const;
00069 
00070   octave_map map_value (void) const;
00071 
00072   bool save_ascii (std::ostream& os);
00073 
00074   bool load_ascii (std::istream& is);
00075 
00076   bool save_binary (std::ostream& os, bool& save_as_floats);
00077 
00078   bool load_binary (std::istream& is, bool swap,
00079                     oct_mach_info::float_format fmt);
00080 
00081 #if defined (HAVE_HDF5)
00082   bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
00083 
00084   bool load_hdf5 (hid_t loc_id, const char *name);
00085 #endif
00086 
00087   void print (std::ostream& os, bool pr_as_read_syntax = false) const;
00088 
00089   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
00090 
00091 private:
00092 
00093   DECLARE_OCTAVE_ALLOCATOR
00094 
00095   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00096 
00097   // The expression of an inline function.
00098   std::string iftext;
00099 
00100   // The args of an inline function.
00101   string_vector ifargs;
00102 };
00103 
00104 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines