summaryrefslogtreecommitdiffstats
path: root/matlab/mex/mexInitFunctions.cpp
blob: d8a50d7fea375c5f0b57d0cbc3ef1d2367cc5add (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
#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(msg);
}

/**
 * Initialize mex functions.
 *
 */
void initASTRAMex(){
    if(mexIsInitialized) return;
    if(!astra::CLogger::setCallbackScreen(&logCallBack)){
        mexErrMsgTxt("Error initializing mex functions.");
    }
    mexIsInitialized=true;
}