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
edf16d65
Commit
edf16d65
authored
Jul 17, 2019
by
Dimitar Tasev
Browse files
Run clang-tidy with modernize-auto on Framework, re #25415
parent
eca4d283
Changes
503
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
edf16d65
...
...
@@ -213,6 +213,7 @@ endif()
add_custom_target
(
AllTests
)
add_dependencies
(
AllTests FrameworkTests
)
if
(
ENABLE_MANTIDPLOT OR ENABLE_WORKBENCH
)
add_custom_target
(
GUITests
)
add_dependencies
(
check GUITests
)
...
...
Framework/API/src/Algorithm.cpp
View file @
edf16d65
...
...
@@ -57,7 +57,7 @@ public:
explicit
WorkspacePropertyValueIs
(
const
std
::
string
&
value
)
:
m_value
(
value
)
{}
bool
operator
()(
IWorkspaceProperty
*
property
)
{
Property
*
prop
=
dynamic_cast
<
Property
*>
(
property
);
auto
*
prop
=
dynamic_cast
<
Property
*>
(
property
);
if
(
!
prop
)
return
false
;
return
prop
->
value
()
==
m_value
;
...
...
@@ -221,8 +221,7 @@ const std::vector<std::string> Algorithm::categories() const {
auto
res
=
tokenizer
.
asVector
();
const
DeprecatedAlgorithm
*
depo
=
dynamic_cast
<
const
DeprecatedAlgorithm
*>
(
this
);
const
auto
*
depo
=
dynamic_cast
<
const
DeprecatedAlgorithm
*>
(
this
);
if
(
depo
!=
nullptr
)
{
res
.
emplace_back
(
"Deprecated"
);
}
...
...
@@ -494,7 +493,7 @@ bool Algorithm::executeInternal() {
Timer
timer
;
AlgorithmManager
::
Instance
().
notifyAlgorithmStarting
(
this
->
getAlgorithmID
());
{
DeprecatedAlgorithm
*
depo
=
dynamic_cast
<
DeprecatedAlgorithm
*>
(
this
);
auto
*
depo
=
dynamic_cast
<
DeprecatedAlgorithm
*>
(
this
);
if
(
depo
!=
nullptr
)
getLogger
().
error
(
depo
->
deprecationMsg
(
this
));
}
...
...
@@ -1389,7 +1388,7 @@ bool Algorithm::processGroups() {
// ---------- Create all the output workspaces ----------------------------
for
(
auto
&
pureOutputWorkspaceProp
:
m_pureOutputWorkspaceProps
)
{
Property
*
prop
=
dynamic_cast
<
Property
*>
(
pureOutputWorkspaceProp
);
auto
*
prop
=
dynamic_cast
<
Property
*>
(
pureOutputWorkspaceProp
);
if
(
prop
&&
!
prop
->
value
().
empty
())
{
auto
outWSGrp
=
boost
::
make_shared
<
WorkspaceGroup
>
();
outGroups
.
push_back
(
outWSGrp
);
...
...
@@ -1439,8 +1438,7 @@ bool Algorithm::processGroups() {
outputBaseName
+=
ws
->
getName
();
// Set the property using the name of that workspace
if
(
Property
*
prop
=
dynamic_cast
<
Property
*>
(
m_inputWorkspaceProps
[
iwp
]))
{
if
(
auto
*
prop
=
dynamic_cast
<
Property
*>
(
m_inputWorkspaceProps
[
iwp
]))
{
if
(
ws
->
getName
().
empty
())
{
alg
->
setProperty
(
prop
->
name
(),
ws
);
}
else
{
...
...
@@ -1456,7 +1454,7 @@ bool Algorithm::processGroups() {
std
::
vector
<
std
::
string
>
outputWSNames
(
m_pureOutputWorkspaceProps
.
size
());
// ---------- Set all the output workspaces ----------------------------
for
(
size_t
owp
=
0
;
owp
<
m_pureOutputWorkspaceProps
.
size
();
owp
++
)
{
if
(
Property
*
prop
=
if
(
auto
*
prop
=
dynamic_cast
<
Property
*>
(
m_pureOutputWorkspaceProps
[
owp
]))
{
// Default name = "in1_in2_out"
const
std
::
string
inName
=
prop
->
value
();
...
...
@@ -1512,8 +1510,7 @@ bool Algorithm::processGroups() {
// this has to be done after execute() because a workspace must exist
// when it is added to a group
for
(
size_t
owp
=
0
;
owp
<
m_pureOutputWorkspaceProps
.
size
();
owp
++
)
{
Property
*
prop
=
dynamic_cast
<
Property
*>
(
m_pureOutputWorkspaceProps
[
owp
]);
auto
*
prop
=
dynamic_cast
<
Property
*>
(
m_pureOutputWorkspaceProps
[
owp
]);
if
(
prop
&&
prop
->
value
().
empty
())
continue
;
// And add it to the output group
...
...
@@ -1542,7 +1539,7 @@ void Algorithm::copyNonWorkspaceProperties(IAlgorithm *alg, int periodNum) {
const
auto
&
props
=
this
->
getProperties
();
for
(
const
auto
&
prop
:
props
)
{
if
(
prop
)
{
IWorkspaceProperty
*
wsProp
=
dynamic_cast
<
IWorkspaceProperty
*>
(
prop
);
auto
*
wsProp
=
dynamic_cast
<
IWorkspaceProperty
*>
(
prop
);
// Copy the property using the string
if
(
!
wsProp
)
this
->
setOtherProperties
(
alg
,
prop
->
name
(),
prop
->
value
(),
periodNum
);
...
...
@@ -1577,8 +1574,7 @@ bool Algorithm::isWorkspaceProperty(const Kernel::Property *const prop) const {
if
(
!
prop
)
{
return
false
;
}
const
IWorkspaceProperty
*
const
wsProp
=
dynamic_cast
<
const
IWorkspaceProperty
*>
(
prop
);
const
auto
*
const
wsProp
=
dynamic_cast
<
const
IWorkspaceProperty
*>
(
prop
);
return
(
wsProp
!=
nullptr
);
}
...
...
@@ -1740,7 +1736,7 @@ void Algorithm::reportCompleted(const double &duration,
msg
<<
name
()
<<
" successful, Duration "
;
double
seconds
=
duration
;
if
(
seconds
>
60.
)
{
int
minutes
=
static_cast
<
int
>
(
seconds
/
60.
);
auto
minutes
=
static_cast
<
int
>
(
seconds
/
60.
);
msg
<<
minutes
<<
" minutes "
;
seconds
=
seconds
-
static_cast
<
double
>
(
minutes
)
*
60.
;
}
...
...
@@ -1979,9 +1975,8 @@ template <>
MANTID_API_DLL
API
::
IAlgorithm_sptr
IPropertyManager
::
getValue
<
API
::
IAlgorithm_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
API
::
IAlgorithm_sptr
>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
IAlgorithm_sptr
>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
IAlgorithm_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
*
prop
;
}
else
{
...
...
@@ -2001,9 +1996,8 @@ template <>
MANTID_API_DLL
API
::
IAlgorithm_const_sptr
IPropertyManager
::
getValue
<
API
::
IAlgorithm_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
API
::
IAlgorithm_sptr
>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
IAlgorithm_sptr
>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
IAlgorithm_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
prop
->
operator
()();
}
else
{
...
...
Framework/API/src/AlgorithmProxy.cpp
View file @
edf16d65
...
...
@@ -327,8 +327,7 @@ const std::vector<std::string> AlgorithmProxy::categories() const {
auto
res
=
tokenizer
.
asVector
();
const
DeprecatedAlgorithm
*
depo
=
dynamic_cast
<
const
DeprecatedAlgorithm
*>
(
this
);
const
auto
*
depo
=
dynamic_cast
<
const
DeprecatedAlgorithm
*>
(
this
);
if
(
depo
!=
nullptr
)
{
res
.
emplace_back
(
"Deprecated"
);
}
...
...
Framework/API/src/ExperimentInfo.cpp
View file @
edf16d65
...
...
@@ -1416,14 +1416,14 @@ void ExperimentInfo::readParameterMap(const std::string ¶meterStr) {
// create parameter's value as a sum of all tokens with index 3 or larger
// this allow a parameter's value to contain ";"
std
::
string
paramValue
=
tokens
[
3
];
int
size
=
static_cast
<
int
>
(
tokens
.
count
());
auto
size
=
static_cast
<
int
>
(
tokens
.
count
());
for
(
int
i
=
4
;
i
<
size
;
i
++
)
paramValue
+=
";"
+
tokens
[
i
];
const
auto
&
paramType
=
tokens
[
1
];
const
auto
&
paramName
=
tokens
[
2
];
if
(
paramName
==
"masked"
)
{
bool
value
=
getParam
<
bool
>
(
paramType
,
paramValue
);
auto
value
=
getParam
<
bool
>
(
paramType
,
paramValue
);
if
(
value
)
{
// Do not add masking to ParameterMap, it is stored in DetectorInfo
const
auto
componentIndex
=
...
...
@@ -1544,7 +1544,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
ExperimentInfo_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
ExperimentInfo_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
ExperimentInfo_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
ExperimentInfo_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
@@ -1561,7 +1561,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
ExperimentInfo_const_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
ExperimentInfo_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
ExperimentInfo_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
ExperimentInfo_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
Framework/API/src/FileFinder.cpp
View file @
edf16d65
...
...
@@ -367,7 +367,7 @@ FileFinderImpl::getArchiveSearch(const Kernel::FacilityInfo &facility) const {
return
archs
;
// determine if the user wants archive search for this facility
bool
createArchiveSearch
=
bool
(
archiveOpt
==
"all"
);
auto
createArchiveSearch
=
bool
(
archiveOpt
==
"all"
);
// then see if the facility name appears in the list or if we just want the
// default facility
...
...
@@ -593,7 +593,7 @@ FileFinderImpl::findRuns(const std::string &hintstr,
". The end of string value is longer than "
"the instrument's zero padding"
);
}
int
runNumber
=
boost
::
lexical_cast
<
int
>
(
run
);
auto
runNumber
=
boost
::
lexical_cast
<
int
>
(
run
);
std
::
string
runEnd
=
run
;
// Adds zero padding to end of range.
runEnd
.
replace
(
runEnd
.
end
()
-
range
[
1
].
size
(),
runEnd
.
end
(),
range
[
1
]);
...
...
@@ -603,7 +603,7 @@ FileFinderImpl::findRuns(const std::string &hintstr,
throw
std
::
invalid_argument
(
"Malformed range of runs: Part of the run "
"has a non-digit character in it."
);
int
runEndNumber
=
boost
::
lexical_cast
<
int
>
(
runEnd
);
auto
runEndNumber
=
boost
::
lexical_cast
<
int
>
(
runEnd
);
if
(
runEndNumber
<
runNumber
)
{
throw
std
::
invalid_argument
(
"Malformed range of runs: "
+
*
h
);
}
...
...
Framework/API/src/GroupingLoader.cpp
View file @
edf16d65
...
...
@@ -108,7 +108,7 @@ void GroupingLoader::loadGroupingFromXML(const std::string &filename,
grouping
.
groups
.
resize
(
groups
->
length
());
for
(
size_t
ig
=
0
;
ig
<
groups
->
length
();
ig
++
)
{
Element
*
pGroupElem
=
auto
*
pGroupElem
=
static_cast
<
Element
*>
(
groups
->
item
(
static_cast
<
long
>
(
ig
)));
if
(
!
pGroupElem
->
hasAttribute
(
"name"
))
...
...
@@ -134,7 +134,7 @@ void GroupingLoader::loadGroupingFromXML(const std::string &filename,
grouping
.
pairAlphas
.
resize
(
pairs
->
length
());
for
(
size_t
ip
=
0
;
ip
<
pairs
->
length
();
ip
++
)
{
Element
*
pPairElem
=
auto
*
pPairElem
=
static_cast
<
Element
*>
(
pairs
->
item
(
static_cast
<
long
>
(
ip
)));
if
(
!
pPairElem
->
hasAttribute
(
"name"
))
...
...
Framework/API/src/IEventWorkspace.cpp
View file @
edf16d65
...
...
@@ -45,7 +45,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IEventWorkspace_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IEventWorkspace_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IEventWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IEventWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
@@ -62,7 +62,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IEventWorkspace_const_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IEventWorkspace_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IEventWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IEventWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
Framework/API/src/IFunction.cpp
View file @
edf16d65
...
...
@@ -1089,14 +1089,13 @@ void IFunction::setMatrixWorkspace(
paramMap
.
getRecursive
(
detectorPtr
,
parameterName
(
i
),
"fitting"
);
if
(
param
!=
Geometry
::
Parameter_sptr
())
{
// get FitParameter
const
Geometry
::
FitParameter
&
fitParam
=
param
->
value
<
Geometry
::
FitParameter
>
();
const
auto
&
fitParam
=
param
->
value
<
Geometry
::
FitParameter
>
();
// check first if this parameter is actually specified for this
// function
if
(
name
()
==
fitParam
.
getFunction
())
{
// update value
IFunctionWithLocation
*
testWithLocation
=
auto
*
testWithLocation
=
dynamic_cast
<
IFunctionWithLocation
*>
(
this
);
if
(
testWithLocation
==
nullptr
||
(
!
fitParam
.
getLookUpTable
().
containData
()
&&
...
...
@@ -1302,7 +1301,7 @@ void IFunction::convertValue(std::vector<double> &values,
double
twoTheta
(
0.0
);
if
(
!
spectrumInfo
.
isMonitor
(
wsIndex
))
twoTheta
=
spectrumInfo
.
twoTheta
(
wsIndex
);
int
emode
=
static_cast
<
int
>
(
ws
->
getEMode
());
auto
emode
=
static_cast
<
int
>
(
ws
->
getEMode
());
double
efixed
(
0.0
);
try
{
boost
::
shared_ptr
<
const
Geometry
::
IDetector
>
det
(
...
...
@@ -1604,10 +1603,9 @@ template <>
MANTID_API_DLL
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>
IPropertyManager
::
getValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
*
prop
;
}
else
{
...
...
@@ -1621,10 +1619,9 @@ template <>
MANTID_API_DLL
boost
::
shared_ptr
<
const
Mantid
::
API
::
IFunction
>
IPropertyManager
::
getValue
<
boost
::
shared_ptr
<
const
Mantid
::
API
::
IFunction
>>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
boost
::
shared_ptr
<
Mantid
::
API
::
IFunction
>>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
prop
->
operator
()();
}
else
{
...
...
Framework/API/src/IFunction1D.cpp
View file @
edf16d65
...
...
@@ -44,7 +44,7 @@ void IFunction1D::function(const FunctionDomain &domain,
histoDomain
->
getPointerAt
(
0
),
histoDomain
->
size
());
return
;
}
const
FunctionDomain1D
*
d1d
=
dynamic_cast
<
const
FunctionDomain1D
*>
(
&
domain
);
const
auto
*
d1d
=
dynamic_cast
<
const
FunctionDomain1D
*>
(
&
domain
);
if
(
!
d1d
)
{
throw
std
::
invalid_argument
(
"Unexpected domain in IFunction1D"
);
}
...
...
@@ -60,7 +60,7 @@ void IFunction1D::functionDeriv(const FunctionDomain &domain,
histoDomain
->
getPointerAt
(
0
),
histoDomain
->
size
());
return
;
}
const
FunctionDomain1D
*
d1d
=
dynamic_cast
<
const
FunctionDomain1D
*>
(
&
domain
);
const
auto
*
d1d
=
dynamic_cast
<
const
FunctionDomain1D
*>
(
&
domain
);
if
(
!
d1d
)
{
throw
std
::
invalid_argument
(
"Unexpected domain in IFunction1D"
);
}
...
...
@@ -69,7 +69,7 @@ void IFunction1D::functionDeriv(const FunctionDomain &domain,
void
IFunction1D
::
derivative
(
const
FunctionDomain
&
domain
,
FunctionValues
&
values
,
const
size_t
order
)
const
{
const
FunctionDomain1D
*
d1d
=
dynamic_cast
<
const
FunctionDomain1D
*>
(
&
domain
);
const
auto
*
d1d
=
dynamic_cast
<
const
FunctionDomain1D
*>
(
&
domain
);
if
(
!
d1d
)
{
throw
std
::
invalid_argument
(
"Unexpected domain in IFunction1D"
);
}
...
...
Framework/API/src/IFunction1DSpectrum.cpp
View file @
edf16d65
...
...
@@ -14,7 +14,7 @@ Kernel::Logger IFunction1DSpectrum::g_log("IFunction1DSpectrum");
void
IFunction1DSpectrum
::
function
(
const
FunctionDomain
&
domain
,
FunctionValues
&
values
)
const
{
try
{
const
FunctionDomain1DSpectrum
&
spectrumDomain
=
const
auto
&
spectrumDomain
=
dynamic_cast
<
const
FunctionDomain1DSpectrum
&>
(
domain
);
function1DSpectrum
(
spectrumDomain
,
values
);
}
catch
(
const
std
::
bad_cast
&
)
{
...
...
@@ -26,7 +26,7 @@ void IFunction1DSpectrum::function(const FunctionDomain &domain,
void
IFunction1DSpectrum
::
functionDeriv
(
const
FunctionDomain
&
domain
,
Jacobian
&
jacobian
)
{
try
{
const
FunctionDomain1DSpectrum
&
spectrumDomain
=
const
auto
&
spectrumDomain
=
dynamic_cast
<
const
FunctionDomain1DSpectrum
&>
(
domain
);
functionDeriv1DSpectrum
(
spectrumDomain
,
jacobian
);
}
catch
(
const
std
::
bad_cast
&
)
{
...
...
Framework/API/src/IFunctionMD.cpp
View file @
edf16d65
...
...
@@ -78,7 +78,7 @@ void IFunctionMD::setWorkspace(boost::shared_ptr<const Workspace> ws) {
*/
void
IFunctionMD
::
function
(
const
FunctionDomain
&
domain
,
FunctionValues
&
values
)
const
{
const
FunctionDomainMD
*
dmd
=
dynamic_cast
<
const
FunctionDomainMD
*>
(
&
domain
);
const
auto
*
dmd
=
dynamic_cast
<
const
FunctionDomainMD
*>
(
&
domain
);
if
(
!
dmd
)
{
throw
std
::
invalid_argument
(
"Unexpected domain in IFunctionMD"
);
}
...
...
Framework/API/src/ILatticeFunction.cpp
View file @
edf16d65
...
...
@@ -25,8 +25,7 @@ ILatticeFunction::ILatticeFunction() : FunctionParameterDecorator() {}
void
ILatticeFunction
::
function
(
const
FunctionDomain
&
domain
,
FunctionValues
&
values
)
const
{
try
{
const
LatticeDomain
&
latticeDomain
=
dynamic_cast
<
const
LatticeDomain
&>
(
domain
);
const
auto
&
latticeDomain
=
dynamic_cast
<
const
LatticeDomain
&>
(
domain
);
functionLattice
(
latticeDomain
,
values
);
}
catch
(
const
std
::
bad_cast
&
)
{
...
...
@@ -48,8 +47,7 @@ void ILatticeFunction::function(const FunctionDomain &domain,
void
ILatticeFunction
::
functionDeriv
(
const
FunctionDomain
&
domain
,
Jacobian
&
jacobian
)
{
try
{
const
LatticeDomain
&
latticeDomain
=
dynamic_cast
<
const
LatticeDomain
&>
(
domain
);
const
auto
&
latticeDomain
=
dynamic_cast
<
const
LatticeDomain
&>
(
domain
);
functionDerivLattice
(
latticeDomain
,
jacobian
);
}
catch
(
const
std
::
bad_cast
&
)
{
...
...
Framework/API/src/IMDEventWorkspace.cpp
View file @
edf16d65
...
...
@@ -77,7 +77,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IMDEventWorkspace_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IMDEventWorkspace_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
@@ -96,17 +96,16 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IMDEventWorkspace_const_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IMDEventWorkspace_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_const_sptr
>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_const_sptr
>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_const_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
prop
->
operator
()();
}
else
{
// Every other class with this behaviour allows you to get a shared_ptr<T>
// property as a shared_ptr<const T>. This class should be consistent, so
// try that:
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_sptr
>
*
nonConstProp
=
auto
*
nonConstProp
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDEventWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
nonConstProp
)
{
...
...
Framework/API/src/IMDHistoWorkspace.cpp
View file @
edf16d65
...
...
@@ -40,7 +40,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IMDHistoWorkspace_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IMDHistoWorkspace_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IMDHistoWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDHistoWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
@@ -59,7 +59,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IMDHistoWorkspace_const_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IMDHistoWorkspace_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IMDHistoWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDHistoWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
Framework/API/src/IMDWorkspace.cpp
View file @
edf16d65
...
...
@@ -207,7 +207,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IMDWorkspace_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IMDWorkspace_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IMDWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
@@ -226,7 +226,7 @@ template <>
MANTID_API_DLL
Mantid
::
API
::
IMDWorkspace_const_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IMDWorkspace_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IMDWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IMDWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
Framework/API/src/IPeaksWorkspace.cpp
View file @
edf16d65
...
...
@@ -41,7 +41,7 @@ template <>
DLLExport
Mantid
::
API
::
IPeaksWorkspace_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IPeaksWorkspace_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IPeaksWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IPeaksWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
@@ -58,7 +58,7 @@ template <>
DLLExport
Mantid
::
API
::
IPeaksWorkspace_const_sptr
IPropertyManager
::
getValue
<
Mantid
::
API
::
IPeaksWorkspace_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
Mantid
::
API
::
IPeaksWorkspace_sptr
>
*
prop
=
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
Mantid
::
API
::
IPeaksWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
...
...
Framework/API/src/IPowderDiffPeakFunction.cpp
View file @
edf16d65
...
...
@@ -234,7 +234,7 @@ std::complex<double> E1(std::complex<double> z) {
std
::
complex
<
double
>
cr
=
r
;
for
(
size_t
k
=
1
;
k
<=
150
;
++
k
)
{
double
dk
=
double
(
k
);
auto
dk
=
double
(
k
);
cr
=
-
cr
*
dk
*
z
/
((
dk
+
1.0
)
*
(
dk
+
1.0
));
exp_e1
+=
cr
;
if
(
abs
(
cr
)
<
abs
(
exp_e1
)
*
1.0E-15
)
{
...
...
Framework/API/src/ITableWorkspace.cpp
View file @
edf16d65
...
...
@@ -113,9 +113,8 @@ template <>
MANTID_API_DLL
API
::
ITableWorkspace_sptr
IPropertyManager
::
getValue
<
API
::
ITableWorkspace_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
API
::
ITableWorkspace_sptr
>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
ITableWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
ITableWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
*
prop
;
}
else
{
...
...
@@ -130,9 +129,8 @@ template <>
MANTID_API_DLL
API
::
ITableWorkspace_const_sptr
IPropertyManager
::
getValue
<
API
::
ITableWorkspace_const_sptr
>
(
const
std
::
string
&
name
)
const
{
PropertyWithValue
<
API
::
ITableWorkspace_sptr
>
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
ITableWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
auto
*
prop
=
dynamic_cast
<
PropertyWithValue
<
API
::
ITableWorkspace_sptr
>
*>
(
getPointerToProperty
(
name
));
if
(
prop
)
{
return
prop
->
operator
()();
}
else
{
...
...
Framework/API/src/ImplicitFunctionParameterParserFactory.cpp
View file @
edf16d65
...
...
@@ -31,8 +31,7 @@ ImplicitFunctionParameterParser *ImplicitFunctionParameterParserFactoryImpl::
ImplicitFunctionParameterParser
*
paramParser
=
nullptr
;
ImplicitFunctionParameterParser
*
nextParser
=
nullptr
;
for
(
unsigned
long
i
=
0
;
i
<
parameters
->
length
();
i
++
)
{
Poco
::
XML
::
Element
*
parameter
=
dynamic_cast
<
Poco
::
XML
::
Element
*>
(
parameters
->
item
(
i
));
auto
*
parameter
=
dynamic_cast
<
Poco
::
XML
::
Element
*>
(
parameters
->
item
(
i
));
std
::
string
paramParserName
=
parameter
->
getChildElement
(
"Type"
)
->
innerText
()
+
"Parser"
;
// Append parser to the name. Fixed convention
...
...
Framework/API/src/LogManager.cpp
View file @
edf16d65
...
...
@@ -329,8 +329,7 @@ template <typename T>
Kernel
::
TimeSeriesProperty
<
T
>
*
LogManager
::
getTimeSeriesProperty
(
const
std
::
string
&
name
)
const
{
Kernel
::
Property
*
prop
=
getProperty
(
name
);
if
(
Kernel
::
TimeSeriesProperty
<
T
>
*
tsp
=
dynamic_cast
<
Kernel
::
TimeSeriesProperty
<
T
>
*>
(
prop
))
{
if
(
auto
*
tsp
=
dynamic_cast
<
Kernel
::
TimeSeriesProperty
<
T
>
*>
(
prop
))
{
return
tsp
;
}
else
{
throw
std
::
invalid_argument
(
"Run::getTimeSeriesProperty - '"
+
name
+
...
...
@@ -347,7 +346,7 @@ LogManager::getTimeSeriesProperty(const std::string &name) const {
template
<
typename
HeldType
>
HeldType
LogManager
::
getPropertyValueAsType
(
const
std
::
string
&
name
)
const
{
Kernel
::
Property
*
prop
=
getProperty
(
name
);
if
(
Kernel
::
PropertyWithValue
<
HeldType
>
*
valueProp
=
if
(
auto
*
valueProp
=
dynamic_cast
<
Kernel
::
PropertyWithValue
<
HeldType
>
*>
(
prop
))
{
return
(
*
valueProp
)();
}
else
{
...
...
Prev
1
2
3
4
5
…
26
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