1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef IGL_MATLAB_MEX_STREAM_H
- #define IGL_MATLAB_MEX_STREAM_H
- #include <iostream>
- namespace igl
- {
- namespace matlab
- {
-
-
-
-
-
-
-
-
-
-
-
-
- class MexStream : public std::streambuf
- {
- public:
- protected:
- inline virtual std::streamsize xsputn(const char *s, std::streamsize n);
- inline virtual int overflow(int c = EOF);
- };
- }
- }
- #include <mex.h>
- inline std::streamsize igl::matlab::MexStream::xsputn(
- const char *s,
- std::streamsize n)
- {
- mexPrintf("%.*s",n,s);
- mexEvalString("drawnow;");
- return n;
- }
- inline int igl::matlab::MexStream::overflow(int c)
- {
- if (c != EOF) {
- mexPrintf("%.1s",&c);
- mexEvalString("drawnow;");
- }
- return 1;
- }
- #endif
|