blob: 7245af2fdfaf06fcd1c5c8850e330abbe2709ae3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <mex.h>
#include "astra/Logging.h"
bool mexIsInitialized=false;
/**
* Callback to print log message to Matlab window.
*
*/
void logCallBack(const char *msg, size_t len){
mexPrintf("%s",msg);
}
/**
* Initialize mex functions.
*
*/
void initASTRAMex(){
if(mexIsInitialized) return;
astra::running_in_matlab=true;
if(!astra::CLogger::setCallbackScreen(&logCallBack)){
mexErrMsgTxt("Error initializing mex functions.");
}
mexIsInitialized=true;
// If we have support for plugins, initialize them.
// (NB: Call this after setting mexIsInitialized, to avoid recursively
// calling initASTRAMex)
mexEvalString("if exist('astra_mex_plugin_c') == 3; astra_mex_plugin_c('init'); end");
}
|