00001 /* 00002 00003 Copyright (C) 1996-2012 John W. Eaton 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_dld_function_h) 00024 #define octave_dld_function_h 1 00025 00026 #include <string> 00027 00028 #include "oct-shlib.h" 00029 00030 #include "ov-fcn.h" 00031 #include "ov-builtin.h" 00032 #include "ov-typeinfo.h" 00033 00034 class octave_shlib; 00035 00036 class octave_value; 00037 class octave_value_list; 00038 00039 // Dynamically-linked functions. 00040 00041 class 00042 OCTINTERP_API 00043 octave_dld_function : public octave_builtin 00044 { 00045 public: 00046 00047 octave_dld_function (void) 00048 : sh_lib (), t_checked (), system_fcn_file () 00049 { } 00050 00051 octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl, 00052 const std::string& nm = std::string (), 00053 const std::string& ds = std::string ()); 00054 00055 ~octave_dld_function (void); 00056 00057 void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } 00058 00059 std::string fcn_file_name (void) const; 00060 00061 octave_time time_parsed (void) const; 00062 00063 octave_time time_checked (void) const { return t_checked; } 00064 00065 bool is_system_fcn_file (void) const { return system_fcn_file; } 00066 00067 bool is_builtin_function (void) const { return false; } 00068 00069 bool is_dld_function (void) const { return true; } 00070 00071 static octave_dld_function* create (octave_builtin::fcn ff, 00072 const octave_shlib& shl, 00073 const std::string& nm = std::string (), 00074 const std::string& ds = std::string ()); 00075 00076 octave_shlib get_shlib (void) const 00077 { return sh_lib; } 00078 00079 private: 00080 00081 octave_shlib sh_lib; 00082 00083 // The time the file was last checked to see if it needs to be 00084 // parsed again. 00085 mutable octave_time t_checked; 00086 00087 // True if this function came from a file that is considered to be a 00088 // system function. This affects whether we check the time stamp 00089 // on the file to see if it has changed. 00090 bool system_fcn_file; 00091 00092 // No copying! 00093 00094 octave_dld_function (const octave_dld_function& fn); 00095 00096 octave_dld_function& operator = (const octave_dld_function& fn); 00097 00098 DECLARE_OCTAVE_ALLOCATOR 00099 00100 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 00101 }; 00102 00103 #endif