libigl
v2.5.0
Loading...
Searching...
No Matches
MexStream.h
Go to the documentation of this file.
1
// This file is part of libigl, a simple c++ geometry processing library.
2
//
3
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public License
6
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7
// obtain one at http://mozilla.org/MPL/2.0/.
8
#ifndef IGL_MATLAB_MEX_STREAM_H
9
#define IGL_MATLAB_MEX_STREAM_H
10
#include <iostream>
11
namespace
igl
12
{
13
namespace
matlab
14
{
15
29
class
MexStream :
public
std::streambuf
30
{
31
public
:
32
protected
:
33
inline
virtual
std::streamsize xsputn(
const
char
*s, std::streamsize n);
34
inline
virtual
int
overflow(
int
c = EOF);
35
};
36
}
37
}
38
39
// Implementation
40
#include <mex.h>
41
inline
std::streamsize igl::matlab::MexStream::xsputn(
42
const
char
*s,
43
std::streamsize n)
44
{
45
mexPrintf(
"%.*s"
,n,s);
46
mexEvalString(
"drawnow;"
);
// to dump string.
47
return
n;
48
}
49
50
inline
int
igl::matlab::MexStream::overflow(
int
c)
51
{
52
if
(c != EOF) {
53
mexPrintf(
"%.1s"
,&c);
54
mexEvalString(
"drawnow;"
);
// to dump string.
55
}
56
return
1;
57
}
58
#endif
igl
Definition
AABB.h:17
include
igl
matlab
MexStream.h
Generated by
1.9.8