summaryrefslogtreecommitdiffstats
path: root/matlab/mex
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-12-17 14:37:41 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-01-05 11:15:17 +0100
commitfc86917da1a175c04e9bd2e5f0bedb0a48a81c26 (patch)
tree6996a3e2e2cfd110a566d4093e22ca746a52038d /matlab/mex
parent73fa0a8df8203288aca032c71caa5ff47d35a3e2 (diff)
downloadastra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.tar.gz
astra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.tar.bz2
astra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.tar.xz
astra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.zip
Replace boost::lexical_cast by stringstreams
This is to avoid the dependence of lexical_cast on the current locale. The stringstreams used for the new string parsing/output functions are explicitly imbued with the C/classic locale.
Diffstat (limited to 'matlab/mex')
-rw-r--r--matlab/mex/mexHelpFunctions.cpp8
-rw-r--r--matlab/mex/mexHelpFunctions.h1
2 files changed, 4 insertions, 5 deletions
diff --git a/matlab/mex/mexHelpFunctions.cpp b/matlab/mex/mexHelpFunctions.cpp
index 58e84d2..13c4ade 100644
--- a/matlab/mex/mexHelpFunctions.cpp
+++ b/matlab/mex/mexHelpFunctions.cpp
@@ -31,9 +31,9 @@ $Id$
* \brief Contains some functions for interfacing matlab with c data structures
*/
#include "mexHelpFunctions.h"
+#include "astra/Utilities.h"
#include <algorithm>
-#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
@@ -58,7 +58,7 @@ string mexToString(const mxArray* pInput)
// is scalar?
if (mxIsNumeric(pInput) && mxGetM(pInput)*mxGetN(pInput) == 1) {
- return boost::lexical_cast<string>(mxGetScalar(pInput));
+ return StringUtil::doubleToString(mxGetScalar(pInput));
}
return "";
@@ -378,7 +378,7 @@ mxArray* stringToMxArray(std::string input)
boost::split(col_strings, row_strings[row], boost::is_any_of(","));
// check size
for (unsigned int col = 0; col < col_strings.size(); col++) {
- out[col*rows + row] = boost::lexical_cast<float32>(col_strings[col]);
+ out[col*rows + row] = StringUtil::stringToFloat(col_strings[col]);
}
}
return pMatrix;
@@ -397,7 +397,7 @@ mxArray* stringToMxArray(std::string input)
// loop elements
for (unsigned int i = 0; i < items.size(); i++) {
- out[i] = boost::lexical_cast<float32>(items[i]);
+ out[i] = StringUtil::stringToFloat(items[i]);
}
return pVector;
}
diff --git a/matlab/mex/mexHelpFunctions.h b/matlab/mex/mexHelpFunctions.h
index 3ac5bd8..07edc64 100644
--- a/matlab/mex/mexHelpFunctions.h
+++ b/matlab/mex/mexHelpFunctions.h
@@ -37,7 +37,6 @@ $Id$
#include <algorithm>
#include <mex.h>
-#include <boost/lexical_cast.hpp>
#include <boost/any.hpp>
#include "astra/Globals.h"