Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_function_h)
00024 #define octave_function_h 1
00025
00026 #include <string>
00027
00028 #include "oct-time.h"
00029 #include "str-vec.h"
00030
00031 #include "oct-alloc.h"
00032 #include "oct-obj.h"
00033 #include "ov-base.h"
00034 #include "ov-typeinfo.h"
00035 #include "symtab.h"
00036
00037 class tree_walker;
00038
00039
00040
00041 class
00042 OCTINTERP_API
00043 octave_function : public octave_base_value
00044 {
00045 public:
00046
00047 octave_function (void)
00048 : relative (false), locked (false), private_function (false),
00049 xdispatch_class (), my_name (), my_dir_name (), doc () { }
00050
00051 ~octave_function (void) { }
00052
00053 octave_base_value *clone (void) const;
00054 octave_base_value *empty_clone (void) const;
00055
00056 bool is_defined (void) const { return true; }
00057
00058 bool is_function (void) const { return true; }
00059
00060 virtual bool is_system_fcn_file (void) const { return false; }
00061
00062 virtual std::string fcn_file_name (void) const { return std::string (); }
00063
00064 virtual std::string parent_fcn_name (void) const { return std::string (); }
00065
00066 virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; }
00067
00068 virtual void mark_fcn_file_up_to_date (const octave_time&) { }
00069
00070 virtual symbol_table::scope_id scope (void) { return -1; }
00071
00072 virtual octave_time time_parsed (void) const
00073 { return octave_time (static_cast<time_t> (0)); }
00074
00075 virtual octave_time time_checked (void) const
00076 { return octave_time (static_cast<time_t> (0)); }
00077
00078 virtual bool is_subfunction (void) const { return false; }
00079
00080 virtual bool is_class_constructor (const std::string& = std::string ()) const
00081 { return false; }
00082
00083 virtual bool is_class_method (const std::string& = std::string ()) const
00084 { return false; }
00085
00086 virtual bool takes_varargs (void) const { return false; }
00087
00088 virtual bool takes_var_return (void) const { return false; }
00089
00090 void stash_dispatch_class (const std::string& nm) { xdispatch_class = nm; }
00091
00092 std::string dispatch_class (void) const { return xdispatch_class; }
00093
00094 virtual void
00095 mark_as_private_function (const std::string& cname = std::string ())
00096 {
00097 private_function = true;
00098 xdispatch_class = cname;
00099 }
00100
00101 bool is_private_function (void) const { return private_function; }
00102
00103 bool is_private_function_of_class (const std::string& nm)
00104 { return private_function && xdispatch_class == nm; }
00105
00106 std::string dir_name (void) const { return my_dir_name; }
00107
00108 void stash_dir_name (const std::string& dir) { my_dir_name = dir; }
00109
00110 void lock (void)
00111 {
00112 this->lock_subfunctions ();
00113 locked = true;
00114 }
00115
00116 void unlock (void)
00117 {
00118 this->unlock_subfunctions ();
00119 locked = false;
00120 }
00121
00122 bool islocked (void) const { return locked; }
00123
00124 virtual void lock_subfunctions (void) { }
00125
00126 virtual void unlock_subfunctions (void) { }
00127
00128 void mark_relative (void) { relative = true; }
00129
00130 bool is_relative (void) const { return relative; }
00131
00132 std::string name (void) const { return my_name; }
00133
00134 void document (const std::string& ds) { doc = ds; }
00135
00136 std::string doc_string (void) const { return doc; }
00137
00138 virtual void unload (void) { }
00139
00140 virtual void accept (tree_walker&) { }
00141
00142 protected:
00143
00144 octave_function (const std::string& nm,
00145 const std::string& ds = std::string ())
00146 : relative (false), locked (false), private_function (false),
00147 xdispatch_class (), my_name (nm), my_dir_name (), doc (ds) { }
00148
00149
00150 bool relative;
00151
00152
00153 bool locked;
00154
00155
00156 bool private_function;
00157
00158
00159
00160
00161 std::string xdispatch_class;
00162
00163
00164 std::string my_name;
00165
00166
00167
00168 std::string my_dir_name;
00169
00170
00171 std::string doc;
00172
00173 private:
00174
00175
00176
00177 octave_function (const octave_function& f);
00178
00179 octave_function& operator = (const octave_function& f);
00180
00181 DECLARE_OCTAVE_ALLOCATOR
00182 };
00183
00184 #endif