00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00033 #ifdef MARSYAS_MATLAB
00034
00035 #if !defined(__MATLABENGINE_H__)
00036 #define __MATLABENGINE_H__
00037
00038 #include <string>
00039 #include <sstream>
00040 #include <vector>
00041
00042 #include "realvec.h"
00043 #include "common_header.h"
00044
00045 #include "engine.h"
00046
00047
00048
00049
00050
00051 #if MX_API_VER <= 0x07020000
00052 typedef int mwSize;
00053 typedef int mwIndex;
00054 #endif
00055
00056 namespace Marsyas
00057 {
00058
00059 class realvec;
00060
00061 class marsyas_EXPORT MATLABengine
00062 {
00063 private:
00064 Engine *engine_;
00065 static MATLABengine *instance_;
00066
00067 MATLABengine();
00068
00069 public:
00070 virtual ~MATLABengine();
00071
00072 static MATLABengine *getMatlabEng();
00073 void closeMatlabEng();
00074 void evalString(const std::ostringstream& oss);
00075
00076
00077
00078
00079 void putVariable(const std::string value, std::string MATLABname);
00080 void putVariable(const long *const value, unsigned int size, std::string MATLABname);
00081 void putVariable(const float *const value, unsigned int size, std::string MATLABname);
00082 void putVariable(const double *const value, unsigned int size, std::string MATLABname);
00083
00084 void putVariable(mrs_natural value, std::string MATLABname);
00085 void putVariable(mrs_real value, std::string MATLABname);
00086 void putVariable(mrs_complex value, std::string MATLABname);
00087
00088 void putVariable(realvec value, std::string MATLABname);
00089
00090 void putVariable(std::vector<mrs_natural> value, std::string MATLABname);
00091 void putVariable(std::vector<mrs_real> value, std::string MATLABname);
00092 void putVariable(std::vector<mrs_complex> value, std::string MATLABname);
00093
00094
00095
00096
00097 int getVariable(std::string MATLABname, mrs_natural& value);
00098 int getVariable(std::string MATLABname, mrs_real& value);
00099 int getVariable(std::string MATLABname, mrs_complex& value);
00100
00101 int getVariable(std::string MATLABname, realvec& value);
00102
00103 int getVariable(std::string MATLABname, std::vector<mrs_natural> &value);
00104 int getVariable(std::string MATLABname, std::vector<mrs_real> &value);
00105 int getVariable(std::string MATLABname, std::vector<mrs_complex> &value);
00106 };
00107
00108 }
00109
00110 #endif //__MATLABENGINE_H__
00111
00112 #endif //_MATLAB_ENGINE
00113
00114