Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
e6e520f8
Commit
e6e520f8
authored
May 28, 2016
by
Hahn, Steven
Browse files
Use to_string instead of lexical_cast.
parent
085529ef
Changes
124
Hide whitespace changes
Inline
Side-by-side
Framework/API/inc/MantidAPI/ITableWorkspace.h
View file @
e6e520f8
...
...
@@ -232,8 +232,7 @@ public:
throw
std
::
runtime_error
(
ostr
.
str
());
}
if
(
row
>=
this
->
rowCount
())
{
throw
std
::
range_error
(
"Table does not have row "
+
boost
::
lexical_cast
<
std
::
string
>
(
row
));
throw
std
::
range_error
(
"Table does not have row "
+
std
::
to_string
(
row
));
}
return
*
(
static_cast
<
T
*>
(
c
->
void_pointer
(
row
)));
}
...
...
Framework/API/src/AnalysisDataService.cpp
View file @
e6e520f8
...
...
@@ -81,7 +81,7 @@ void AnalysisDataServiceImpl::add(
std
::
string
wsName
=
ws
->
name
();
// if anonymous make up a name and add
if
(
wsName
.
empty
())
{
wsName
=
name
+
"_"
+
boost
::
lexical_cast
<
std
::
string
>
(
i
+
1
);
wsName
=
name
+
"_"
+
std
::
to_
string
(
i
+
1
);
}
else
if
(
doesExist
(
wsName
))
{
// if ws is already there do nothing
wsName
.
clear
();
}
...
...
@@ -120,7 +120,7 @@ void AnalysisDataServiceImpl::addOrReplace(
std
::
string
wsName
=
ws
->
name
();
// make up a name for an anonymous workspace
if
(
wsName
.
empty
())
{
wsName
=
name
+
"_"
+
boost
::
lexical_cast
<
std
::
string
>
(
i
+
1
);
wsName
=
name
+
"_"
+
std
::
to_
string
(
i
+
1
);
}
else
if
(
doesExist
(
wsName
))
{
// if ws is already there do nothing
wsName
.
clear
();
}
...
...
Framework/API/src/ExperimentInfo.cpp
View file @
e6e520f8
...
...
@@ -345,7 +345,7 @@ ExperimentInfo::getGroupMembers(const detid_t detID) const {
}
else
{
throw
std
::
runtime_error
(
"ExperimentInfo::getGroupMembers - Unable to find ID "
+
boost
::
lexical_cast
<
std
::
string
>
(
detID
)
+
" in lookup"
);
std
::
to_
string
(
detID
)
+
" in lookup"
);
}
}
...
...
Framework/API/src/FileFinder.cpp
View file @
e6e520f8
...
...
@@ -643,7 +643,7 @@ FileFinderImpl::findRuns(const std::string &hintstr) const {
throw
std
::
invalid_argument
(
"Malformed range of runs: "
+
*
h
);
}
for
(
int
irun
=
runNumber
;
irun
<=
runEndNumber
;
++
irun
)
{
run
=
boost
::
lexical_cast
<
std
::
string
>
(
irun
);
run
=
std
::
to_
string
(
irun
);
while
(
run
.
size
()
<
nZero
)
run
.
insert
(
0
,
"0"
);
std
::
string
path
=
findRun
(
p1
.
first
+
run
);
...
...
Framework/API/src/GroupingLoader.cpp
View file @
e6e520f8
...
...
@@ -251,7 +251,7 @@ Grouping::Grouping(ITableWorkspace_sptr table) {
// Convert to a range string, i.e. 1-5,6-8,9
std
::
string
detectorRange
=
Kernel
::
Strings
::
toString
(
detectors
);
this
->
groupNames
.
push_back
(
boost
::
lexical_cast
<
std
::
string
>
(
row
+
1
));
this
->
groupNames
.
push_back
(
std
::
to_
string
(
row
+
1
));
this
->
groups
.
push_back
(
detectorRange
);
}
...
...
Framework/API/src/IEventWorkspace.cpp
View file @
e6e520f8
...
...
@@ -13,7 +13,7 @@ const std::string IEventWorkspace::toString() const {
std
::
ostringstream
os
;
os
<<
MatrixWorkspace
::
toString
()
<<
"
\n
"
;
os
<<
"Events: "
+
boost
::
lexical_cast
<
std
::
string
>
(
getNumberEvents
());
os
<<
"Events: "
+
std
::
to_
string
(
getNumberEvents
());
switch
(
getEventType
())
{
case
WEIGHTED
:
os
<<
" (weighted)
\n
"
;
...
...
Framework/API/src/IFuncMinimizer.cpp
View file @
e6e520f8
...
...
@@ -33,8 +33,7 @@ bool IFuncMinimizer::minimize(size_t maxIterations) {
m_errorString
+=
'\n'
;
}
m_errorString
+=
"Failed to converge after "
+
boost
::
lexical_cast
<
std
::
string
>
(
maxIterations
)
+
" iterations."
;
std
::
to_string
(
maxIterations
)
+
" iterations."
;
}
return
success
;
...
...
Framework/API/src/IFunction.cpp
View file @
e6e520f8
...
...
@@ -314,9 +314,7 @@ protected:
return
(
m_quoteString
)
?
std
::
string
(
"
\"
"
+
str
+
"
\"
"
)
:
str
;
}
/// Apply if int
std
::
string
apply
(
const
int
&
i
)
const
override
{
return
boost
::
lexical_cast
<
std
::
string
>
(
i
);
}
std
::
string
apply
(
const
int
&
i
)
const
override
{
return
std
::
to_string
(
i
);
}
/// Apply if double
std
::
string
apply
(
const
double
&
d
)
const
override
{
return
boost
::
lexical_cast
<
std
::
string
>
(
d
);
...
...
Framework/API/src/IFunctionMD.cpp
View file @
e6e520f8
...
...
@@ -93,7 +93,7 @@ void IFunctionMD::evaluateFunction(const FunctionDomainMD &domain,
for
(
const
IMDIterator
*
r
=
domain
.
getNextIterator
();
r
!=
nullptr
;
r
=
domain
.
getNextIterator
())
{
this
->
reportProgress
(
"Evaluating function for box "
+
boost
::
lexical_cast
<
std
::
string
>
(
i
+
1
));
std
::
to_
string
(
i
+
1
));
values
.
setCalculated
(
i
,
functionMD
(
*
r
));
i
++
;
};
...
...
Framework/API/src/IPeakFunction.cpp
View file @
e6e520f8
...
...
@@ -155,7 +155,7 @@ void IPeakFunction::functionDeriv1D(Jacobian *out, const double *xValues,
void
IPeakFunction
::
setPeakRadius
(
const
int
&
r
)
{
if
(
r
>
0
)
{
s_peakRadius
=
r
;
std
::
string
setting
=
boost
::
lexical_cast
<
std
::
string
>
(
r
);
std
::
string
setting
=
std
::
to_
string
(
r
);
Kernel
::
ConfigService
::
Instance
().
setString
(
"curvefitting.peakRadius"
,
setting
);
}
...
...
Framework/API/src/ITableWorkspace.cpp
View file @
e6e520f8
...
...
@@ -16,8 +16,8 @@ ITableWorkspace::clone(const std::vector<std::string> &colNames) const {
const
std
::
string
ITableWorkspace
::
toString
()
const
{
std
::
ostringstream
os
;
os
<<
id
()
<<
"
\n
"
;
os
<<
"Columns: "
<<
boost
::
lexical_cast
<
std
::
string
>
(
columnCount
())
<<
"
\n
"
;
os
<<
"Rows: "
<<
boost
::
lexical_cast
<
std
::
string
>
(
rowCount
())
<<
"
\n
"
;
os
<<
"Columns: "
<<
std
::
to_
string
(
columnCount
())
<<
"
\n
"
;
os
<<
"Rows: "
<<
std
::
to_
string
(
rowCount
())
<<
"
\n
"
;
os
<<
getMemorySizeAsStr
();
return
os
.
str
();
}
...
...
Framework/API/src/MatrixWorkspace.cpp
View file @
e6e520f8
...
...
@@ -1523,7 +1523,7 @@ signal_t MatrixWorkspace::getSignalAtCoord(
if
(
this
->
axes
()
!=
2
)
throw
std
::
invalid_argument
(
"MatrixWorkspace::getSignalAtCoord() - "
"Workspace can only have 2 axes, found "
+
boost
::
lexical_cast
<
std
::
string
>
(
this
->
axes
()));
std
::
to_
string
(
this
->
axes
()));
coord_t
x
=
coords
[
0
];
coord_t
y
=
coords
[
1
];
...
...
Framework/API/src/MultiDomainFunction.cpp
View file @
e6e520f8
...
...
@@ -104,11 +104,10 @@ void MultiDomainFunction::function(const FunctionDomain &domain,
const
CompositeDomain
&
cd
=
dynamic_cast
<
const
CompositeDomain
&>
(
domain
);
// domain must not have less parts than m_maxIndex
if
(
cd
.
getNParts
()
<=
m_maxIndex
)
{
throw
std
::
invalid_argument
(
"CompositeDomain has too few parts ("
+
boost
::
lexical_cast
<
std
::
string
>
(
cd
.
getNParts
())
+
") for MultiDomainFunction (max index "
+
boost
::
lexical_cast
<
std
::
string
>
(
m_maxIndex
)
+
")."
);
throw
std
::
invalid_argument
(
"CompositeDomain has too few parts ("
+
std
::
to_string
(
cd
.
getNParts
())
+
") for MultiDomainFunction (max index "
+
std
::
to_string
(
m_maxIndex
)
+
")."
);
}
// domain and values must be consistent
if
(
cd
.
size
()
!=
values
.
size
())
{
...
...
@@ -148,11 +147,10 @@ void MultiDomainFunction::functionDeriv(const FunctionDomain &domain,
const
CompositeDomain
&
cd
=
dynamic_cast
<
const
CompositeDomain
&>
(
domain
);
// domain must not have less parts than m_maxIndex
if
(
cd
.
getNParts
()
<
m_maxIndex
)
{
throw
std
::
invalid_argument
(
"CompositeDomain has too few parts ("
+
boost
::
lexical_cast
<
std
::
string
>
(
cd
.
getNParts
())
+
") for MultiDomainFunction (max index "
+
boost
::
lexical_cast
<
std
::
string
>
(
m_maxIndex
)
+
")."
);
throw
std
::
invalid_argument
(
"CompositeDomain has too few parts ("
+
std
::
to_string
(
cd
.
getNParts
())
+
") for MultiDomainFunction (max index "
+
std
::
to_string
(
m_maxIndex
)
+
")."
);
}
countValueOffsets
(
cd
);
...
...
@@ -207,9 +205,9 @@ MultiDomainFunction::getLocalAttribute(size_t i,
}
else
if
(
it
->
second
.
size
()
==
1
&&
it
->
second
.
front
()
==
i
)
{
return
IFunction
::
Attribute
(
"i"
);
}
else
if
(
!
it
->
second
.
empty
())
{
std
::
string
out
(
boo
st
::
lexical_cast
<
std
::
string
>
(
it
->
second
.
front
()));
std
::
string
out
(
st
d
::
to_string
(
front
()));
for
(
auto
i
=
it
->
second
.
begin
()
+
1
;
i
!=
it
->
second
.
end
();
++
it
)
{
out
+=
","
+
boost
::
lexical_cast
<
std
::
string
>
(
*
i
);
out
+=
","
+
std
::
to_
string
(
*
i
);
}
return
IFunction
::
Attribute
(
out
);
}
...
...
@@ -339,7 +337,7 @@ MultiDomainFunction::createEquivalentFunctions() const {
auto
fun
=
compositeFunctions
[
i
];
if
(
!
fun
||
fun
->
nFunctions
()
==
0
)
{
throw
std
::
runtime_error
(
"There is no function for domain "
+
boost
::
lexical_cast
<
std
::
string
>
(
i
));
std
::
to_
string
(
i
));
}
if
(
fun
->
nFunctions
()
>
1
)
{
outFunctions
[
i
]
=
fun
;
...
...
Framework/API/src/ParameterTie.cpp
View file @
e6e520f8
...
...
@@ -100,7 +100,7 @@ void ParameterTie::set(const std::string &expr) {
m_expression
=
""
;
while
(
boost
::
regex_search
(
start
,
end
,
res
,
rx
))
{
m_expression
.
append
(
start
,
res
[
0
].
first
);
m_expression
+=
"#"
+
boost
::
lexical_cast
<
std
::
string
>
(
varNames
[
res
[
1
]]);
m_expression
+=
"#"
+
std
::
to_
string
(
varNames
[
res
[
1
]]);
start
=
res
[
0
].
second
;
}
m_expression
.
append
(
start
,
end
);
...
...
Framework/API/src/SpectraAxis.cpp
View file @
e6e520f8
...
...
@@ -160,7 +160,7 @@ bool SpectraAxis::operator==(const Axis &axis2) const {
* @return label of requested axis index
*/
std
::
string
SpectraAxis
::
label
(
const
std
::
size_t
&
index
)
const
{
return
"sp-"
+
boost
::
lexical_cast
<
std
::
string
>
(
spectraNo
(
index
));
return
"sp-"
+
std
::
to_
string
(
spectraNo
(
index
));
}
/// returns min value defined on axis
...
...
Framework/Algorithms/src/CalculateFlatBackground.cpp
View file @
e6e520f8
...
...
@@ -154,7 +154,7 @@ void CalculateFlatBackground::exec() {
// not every spectra is the monitor or detector, some spectra have no
// instrument components attached.
g_log
.
information
(
" Can not find detector for spectra N: "
+
boost
::
lexical_cast
<
std
::
string
>
(
currentSpec
)
+
std
::
to_
string
(
currentSpec
)
+
" Processing background anyway
\n
"
);
}
}
...
...
Framework/Algorithms/src/CalculateTransmission.cpp
View file @
e6e520f8
...
...
@@ -51,7 +51,7 @@ size_t getIndexFromDetectorID(MatrixWorkspace_sptr ws, detid_t detid) {
if
(
result
.
empty
())
throw
std
::
invalid_argument
(
"Could not find the spectra corresponding to detector ID "
+
boost
::
lexical_cast
<
std
::
string
>
(
detid
));
std
::
to_
string
(
detid
));
return
result
[
0
];
}
...
...
@@ -192,10 +192,10 @@ void CalculateTransmission::exec() {
BOOST_FOREACH
(
size_t
transmissionIndex
,
transmissionIndices
)
if
(
transmissionIndex
==
beamMonitorIndex
)
throw
std
::
invalid_argument
(
"The IncidentBeamMonitor UDET ("
+
boost
::
lexical_cast
<
std
::
string
>
(
transmissionIndex
)
+
") matches a UDET given in "
+
transPropName
+
"."
);
throw
std
::
invalid_argument
(
"The IncidentBeamMonitor UDET ("
+
std
::
to_string
(
transmissionIndex
)
+
") matches a UDET given in "
+
transPropName
+
"."
);
}
MatrixWorkspace_sptr
sampleInc
;
...
...
@@ -495,8 +495,7 @@ CalculateTransmission::rebin(std::vector<double> &binParams,
void
CalculateTransmission
::
logIfNotMonitor
(
API
::
MatrixWorkspace_sptr
sampleWS
,
API
::
MatrixWorkspace_sptr
directWS
,
size_t
index
)
{
const
std
::
string
message
=
"The detector at index "
+
boost
::
lexical_cast
<
std
::
string
>
(
index
)
+
const
std
::
string
message
=
"The detector at index "
+
std
::
to_string
(
index
)
+
" is not a monitor in the "
;
if
(
!
sampleWS
->
getDetector
(
index
)
->
isMonitor
())
g_log
.
information
(
message
+
"sample workspace."
);
...
...
Framework/Algorithms/src/ConvertEmptyToTof.cpp
View file @
e6e520f8
...
...
@@ -177,7 +177,7 @@ void ConvertEmptyToTof::validateWorkspaceIndices(std::vector<int> &v) {
for
(
auto
index
:
v
)
{
if
(
index
<
0
||
static_cast
<
size_t
>
(
index
)
>=
nHist
)
{
throw
std
::
runtime_error
(
"Spectra index out of limits: "
+
boost
::
lexical_cast
<
std
::
string
>
(
index
));
std
::
to_
string
(
index
));
}
}
}
...
...
@@ -202,7 +202,7 @@ void ConvertEmptyToTof::validateChannelIndices(std::vector<int> &v) {
for
(
auto
&
index
:
v
)
{
if
(
index
<
0
||
static_cast
<
size_t
>
(
index
)
>=
blockSize
)
{
throw
std
::
runtime_error
(
"Channel index out of limits: "
+
boost
::
lexical_cast
<
std
::
string
>
(
index
));
std
::
to_
string
(
index
));
}
}
}
...
...
Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp
View file @
e6e520f8
...
...
@@ -142,17 +142,16 @@ void CreateTransmissionWorkspaceAuto::exec() {
instrument
->
getNumberParameter
(
"PointDetectorStop"
)[
0
]);
if
(
analysis_mode
==
"PointDetectorAnalysis"
)
{
if
(
start
==
stop
)
{
processing_commands
=
boost
::
lexical_cast
<
std
::
string
>
(
start
);
processing_commands
=
std
::
to_
string
(
start
);
}
else
{
processing_commands
=
boost
::
lexical_cast
<
std
::
string
>
(
start
)
+
":"
+
boo
st
::
lexical_cast
<
std
::
string
>
(
stop
);
processing_commands
=
st
d
::
to_string
(
start
)
+
":"
+
std
::
to_
string
(
stop
);
}
}
else
{
processing_commands
=
boost
::
lexical_cast
<
std
::
string
>
(
static_cast
<
int
>
(
std
::
to_
string
(
static_cast
<
int
>
(
instrument
->
getNumberParameter
(
"MultiDetectorStart"
)[
0
]))
+
":"
+
boost
::
lexical_cast
<
std
::
string
>
(
firstWS
->
getNumberHistograms
()
-
1
);
":"
+
std
::
to_string
(
firstWS
->
getNumberHistograms
()
-
1
);
}
}
else
{
std
::
string
processing_commands_temp
=
...
...
Framework/Algorithms/src/GetAllEi.cpp
View file @
e6e520f8
...
...
@@ -285,7 +285,7 @@ void GetAllEi::exec() {
}
}
g_log
.
debug
()
<<
"*From all chopper opening only: "
+
boost
::
lexical_cast
<
std
::
string
>
(
guess_ei
.
size
())
+
std
::
to_
string
(
guess_ei
.
size
())
+
" fell within both monitor's recording energy range
\n
"
;
g_log
.
debug
()
<<
" Guess Energies are:
\n
"
;
for
(
double
ei
:
guess_ei
)
{
...
...
@@ -323,7 +323,7 @@ void GetAllEi::exec() {
irange1_max
.
assign
(
irange_max
.
begin
(),
irange_max
.
end
());
}
g_log
.
debug
()
<<
"*Identified: "
+
boost
::
lexical_cast
<
std
::
string
>
(
guess_ei
.
size
())
+
<<
"*Identified: "
+
std
::
to_
string
(
guess_ei
.
size
())
+
" peaks with sufficient signal around guess chopper opening
\n
"
;
std
::
vector
<
peakKeeper
>
peaks
;
...
...
@@ -557,21 +557,18 @@ bool GetAllEi::peakGuess(const API::MatrixWorkspace_sptr &inputWS, size_t index,
}
if
(
iterations_fail
)
{
g_log
.
information
()
<<
"*No peak search convergence after "
+
boost
::
lexical_cast
<
std
::
string
>
(
ic
)
+
std
::
to_
string
(
ic
)
+
" smoothing iterations at still_count: "
+
boost
::
lexical_cast
<
std
::
string
>
(
stay_still_count
)
+
std
::
to_string
(
stay_still_count
)
+
" Wrong energy or noisy peak at Ei="
+
boost
::
lexical_cast
<
std
::
string
>
(
Ei
)
<<
std
::
endl
;
}
g_log
.
debug
()
<<
"*Performed: "
+
boost
::
lexical_cast
<
std
::
string
>
(
ic
)
+
" averages for spectra "
+
boost
::
lexical_cast
<
std
::
string
>
(
index
)
+
g_log
.
debug
()
<<
"*Performed: "
+
std
::
to_string
(
ic
)
+
" averages for spectra "
+
std
::
to_string
(
index
)
+
" at energy: "
+
boost
::
lexical_cast
<
std
::
string
>
(
Ei
)
+
"
\n
and found: "
+
boost
::
lexical_cast
<
std
::
string
>
(
nPeaks
)
+
"peaks and "
+
boost
::
lexical_cast
<
std
::
string
>
(
nHills
)
+
" hills
\n
"
;
"
\n
and found: "
+
std
::
to_string
(
nPeaks
)
+
"peaks and "
+
std
::
to_string
(
nHills
)
+
" hills
\n
"
;
if
(
nPeaks
!=
1
)
{
g_log
.
debug
()
<<
"*Peak rejected as n-peaks !=1 after averaging
\n
"
;
return
false
;
...
...
@@ -586,10 +583,8 @@ bool GetAllEi::peakGuess(const API::MatrixWorkspace_sptr &inputWS, size_t index,
peakTwoSigma
=
hillsPos
[
1
]
-
hillsPos
[
0
];
}
else
{
g_log
.
debug
()
<<
"*Peak rejected as averaging gives: "
+
boost
::
lexical_cast
<
std
::
string
>
(
nPeaks
)
+
" peaks and "
+
boost
::
lexical_cast
<
std
::
string
>
(
nHills
)
+
" heals
\n
"
;
std
::
to_string
(
nPeaks
)
+
" peaks and "
+
std
::
to_string
(
nHills
)
+
" heals
\n
"
;
return
false
;
}
...
...
@@ -1249,7 +1244,7 @@ std::map<std::string, std::string> GetAllEi::validateInputs() {
}
catch
(
std
::
runtime_error
&
)
{
result
[
"Monitor1SpecID"
]
=
"Input workspace does not contain spectra with ID: "
+
boost
::
lexical_cast
<
std
::
string
>
(
specNum1
);
std
::
to_
string
(
specNum1
);
}
specnum_t
specNum2
=
getProperty
(
"Monitor2SpecID"
);
try
{
...
...
@@ -1257,7 +1252,7 @@ std::map<std::string, std::string> GetAllEi::validateInputs() {
}
catch
(
std
::
runtime_error
&
)
{
result
[
"Monitor2SpecID"
]
=
"Input workspace does not contain spectra with ID: "
+
boost
::
lexical_cast
<
std
::
string
>
(
specNum2
);
std
::
to_
string
(
specNum2
);
}
// check chopper and initiate it if present (for debugging)
m_chopper
=
inputWS
->
getInstrument
()
->
getComponentByName
(
"chopper-position"
);
...
...
Prev
1
2
3
4
5
…
7
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment