GNU Octave  6.2.0
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-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_ov_mex_fcn_h)
27 #define octave_ov_mex_fcn_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 
33 #include "oct-shlib.h"
34 
35 #include "ov-fcn.h"
36 #include "ov-builtin.h"
37 #include "ov-typeinfo.h"
38 
39 class octave_value;
40 class octave_value_list;
41 
42 namespace octave
43 {
44  class tree_evaluator;
45 }
46 
47 // Dynamically-linked functions.
48 
49 class
51 {
52 public:
53 
55  : m_mex_fcn_ptr (), m_exit_fcn_ptr (), m_is_fmex (), m_sh_lib (),
56  m_time_checked (), m_is_system_fcn_file () { }
57 
58  octave_mex_function (void *fptr, bool fmex,
59  const octave::dynamic_library& shl,
60  const std::string& nm = "");
61 
62  // No copying!
63 
65 
66  octave_mex_function& operator = (const octave_mex_function& fn) = delete;
67 
68  ~octave_mex_function (void);
69 
70  octave_function * function_value (bool = false) { return this; }
71 
72  const octave_function * function_value (bool = false) const { return this; }
73 
75  {
76  m_time_checked = t;
77  }
78 
79  std::string fcn_file_name (void) const;
80 
81  octave::sys::time time_parsed (void) const;
82 
83  octave::sys::time time_checked (void) const { return m_time_checked; }
84 
85  bool is_system_fcn_file (void) const { return m_is_system_fcn_file; }
86 
87  bool is_builtin_function (void) const { return false; }
88 
89  bool is_mex_function (void) const { return true; }
90 
92  execute (octave::tree_evaluator& tw, int nargout = 0,
93  const octave_value_list& args = octave_value_list ());
94 
95  void atexit (void (*fcn) (void)) { m_exit_fcn_ptr = fcn; }
96 
97  octave::dynamic_library get_shlib (void) const { return m_sh_lib; }
98 
99  void *mex_fcn_ptr (void) const { return m_mex_fcn_ptr; }
100 
101  bool is_fmex (void) const { return m_is_fmex; }
102 
103 private:
104 
106 
107  void (*m_exit_fcn_ptr) (void);
108 
109  bool m_is_fmex;
110 
112 
113  // The time the file was last checked to see if it needs to be
114  // parsed again.
116 
117  // True if this function came from a file that is considered to be a
118  // system function. This affects whether we check the time stamp
119  // on the file to see if it has changed.
121 
123 };
124 
125 #endif
bool is_builtin_function(void) const
Definition: ov-mex-fcn.h:87
const octave_function * function_value(bool=false) const
Definition: ov-mex-fcn.h:72
bool is_fmex(void) const
Definition: ov-mex-fcn.h:101
void * mex_fcn_ptr(void) const
Definition: ov-mex-fcn.h:99
void atexit(void(*fcn)(void))
Definition: ov-mex-fcn.h:95
void mark_fcn_file_up_to_date(const octave::sys::time &t)
Definition: ov-mex-fcn.h:74
octave::sys::time m_time_checked
Definition: ov-mex-fcn.h:115
bool is_mex_function(void) const
Definition: ov-mex-fcn.h:89
octave_function * function_value(bool=false)
Definition: ov-mex-fcn.h:70
octave::dynamic_library m_sh_lib
Definition: ov-mex-fcn.h:111
octave::sys::time time_checked(void) const
Definition: ov-mex-fcn.h:83
octave_mex_function(const octave_mex_function &fn)=delete
bool is_system_fcn_file(void) const
Definition: ov-mex-fcn.h:85
octave::dynamic_library get_shlib(void) const
Definition: ov-mex-fcn.h:97
octave_mex_function(void)
Definition: ov-mex-fcn.h:54
FloatComplex(* fptr)(const FloatComplex &, float, int, octave_idx_type &)
Definition: lo-specfun.cc:1128
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:158