diff options
author | Willem Jan Palenstijn <wjp@usecode.org> | 2015-03-20 15:32:25 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <wjp@usecode.org> | 2015-03-20 15:32:25 +0100 |
commit | 8d9ddc51076ce0da3d0a4216b1bc495783f3733c (patch) | |
tree | 200d43d0356f052fe23da463330e43b37138386e /matlab/mex/mexInitFunctions.cpp | |
parent | 2d55fd38b4a8ef5076c0591ae4147f81c1107ee3 (diff) | |
parent | 9ba78fcfa3dec88928df33be26821e3fd5a10727 (diff) | |
download | astra-8d9ddc51076ce0da3d0a4216b1bc495783f3733c.tar.gz astra-8d9ddc51076ce0da3d0a4216b1bc495783f3733c.tar.bz2 astra-8d9ddc51076ce0da3d0a4216b1bc495783f3733c.tar.xz astra-8d9ddc51076ce0da3d0a4216b1bc495783f3733c.zip |
Merge pull request #30 from dmpelt/logging
New logging API
Diffstat (limited to 'matlab/mex/mexInitFunctions.cpp')
-rw-r--r-- | matlab/mex/mexInitFunctions.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/matlab/mex/mexInitFunctions.cpp b/matlab/mex/mexInitFunctions.cpp new file mode 100644 index 0000000..d8a50d7 --- /dev/null +++ b/matlab/mex/mexInitFunctions.cpp @@ -0,0 +1,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; +} |