GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-mex-fcn.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 John W. Eaton
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_mex_fcn_h)
24 #define octave_ov_mex_fcn_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 #include "oct-shlib.h"
31 
32 #include "ov-fcn.h"
33 #include "ov-builtin.h"
34 #include "ov-typeinfo.h"
35 
36 class octave_value;
37 class octave_value_list;
38 
39 namespace octave
40 {
41  class tree_evaluator;
42 }
43 
44 // Dynamically-linked functions.
45 
46 class
48 {
49 public:
50 
52  : m_mex_fcn_ptr (), m_exit_fcn_ptr (), m_is_fmex (), m_sh_lib (),
53  m_time_checked (), m_is_system_fcn_file () { }
54 
55  octave_mex_function (void *fptr, bool fmex,
56  const octave::dynamic_library& shl,
57  const std::string& nm = "");
58 
59  // No copying!
60 
61  octave_mex_function (const octave_mex_function& fn) = delete;
62 
63  octave_mex_function& operator = (const octave_mex_function& fn) = delete;
64 
65  ~octave_mex_function (void);
66 
67  octave_function * function_value (bool = false) { return this; }
68 
69  const octave_function * function_value (bool = false) const { return this; }
70 
72  {
73  m_time_checked = t;
74  }
75 
76  std::string fcn_file_name (void) const;
77 
78  octave::sys::time time_parsed (void) const;
79 
80  octave::sys::time time_checked (void) const { return m_time_checked; }
81 
82  bool is_system_fcn_file (void) const { return m_is_system_fcn_file; }
83 
84  bool is_builtin_function (void) const { return false; }
85 
86  bool is_mex_function (void) const { return true; }
87 
89  call (octave::tree_evaluator& tw, int nargout = 0,
90  const octave_value_list& args = octave_value_list ());
91 
92  void atexit (void (*fcn) (void)) { m_exit_fcn_ptr = fcn; }
93 
94  octave::dynamic_library get_shlib (void) const { return m_sh_lib; }
95 
96  void *mex_fcn_ptr (void) const { return m_mex_fcn_ptr; }
97 
98  bool is_fmex (void) const { return m_is_fmex; }
99 
100 private:
101 
103 
104  void (*m_exit_fcn_ptr) (void);
105 
106  bool m_is_fmex;
107 
109 
110  // The time the file was last checked to see if it needs to be
111  // parsed again.
113 
114  // True if this function came from a file that is considered to be a
115  // system function. This affects whether we check the time stamp
116  // on the file to see if it has changed.
118 
120 };
121 
122 #endif
bool is_system_fcn_file(void) const
Definition: ov-mex-fcn.h:82
bool is_builtin_function(void) const
Definition: ov-mex-fcn.h:84
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:997
octave_function * fcn
Definition: ov-class.cc:1754
octave::sys::time time_checked(void) const
Definition: ov-mex-fcn.h:80
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:158
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:997
octave_function * function_value(bool=false)
Definition: ov-mex-fcn.h:67
bool is_fmex(void) const
Definition: ov-mex-fcn.h:98
void * mex_fcn_ptr(void) const
Definition: ov-mex-fcn.h:96
bool is_mex_function(void) const
Definition: ov-mex-fcn.h:86
void atexit(void(*fcn)(void))
Definition: ov-mex-fcn.h:92
FloatComplex(* fptr)(const FloatComplex &, float, int, octave_idx_type &)
Definition: lo-specfun.cc:1129
octave_mex_function(void)
Definition: ov-mex-fcn.h:51
octave::dynamic_library get_shlib(void) const
Definition: ov-mex-fcn.h:94
octave::sys::time m_time_checked
Definition: ov-mex-fcn.h:112
const octave_function * function_value(bool=false) const
Definition: ov-mex-fcn.h:69
octave::dynamic_library m_sh_lib
Definition: ov-mex-fcn.h:108
void mark_fcn_file_up_to_date(const octave::sys::time &t)
Definition: ov-mex-fcn.h:71
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