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

    astra::running_in_matlab=true;

    if(!astra::CLogger::setCallbackScreen(&logCallBack)){
        mexErrMsgTxt("Error initializing mex functions.");
    }
    mexIsInitialized=true;
}