matlabfunctionhandle.h
Go to the documentation of this file.
1 #ifndef INCLUDE_MATLABFUNCTIONHANDLE
2 #define INCLUDE_MATLABFUNCTIONHANDLE
3 
4 #include "mex.h"
5 
6 // Class MatlabFunctionHandle.
7 // -----------------------------------------------------------------
9 public:
10 
11  // This is the default constructor. It stores a null function
12  // handle.
14 
15  // This constructor accepts as input a pointer to a Matlab array,
16  // which must be of the function handle class.
17  explicit MatlabFunctionHandle (const mxArray* ptr);
18 
19  // The copy constructor makes a full copy of the source object.
21 
22  // The destructor.
24 
25  // Conversion operator for pointer to MATLAB array.
26  operator mxArray* () const { return f; };
27 
28  // Returns false if and only if we have the null function handle.
29  operator bool() const { return f != 0; };
30 
31 protected:
32  mxArray* f; // The MATLAB array storing information concerning
33  // the function handle.
34 
35  // The copy assignment operator is not proper, thus remains protected.
37  { return *this; };
38 };
39 
40 #endif